added mock for gigachat svc
This commit is contained in:
parent
f61086c826
commit
8f0a41526e
@ -1,15 +1,15 @@
|
|||||||
package service
|
package service
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/gofiber/fiber/v2"
|
"fmt"
|
||||||
"gitea.pena/PenaSide/common/log_mw"
|
"gitea.pena/PenaSide/common/log_mw"
|
||||||
"gitea.pena/SQuiz/common/middleware"
|
"gitea.pena/SQuiz/common/middleware"
|
||||||
"gitea.pena/SQuiz/common/model"
|
"gitea.pena/SQuiz/common/model"
|
||||||
"gitea.pena/SQuiz/common/repository/quiz"
|
"gitea.pena/SQuiz/common/repository/quiz"
|
||||||
"gitea.pena/SQuiz/core/models"
|
"gitea.pena/SQuiz/core/models"
|
||||||
|
"github.com/gofiber/fiber/v2"
|
||||||
"time"
|
"time"
|
||||||
"unicode/utf8"
|
"unicode/utf8"
|
||||||
"fmt"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type CreateQuizReq struct {
|
type CreateQuizReq struct {
|
||||||
@ -103,7 +103,7 @@ func (s *Service) CreateQuiz(ctx *fiber.Ctx) error {
|
|||||||
|
|
||||||
hlogger.Emit(models.InfoQuizCreated{
|
hlogger.Emit(models.InfoQuizCreated{
|
||||||
CtxUserID: accountId,
|
CtxUserID: accountId,
|
||||||
CtxIDInt: int64(quizID),
|
CtxIDInt: int64(quizID),
|
||||||
})
|
})
|
||||||
|
|
||||||
return ctx.Status(fiber.StatusCreated).JSON(record)
|
return ctx.Status(fiber.StatusCreated).JSON(record)
|
||||||
@ -318,13 +318,13 @@ func (s *Service) UpdateQuiz(ctx *fiber.Ctx) error {
|
|||||||
if req.Status == model.StatusStart {
|
if req.Status == model.StatusStart {
|
||||||
hlogger.Emit(models.InfoQuizPublish{
|
hlogger.Emit(models.InfoQuizPublish{
|
||||||
CtxUserID: accountId,
|
CtxUserID: accountId,
|
||||||
CtxIDInt: int64(quiz.Id),
|
CtxIDInt: int64(quiz.Id),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
if req.Status == model.StatusStop {
|
if req.Status == model.StatusStop {
|
||||||
hlogger.Emit(models.InfoQuizStop{
|
hlogger.Emit(models.InfoQuizStop{
|
||||||
CtxUserID: accountId,
|
CtxUserID: accountId,
|
||||||
CtxIDInt: int64(quiz.Id),
|
CtxIDInt: int64(quiz.Id),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -432,7 +432,7 @@ func (s *Service) DeleteQuiz(ctx *fiber.Ctx) error {
|
|||||||
|
|
||||||
hlogger.Emit(models.InfoQuizDelete{
|
hlogger.Emit(models.InfoQuizDelete{
|
||||||
CtxUserID: accountId,
|
CtxUserID: accountId,
|
||||||
CtxIDInt: int64(req.Id),
|
CtxIDInt: int64(req.Id),
|
||||||
})
|
})
|
||||||
|
|
||||||
return ctx.JSON(DeactivateResp{
|
return ctx.JSON(DeactivateResp{
|
||||||
@ -523,3 +523,15 @@ func (s *Service) TemplateCopy(ctx *fiber.Ctx) error {
|
|||||||
|
|
||||||
return ctx.Status(fiber.StatusOK).JSON(fiber.Map{"id": qizID})
|
return ctx.Status(fiber.StatusOK).JSON(fiber.Map{"id": qizID})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s *Service) CreateQuizAuditory(ctx *fiber.Ctx) error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *Service) GetQuizAuditory(ctx *fiber.Ctx) error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *Service) DeleteQuizAuditory(ctx *fiber.Ctx) error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
package service
|
package service
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/gofiber/fiber/v2"
|
|
||||||
"gitea.pena/SQuiz/common/dal"
|
"gitea.pena/SQuiz/common/dal"
|
||||||
"gitea.pena/SQuiz/core/brokers"
|
"gitea.pena/SQuiz/core/brokers"
|
||||||
"gitea.pena/SQuiz/core/clients/auth"
|
"gitea.pena/SQuiz/core/clients/auth"
|
||||||
|
"github.com/gofiber/fiber/v2"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Service is an entity for http requests handling
|
// Service is an entity for http requests handling
|
||||||
@ -50,6 +50,10 @@ func (s *Service) Register(app *fiber.App) {
|
|||||||
app.Post("/quiz/move", s.QuizMove)
|
app.Post("/quiz/move", s.QuizMove)
|
||||||
app.Post("/quiz/template", s.TemplateCopy)
|
app.Post("/quiz/template", s.TemplateCopy)
|
||||||
|
|
||||||
|
app.Post("/quiz/:quizID/auditory", s.CreateQuizAuditory)
|
||||||
|
app.Get("/quiz/:quizID/auditory", s.GetQuizAuditory)
|
||||||
|
app.Delete("/quiz/:quizID/auditory", s.DeleteQuizAuditory)
|
||||||
|
|
||||||
// question manipulating handlers
|
// question manipulating handlers
|
||||||
app.Post("/question/create", s.CreateQuestion)
|
app.Post("/question/create", s.CreateQuestion)
|
||||||
app.Post("/question/getList", s.GetQuestionList)
|
app.Post("/question/getList", s.GetQuestionList)
|
||||||
|
Loading…
Reference in New Issue
Block a user