using Govor.Core.Infrastructure.Extensions; using Govor.Core.Infrastructure.Validators; using Govor.Core.Models; using Govor.Core.Repositories.MediasAttachments; using Govor.Data.Repositories.Exceptions; using Microsoft.EntityFrameworkCore; namespace Govor.Data.Repositories; public class MediaAttachmentsRepository : IMediaAttachmentsRepository { public IObjectValidator _validator; public GovorDbContext _context; public MediaAttachmentsRepository(GovorDbContext context, IObjectValidator validator) { _context = context; _validator = validator; } public async Task> GetAllAsync() { return await _context.MediaAttachments .AsNoTracking() .Include(ma => ma.Message) .ToListOrThrowIfEmpty(new NotFoundException("No media attachments found.")); } public async Task> GetAllByMessageId(Guid messageId) { return await _context.MediaAttachments .AsNoTracking() .Include(ma => ma.Message) .Where(m => m.MessageId == messageId) .ToListOrThrowIfEmpty(new NotFoundByKeyException(messageId, "No media attachments found by given message Id")); } public Task AddAsync(MediaAttachments mediaAttachments) { throw new NotImplementedException(); } public Task UpdateAsync(MediaAttachments mediaAttachments) { throw new NotImplementedException(); } public Task RemoveAsync(Guid Id) { throw new NotImplementedException(); } public bool Exists(Guid id) { throw new NotImplementedException(); } public bool Exists(MediaAttachments attachments) { throw new NotImplementedException(); } }