Class ChallengeService
java.lang.Object
fr.utc.miage.sporttrack.service.event.ChallengeService
Service layer component responsible for managing
Challenge entities
within the SportTrack application.
Provides business logic for saving and retrieving challenges.
- Author:
- SportTrack Team
-
Constructor Summary
ConstructorsConstructorDescriptionChallengeService(ChallengeRepository challengeRepository) Constructs a newChallengeServicewith the given repository. -
Method Summary
Modifier and TypeMethodDescriptiongetChallengeById(int id) Retrieves a challenge by its unique identifier.voidsaveChallenge(Challenge challenge, Athlete athlete, Sport sport) Saves a challenge entity, associating it with the given organiser athlete and sport.
-
Constructor Details
-
ChallengeService
Constructs a newChallengeServicewith the given repository.- Parameters:
challengeRepository- the repository for challenge data access
-
-
Method Details
-
saveChallenge
Saves a challenge entity, associating it with the given organiser athlete and sport. Does nothing if any of the parameters isnull.- Parameters:
challenge- the challenge entity to saveathlete- the athlete who organises the challengesport- the sport to which the challenge applies
-
getChallengeById
Retrieves a challenge by its unique identifier.- Parameters:
id- the challenge identifier- Returns:
- the matching
Challenge, ornullif not found
-