Created endpoints to manage groups

This commit is contained in:
2026-02-22 15:16:53 +01:00
parent 3b0f25d450
commit f75eecc712
11 changed files with 206 additions and 1 deletions
@@ -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));
}
}