add architecture skeleton

This commit is contained in:
2026-04-19 13:12:04 +03:00
parent 312708531f
commit 2738f31f26
84 changed files with 2710 additions and 70 deletions
@@ -0,0 +1,28 @@
using GymLogAI.Application.Interfaces;
using GymLogAI.Core.Entities;
using Microsoft.EntityFrameworkCore;
namespace GymLogAI.Persistence.Repositories;
public sealed class WorkoutRepository(AppDbContext dbContext) : IWorkoutRepository
{
public async Task<Workout> AddAsync(Workout workout, CancellationToken cancellationToken)
{
dbContext.Workouts.Add(workout);
await dbContext.SaveChangesAsync(cancellationToken);
return workout;
}
public async Task<IReadOnlyCollection<Workout>> GetHistoryAsync(Guid userId, CancellationToken cancellationToken)
{
return await dbContext.Workouts
.AsNoTracking()
.Include(x => x.WorkoutExercises)
.ThenInclude(x => x.Exercise)
.Include(x => x.WorkoutExercises)
.ThenInclude(x => x.Sets)
.Where(x => x.UserId == userId)
.OrderByDescending(x => x.PerformedAtUtc)
.ToListAsync(cancellationToken);
}
}