ms-tester/internal/contests/usecase/usecase.go
Vyacheslav1557 be25404852 feat:
2024-10-13 19:01:36 +05:00

32 lines
761 B
Go

package usecase
import (
"context"
"git.sch9.ru/new_gate/models"
"git.sch9.ru/new_gate/ms-tester/internal/contests"
)
type ContestUseCase struct {
contestRepo contests.ContestRepository
}
func NewContestUseCase(
contestRepo contests.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)
}