Created all endpoints and DTO to achievements

This commit is contained in:
2026-02-21 15:45:55 +01:00
parent 3588200211
commit e677ff0f0a
11 changed files with 183 additions and 1 deletions
@@ -0,0 +1,13 @@
using Ardalis.Specification;
using BeReadyBackend.Models;
namespace BeReadyBackend.Specifications.Achievements;
public class GetAchievementByIdSpec : SingleResultSpecification<Achievement>
{
public GetAchievementByIdSpec(int achievementId)
{
Query
.Where(x => x.Id == achievementId);
}
}
@@ -0,0 +1,13 @@
using Ardalis.Specification;
using BeReadyBackend.Models;
namespace BeReadyBackend.Specifications.UserAchievements;
public class GetUserAchievementByIdSpec : SingleResultSpecification<UserAchievement>
{
public GetUserAchievementByIdSpec(int userId, int achievementId)
{
Query
.Where(x => x.UserId == userId && x.AchievementId == achievementId);
}
}
@@ -0,0 +1,14 @@
using Ardalis.Specification;
using BeReadyBackend.Models;
namespace BeReadyBackend.Specifications.UserAchievements;
public class GetUserAchievementByUserIdSpec : Specification<UserAchievement>
{
public GetUserAchievementByUserIdSpec(int userId)
{
Query
.Include(x => x.Achievement)
.Where(x => x.UserId == userId);
}
}
@@ -0,0 +1,13 @@
using Ardalis.Specification;
using BeReadyBackend.Models;
namespace BeReadyBackend.Specifications.Users;
public class GetUserByIdSpec : SingleResultSpecification<User>
{
public GetUserByIdSpec(int userId)
{
Query
.Where(x => x.Id == userId);
}
}