add architecture skeleton
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
using GymLogAI.Application.DTOs;
|
||||
using GymLogAI.Application.Interfaces;
|
||||
using GymLogAI.Core.Enums;
|
||||
|
||||
namespace GymLogAI.Application.Handlers;
|
||||
|
||||
public sealed class RecommendWorkoutHandler(
|
||||
IWorkoutRepository workoutRepository,
|
||||
IWorkoutRecommendationGenerator workoutRecommendationGenerator)
|
||||
{
|
||||
public async Task<WorkoutRecommendationDto> HandleAsync(
|
||||
RecommendWorkoutCommand command,
|
||||
CancellationToken cancellationToken)
|
||||
{
|
||||
var history = await workoutRepository.GetHistoryAsync(command.UserId, cancellationToken);
|
||||
|
||||
var context = new WorkoutRecommendationContext(
|
||||
command.UserId,
|
||||
command.GoalType,
|
||||
command.AdditionalContext);
|
||||
|
||||
return await workoutRecommendationGenerator.GenerateAsync(context, history, cancellationToken);
|
||||
}
|
||||
}
|
||||
|
||||
public sealed record RecommendWorkoutCommand(Guid UserId, GoalType GoalType, string? AdditionalContext);
|
||||
Reference in New Issue
Block a user