Created endpoints to manage groups
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
using Ardalis.Specification;
|
||||
using BeReadyBackend.Models;
|
||||
|
||||
namespace BeReadyBackend.Specifications.Groups;
|
||||
|
||||
public class GetGroupByIdSpec : SingleResultSpecification<Group>
|
||||
{
|
||||
public GetGroupByIdSpec(int groupId)
|
||||
{
|
||||
Query
|
||||
.Include(x => x.UserGroups)
|
||||
.Where(x => x.Id == groupId);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
using Ardalis.Specification;
|
||||
using BeReadyBackend.Models;
|
||||
|
||||
namespace BeReadyBackend.Specifications.Groups;
|
||||
|
||||
public class GetUserGroupByIdSpec : Specification<UserGroup>
|
||||
{
|
||||
public GetUserGroupByIdSpec(int groupId, int userId)
|
||||
{
|
||||
Query
|
||||
.Include(x => x.User!)
|
||||
.Where(x => x.GroupId == groupId && x.Group!.UserGroups!.Any(y => y.UserId == userId));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user