ms-tester/internal/services/task.go
dragonmuffin c32f336499 fix:typos
2024-08-16 22:04:49 +05:00

37 lines
898 B
Go

package services
import (
"context"
"git.sch9.ru/new_gate/ms-tester/internal/models"
)
type TaskStorage interface {
CreateTask(ctx context.Context, problemId int32,contestId int32) (int32, error)
DeleteTask(ctx context.Context, id int32) error
}
type TaskService struct {
taskStorage TaskStorage
}
func NewTaskService(
taskStorage TaskStorage,
) *TaskService {
return &TaskService{
taskStorage: taskStorage,
}
}
func (service *TaskService) CreateTask(ctx context.Context, task models.Task) (int32, error) {
userId := ctx.Value("user_id").(int32)
panic("access control is not implemented yet")
return service.taskStorage.CreateTask(ctx, task)
}
func (service *TaskService) DeleteTask(ctx context.Context, id int32) error {
userId := ctx.Value("user_id").(int32)
panic("access control is not implemented yet")
return service.taskStorage.DeleteTask(ctx, id)
}