mirror of
https://github.com/Govor-team/Govor.git
synced 2026-07-22 20:24:55 +00:00
62 lines
1.8 KiB
C#
62 lines
1.8 KiB
C#
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<MediaAttachments> _validator;
|
|
public GovorDbContext _context;
|
|
|
|
public MediaAttachmentsRepository(GovorDbContext context, IObjectValidator<MediaAttachments> validator)
|
|
{
|
|
_context = context;
|
|
_validator = validator;
|
|
}
|
|
|
|
public async Task<List<MediaAttachments>> GetAllAsync()
|
|
{
|
|
return await _context.MediaAttachments
|
|
.AsNoTracking()
|
|
.Include(ma => ma.Message)
|
|
.ToListOrThrowIfEmpty(new NotFoundException("No media attachments found."));
|
|
}
|
|
|
|
public async Task<List<MediaAttachments>> GetAllByMessageId(Guid messageId)
|
|
{
|
|
return await _context.MediaAttachments
|
|
.AsNoTracking()
|
|
.Include(ma => ma.Message)
|
|
.Where(m => m.MessageId == messageId)
|
|
.ToListOrThrowIfEmpty(new NotFoundByKeyException<Guid>(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();
|
|
}
|
|
} |