添加项目文件。
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
using GroupService.Domain.Entities;
|
||||
using GroupService.Domain.IReposities;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace GroupService.Infrastructure.Reposities
|
||||
{
|
||||
public class GroupJoinRequestReposity : IGroupRequestReposity
|
||||
{
|
||||
private readonly GroupDbContext db;
|
||||
|
||||
public GroupJoinRequestReposity(GroupDbContext db)
|
||||
{
|
||||
this.db = db;
|
||||
}
|
||||
|
||||
public void Create(GroupJoinRequest request)
|
||||
{
|
||||
db.GroupJoinRequests.Add(request);
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<GroupJoinRequest>> FindByGroupIdAsync(Guid groupId)
|
||||
{
|
||||
return await db.GroupJoinRequests.Where(x => x.GroupId == groupId)
|
||||
.OrderByDescending(o => o.CreationTime)
|
||||
.ToListAsync();
|
||||
}
|
||||
|
||||
public async Task<GroupJoinRequest?> FindByIdAsync(Guid id)
|
||||
{
|
||||
return await db.GroupJoinRequests.FirstOrDefaultAsync(x => x.Id == id);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user