using Microsoft.EntityFrameworkCore; using SPMS.Domain.Entities; using SPMS.Domain.Enums; using SPMS.Domain.Interfaces; namespace SPMS.Infrastructure.Persistence.Repositories; public class ServiceRepository : Repository, IServiceRepository { public ServiceRepository(AppDbContext context) : base(context) { } public async Task GetByServiceCodeAsync(string serviceCode) => await _dbSet.FirstOrDefaultAsync(s => s.ServiceCode == serviceCode); public async Task GetByApiKeyAsync(string apiKey) => await _dbSet.FirstOrDefaultAsync(s => s.ApiKey == apiKey); public async Task GetByIdWithIpsAsync(long id) => await _dbSet .Include(s => s.ServiceIps) .FirstOrDefaultAsync(s => s.Id == id); public async Task> GetByStatusAsync(ServiceStatus status) => await _dbSet.Where(s => s.Status == status).ToListAsync(); }