Class ChallengeService

java.lang.Object
fr.utc.miage.sporttrack.service.event.ChallengeService

@Service public class ChallengeService extends Object
Service layer component responsible for managing Challenge entities within the SportTrack application.

Provides business logic for saving and retrieving challenges.

Author:
SportTrack Team
  • Constructor Details

    • ChallengeService

      public ChallengeService(ChallengeRepository challengeRepository)
      Constructs a new ChallengeService with the given repository.
      Parameters:
      challengeRepository - the repository for challenge data access
  • Method Details

    • saveChallenge

      public void saveChallenge(Challenge challenge, Athlete athlete, Sport sport)
      Saves a challenge entity, associating it with the given organiser athlete and sport. Does nothing if any of the parameters is null.
      Parameters:
      challenge - the challenge entity to save
      athlete - the athlete who organises the challenge
      sport - the sport to which the challenge applies
    • getChallengeById

      public Challenge getChallengeById(int id)
      Retrieves a challenge by its unique identifier.
      Parameters:
      id - the challenge identifier
      Returns:
      the matching Challenge, or null if not found