Adding MaidBotApi

This commit is contained in:
Zeeshaun
2026-03-11 13:21:47 -05:00
parent f3cb730f3b
commit f004c8205a
122 changed files with 4227 additions and 0 deletions
@@ -0,0 +1,59 @@
using LCU.Api.Internal.MaidBotLib.Models;
using LCU.Api.Internal.MaidBotLib.Persistence;
using Microsoft.EntityFrameworkCore;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace LCU.Api.Internal.MaidBotLib.Repositories
{
public class LoggingMatrixRepository : BaseRepository, ILoggingMatrixRepository
{
public LoggingMatrixRepository(AppDbContext context) : base(context) { }
public async Task<IEnumerable<LoggingMatrix>> ListAsync()
{
return await _context.LoggingMatrixs.ToListAsync();
}
public async Task<IEnumerable<LoggingMatrix>> ListActiveAsync()
{
return await _context.LoggingMatrixs.Where(loggingMatrix => !loggingMatrix.Disabled).ToListAsync();
}
public async Task<LoggingMatrix> FindByIdAsync(int id)
{
return await _context.LoggingMatrixs.Where(loggingMatrix => loggingMatrix.LoggingMatrixId == id).FirstOrDefaultAsync();
}
public async Task<IEnumerable<LoggingMatrix>> RetrieveByApplicationLevelAndGroup(string application, string level, string group)
{
return await _context.LoggingMatrixs
.Where(matrix => matrix.Application == application &&
matrix.Level == level &&
matrix.Group == group &&
!matrix.Disabled)
.ToListAsync();
}
public async Task<IEnumerable<LoggingMatrix>> RetrieveByApplciationAndLevel(string application, string level)
{
return await _context.LoggingMatrixs
.Where(matrix => matrix.Application == application &&
matrix.Level == level &&
!matrix.Disabled)
.ToListAsync();
}
public async Task<LoggingMatrix> AddAsync(LoggingMatrix loggingMatrix)
{
var result = await _context.LoggingMatrixs.AddAsync(loggingMatrix);
return result.Entity;
}
public void Update(LoggingMatrix loggingMatrix)
{
_context.LoggingMatrixs.Update(loggingMatrix);
}
}
}