Skip to content

Latest commit

 

History

History
61 lines (48 loc) · 2.22 KB

File metadata and controls

61 lines (48 loc) · 2.22 KB

GetProgramUsecase

Purpose

Executes this business operation according to domain rules implemented in the use case.

Trigger / entry point

  • Internal invocation through dependency injection (Inversify).

Inputs

Name Required Type Description
dto Yes object Use case input DTO (see implementation file).

Preconditions

  • Input DTO must respect constraints enforced by the implementation.
  • Caller context/authorization must satisfy business checks implemented in the use case.

Main flow

  1. Validates input/access constraints defined in execute and helper guards.
  2. Uses bddService dependency to read/write required domain data.
  3. Grants immediate access when requester is ADMIN or when program visibility is PUBLIC.
  4. For private programs, enforces:
    • assigned athlete can read own assignment,
    • creator coach can read unassigned templates,
    • creator coach can read assigned programs only with an active coach-athlete link.
  5. Uses resolveCoachAthleteVisibilityUsecase to evaluate active link validity at request time.
  6. Uses loggerService dependency to read/write required domain data.

Outputs / side effects

  • Returns the use case result (entity/model/list or boolean depending on implementation).
  • Logs execution errors through the logger service before normalization/rethrow.

Error cases / edge cases

  • Throws ERRORS.GET_PROGRAM_FORBIDDEN when the corresponding guard/validation fails.
  • Normalizes or references error code ERRORS.GET_PROGRAM_FORBIDDEN.
  • Normalizes or references error code ERRORS.GET_PROGRAM_USECASE.

Dependencies

  • bddService
  • loggerService
  • resolveCoachAthleteVisibilityUsecase

Related files

  • api/src/usecases/sport/program/get.program.usecase.ts
  • api/src/usecases/sport/program/__tests__/get.program.usecase.spec.ts

Example

{
  "dto": "see implementation DTO"
}

Notes / limitations

  • 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.

Automated test reference

  • api/src/usecases/sport/program/__tests__/get.program.usecase.spec.ts