Starts a session report for an athlete.
- Internal invocation through dependency injection (Inversify).
| Name | Required | Type | Description |
|---|---|---|---|
dto |
Yes | object |
Use case input DTO (see implementation file). |
- Input DTO must respect constraints enforced by the implementation.
- Caller context/authorization must satisfy business checks implemented in the use case.
- Coaches creating reports for athletes must have an active link (verified via
ResolveCoachAthleteVisibilityUsecase).
- Validates input/access constraints defined in
executeandassertCreationRights. - Verifies coach-athlete link if requester is a COACH.
- Validates and sanitizes optional set payload values (
repetitions,charge,rpe). - Validates optional fatigue payload.
- Uses
bddServiceto persist the session report. - Uses
getProgramUsecaseto ensure program accessibility.
- Returns the created or existing session report.
- Persists domain state changes in the database.
- Logs execution errors.
- Throws
ERRORS.COACH_ATHLETE_VISIBILITY_FORBIDDENif a coach attempts to create a report for an unauthorized athlete. - Throws
'INVALID_EVENT_DATE'when the corresponding guard/validation fails. - Throws
'INVALID_SESSION_REPORT_FATIGUE'when fatigue payload is invalid. - Throws
'INVALID_SESSION_REPORT_SET_PAYLOAD'when set payload contains invalid values. - Throws
ERRORS.FORBIDDENwhen the corresponding guard/validation fails. - Normalizes or references error code
ERRORS.CREATE_SESSION_REPORT_USECASE.
bddServicegetProgramUsecaseloggerServiceresolveCoachAthleteVisibilityUsecase
api/src/usecases/sport/session-report/create.session-report.usecase.tsapi/src/usecases/sport/session-report/__tests__/create.session-report.usecase.spec.ts
{
"dto": "see implementation DTO"
}- This document is generated from code and should be updated whenever behavior changes in implementation.
- If helper modules define additional rules, they are authoritative over this summary.