Added endpoints to generate challenges

This commit is contained in:
2026-03-11 22:04:21 +01:00
parent c1735c6369
commit 461a3b759e
13 changed files with 233 additions and 16 deletions
@@ -0,0 +1,13 @@
using Ardalis.Specification;
using BeReadyBackend.Models;
namespace BeReadyBackend.Specifications.RandomChallenges;
public class GetRandomChallengeByCriteriaSpec : SingleResultSpecification<UserRandomChallenge>
{
public GetRandomChallengeByCriteriaSpec(int challengeId, int userId)
{
Query
.Where(x => x.RandomChallengeId == challengeId && x.UserId == userId);
}
}
@@ -0,0 +1,13 @@
using Ardalis.Specification;
using BeReadyBackend.Models;
namespace BeReadyBackend.Specifications.RandomChallenges;
public class GetRandomChallengeByIdSpec : SingleResultSpecification<RandomChallenge>
{
public GetRandomChallengeByIdSpec(int randomChallengeId)
{
Query
.Where(x => x.Id == randomChallengeId);
}
}
@@ -0,0 +1,13 @@
using Ardalis.Specification;
using BeReadyBackend.Models;
namespace BeReadyBackend.Specifications.RandomChallenges;
public class GetRandomChallengesNotAlreadyPastSpec : Specification<RandomChallenge>
{
public GetRandomChallengesNotAlreadyPastSpec()
{
Query
.Where(x => !x.IsAlreadyPast);
}
}
@@ -0,0 +1,13 @@
using Ardalis.Specification;
using BeReadyBackend.Models;
namespace BeReadyBackend.Specifications.Users;
public class GetAllUsersSpec : Specification<User>
{
public GetAllUsersSpec()
{
Query
.Where(x => x.Id != 0);
}
}