mirror of
https://github.com/Govor-team/Govor.git
synced 2026-07-21 19:54:55 +00:00
Messages first init
This commit is contained in:
@@ -8,6 +8,7 @@ public class GovorDbContext(DbContextOptions<GovorDbContext> options) : DbContex
|
||||
{
|
||||
public virtual DbSet<User> Users { get; set; }
|
||||
public virtual DbSet<ChatGroup> ChatGroups { get; set; }
|
||||
public virtual DbSet<Message> Messages { get; set; }
|
||||
public virtual DbSet<GroupMembership> GroupMemberships { get; set; }
|
||||
public virtual DbSet<GroupAdmins> GroupAdmins { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
using Govor.Core.Infrastructure.Extensions;
|
||||
using Govor.Core.Infrastructure.Validators;
|
||||
using Govor.Core.Models;
|
||||
using Govor.Core.Repositories.Messages;
|
||||
using Govor.Data.Repositories.Exceptions;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace Govor.Data.Repositories;
|
||||
|
||||
public class MessagesRepository : IMessagesRepository
|
||||
{
|
||||
private GovorDbContext _context;
|
||||
private IObjectValidator<Message> _validator;
|
||||
|
||||
public MessagesRepository(GovorDbContext context, IObjectValidator<Message> validator)
|
||||
{
|
||||
_context = context;
|
||||
_validator = validator;
|
||||
}
|
||||
|
||||
public async Task<List<Message>> GetAllAsync()
|
||||
{
|
||||
return await _context.Messages
|
||||
.AsNoTracking()
|
||||
.Where(x => true)
|
||||
.ToListOrThrowIfEmpty(new NotFoundException("Messages in Database not exists"));
|
||||
}
|
||||
|
||||
public Task<Message> FindByIdAsync(Guid messageId)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public Task<List<Message>> FindBySenderIdAsync(Guid senderId)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public Task<List<Message>> FindByReceiverIdAsync(Guid receiverId)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public Task<List<Message>> FindBySenderAndReceiverIdAsync(Guid senderId, Guid receiverId)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public Task<List<Message>> FindBySentAtAsync(DateTime date)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void Add(Message message)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void Update(Message message)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void Delete(Guid messageId)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public bool Exist(Message message)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user