ms-tester/internal/contests/usecase/usecase.go

32 lines
761 B
Go
Raw Normal View History

2024-10-09 18:55:16 +00:00
package usecase
2024-08-16 16:50:47 +00:00
import (
"context"
2024-10-05 16:05:29 +00:00
"git.sch9.ru/new_gate/models"
2024-10-09 18:55:16 +00:00
"git.sch9.ru/new_gate/ms-tester/internal/contests"
2024-08-16 16:50:47 +00:00
)
2024-10-13 14:01:36 +00:00
type ContestUseCase struct {
contestRepo contests.ContestRepository
2024-08-16 16:50:47 +00:00
}
2024-10-13 14:01:36 +00:00
func NewContestUseCase(
contestRepo contests.ContestRepository,
) *ContestUseCase {
return &ContestUseCase{
contestRepo: contestRepo,
2024-08-16 16:50:47 +00:00
}
}
2024-10-13 14:01:36 +00:00
func (uc *ContestUseCase) CreateContest(ctx context.Context, title string) (int32, error) {
return uc.contestRepo.CreateContest(ctx, title)
2024-08-16 16:50:47 +00:00
}
2024-10-13 14:01:36 +00:00
func (uc *ContestUseCase) ReadContestById(ctx context.Context, id int32) (*models.Contest, error) {
return uc.contestRepo.ReadContestById(ctx, id)
2024-08-16 16:50:47 +00:00
}
2024-10-13 14:01:36 +00:00
func (uc *ContestUseCase) DeleteContest(ctx context.Context, id int32) error {
return uc.contestRepo.DeleteContest(ctx, id)
2024-08-16 16:50:47 +00:00
}