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

36 lines
945 B
Go

package usecase
import (
"context"
"git.sch9.ru/new_gate/ms-tester/internal/models"
"git.sch9.ru/new_gate/ms-tester/internal/problems"
"git.sch9.ru/new_gate/ms-tester/pkg/external/pandoc"
)
type ProblemUseCase struct {
problemRepo problems.ProblemPostgresRepository
pandocClient pandoc.PandocClient
}
func NewProblemUseCase(
problemRepo problems.ProblemPostgresRepository,
pandocClient pandoc.PandocClient,
) *ProblemUseCase {
return &ProblemUseCase{
problemRepo: problemRepo,
pandocClient: pandocClient,
}
}
func (u *ProblemUseCase) CreateProblem(ctx context.Context, title string) (int32, error) {
return u.problemRepo.CreateProblem(ctx, title)
}
func (u *ProblemUseCase) ReadProblemById(ctx context.Context, id int32) (*models.Problem, error) {
return u.problemRepo.ReadProblemById(ctx, id)
}
func (u *ProblemUseCase) DeleteProblem(ctx context.Context, id int32) error {
return u.problemRepo.DeleteProblem(ctx, id)
}