2024-04-09 15:52:37 +00:00
|
|
|
package service
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
2024-04-17 12:21:06 +00:00
|
|
|
"penahub.gitlab.yandexcloud.net/backend/quiz/common.git/model"
|
2024-04-09 15:52:37 +00:00
|
|
|
)
|
|
|
|
|
2024-04-17 12:21:06 +00:00
|
|
|
func (s *Service) ChangeQuizSettings(ctx context.Context, request *model.RulesReq) error {
|
2024-04-09 15:52:37 +00:00
|
|
|
|
2024-04-17 12:21:06 +00:00
|
|
|
err := s.repository.AmoRepo.ChangeQuizSettings(ctx, request)
|
2024-04-09 15:52:37 +00:00
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2024-04-17 12:21:06 +00:00
|
|
|
func (s *Service) SetQuizSettings(ctx context.Context, request *model.RulesReq) error {
|
2024-04-09 15:52:37 +00:00
|
|
|
|
2024-04-17 12:21:06 +00:00
|
|
|
err := s.repository.AmoRepo.SetQuizSettings(ctx, request)
|
2024-04-09 15:52:37 +00:00
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2024-04-17 12:21:06 +00:00
|
|
|
func (s *Service) GettingQuizRules(ctx context.Context) (*model.Rule, error) {
|
2024-04-09 15:52:37 +00:00
|
|
|
|
2024-04-17 12:21:06 +00:00
|
|
|
response, err := s.repository.AmoRepo.GettingQuizRules(ctx)
|
2024-04-09 15:52:37 +00:00
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
return response, nil
|
|
|
|
}
|