package usecase import ( "context" "git.sch9.ru/new_gate/ms-tester/internal/models" "git.sch9.ru/new_gate/ms-tester/internal/tester" ) type ContestUseCase struct { contestRepo tester.ContestRepository } func NewContestUseCase( contestRepo tester.ContestRepository, ) *ContestUseCase { return &ContestUseCase{ contestRepo: contestRepo, } } func (uc *ContestUseCase) CreateContest(ctx context.Context, title string) (int32, error) { return uc.contestRepo.CreateContest(ctx, title) } func (uc *ContestUseCase) ReadContestById(ctx context.Context, id int32) (*models.Contest, error) { return uc.contestRepo.ReadContestById(ctx, id) } func (uc *ContestUseCase) DeleteContest(ctx context.Context, id int32) error { return uc.contestRepo.DeleteContest(ctx, id) } func (uc *ContestUseCase) AddTask(ctx context.Context, contestId int32, taskId int32) (id int32, err error) { return uc.contestRepo.AddTask(ctx, contestId, taskId) } func (uc *ContestUseCase) DeleteTask(ctx context.Context, taskId int32) error { return uc.contestRepo.DeleteTask(ctx, taskId) } func (uc *ContestUseCase) AddParticipant(ctx context.Context, contestId int32, userId int32) (id int32, err error) { return uc.contestRepo.AddParticipant(ctx, contestId, userId) } func (uc *ContestUseCase) DeleteParticipant(ctx context.Context, participantId int32) error { return uc.contestRepo.DeleteParticipant(ctx, participantId) } func (uc *ContestUseCase) ReadRichTasks(ctx context.Context, contestId int32) ([]*models.RichTask, error) { return uc.contestRepo.ReadRichTasks(ctx, contestId) } func (uc *ContestUseCase) ListContests(ctx context.Context, page int32, pageSize int32) ([]*models.ContestsListItem, int32, error) { return uc.contestRepo.ListContests(ctx, page, pageSize) } func (uc *ContestUseCase) ListParticipants(ctx context.Context, contestId int32, page int32, pageSize int32) ([]*models.ParticipantsListItem, int32, error) { return uc.contestRepo.ListParticipants(ctx, contestId, page, pageSize) } func (uc *ContestUseCase) UpdateContest(ctx context.Context, id int32, contestUpdate models.ContestUpdate) error { return uc.contestRepo.UpdateContest(ctx, id, contestUpdate) } func (uc *ContestUseCase) UpdateParticipant(ctx context.Context, id int32, participantUpdate models.ParticipantUpdate) error { return uc.contestRepo.UpdateParticipant(ctx, id, participantUpdate) } func (uc *ContestUseCase) ReadSolution(ctx context.Context, id int32) (*models.Solution, error) { return uc.contestRepo.ReadSolution(ctx, id) } func (uc *ContestUseCase) CreateSolution(ctx context.Context, creation *models.SolutionCreation) (int32, error) { return uc.contestRepo.CreateSolution(ctx, creation) } func (uc *ContestUseCase) ListSolutions(ctx context.Context, filters models.SolutionsFilter) ([]*models.SolutionsListItem, int32, error) { return uc.contestRepo.ListSolutions(ctx, filters) }