Merge branch 'hlog' into 'staging'

fix hlog structs

See merge request backend/quiz/core!20
This commit is contained in:
Mikhail 2024-06-12 13:51:32 +00:00 committed by skeris
commit 9b27a9634f
3 changed files with 22 additions and 22 deletions

@ -7,9 +7,9 @@ type AllFields struct {
KeyPath string KeyPath string
CtxUserID string CtxUserID string
CtxAccountID string CtxAccountID string
CtxID uint64 CtxIDInt int64
CtxQuizID uint64 CtxQuizID int64
CtxQuestionID uint64 CtxQuestionID int64
} }
type InfoAccountCreated struct { type InfoAccountCreated struct {
@ -18,32 +18,32 @@ type InfoAccountCreated struct {
} }
type InfoQuizCreated struct { type InfoQuizCreated struct {
CtxUserID string //айдишник юзера из токена CtxUserID string //айдишник юзера из токена
CtxID uint64 //айдишник создаваемого квиза CtxIDInt int64 //айдишник создаваемого квиза
} }
type InfoQuizPublish struct { // если статус меняется на start type InfoQuizPublish struct { // если статус меняется на start
CtxUserID string //айдишник юзера из токена CtxUserID string //айдишник юзера из токена
CtxID uint64 //айдишник публикуемого квиза CtxIDInt int64 //айдишник публикуемого квиза
} }
type InfoQuizDelete struct { // если квиз удаляется type InfoQuizDelete struct { // если квиз удаляется
CtxUserID string //айдишник юзера из токена CtxUserID string //айдишник юзера из токена
CtxID uint64 //айдишник удаляемого квиза CtxIDInt int64 //айдишник удаляемого квиза
} }
type InfoQuizStop struct { // если статус меняется на stop type InfoQuizStop struct { // если статус меняется на stop
CtxUserID string //айдишник юзера из токена CtxUserID string //айдишник юзера из токена
CtxID uint64 //айдишник останавливаемого квиза CtxIDInt int64 //айдишник останавливаемого квиза
} }
type InfoQuizTemplateCopy struct { type InfoQuizTemplateCopy struct {
CtxUserID string //айдишник юзера из токена CtxUserID string //айдишник юзера из токена
CtxID uint64 //айдишник копируемого квиза CtxIDInt int64 //айдишник копируемого квиза
CtxQuizID uint64 // айдишник опроса после копирования CtxQuizID int64 // айдишник опроса после копирования
} }
type InfoQuestionCreate struct { type InfoQuestionCreate struct {
CtxUserID string //айдишник юзера из токена CtxUserID string //айдишник юзера из токена
CtxID uint64 //айдишник останавливаемого квиза CtxIDInt int64 //айдишник останавливаемого квиза
CtxQuestionID uint64 // айдишник вопроса CtxQuestionID int64 // айдишник вопроса
} }
type InfoQuestionDelete struct { type InfoQuestionDelete struct {
CtxUserID string //айдишник юзера из токена CtxUserID string //айдишник юзера из токена
CtxID uint64 //айдишник останавливаемого квиза CtxIDInt int64 //айдишник останавливаемого квиза
CtxQuestionID uint64 // айдишник вопроса CtxQuestionID int64 // айдишник вопроса
} }

@ -75,8 +75,8 @@ func (s *Service) CreateQuestion(ctx *fiber.Ctx) error {
hlogger.Emit(models.InfoQuestionCreate{ hlogger.Emit(models.InfoQuestionCreate{
CtxUserID: accountID, CtxUserID: accountID,
CtxID: req.QuizId, CtxIDInt: int64(req.QuizId),
CtxQuestionID: questionID, CtxQuestionID: int64(questionID),
}) })
return ctx.Status(fiber.StatusOK).JSON(result) return ctx.Status(fiber.StatusOK).JSON(result)
@ -312,8 +312,8 @@ func (s *Service) DeleteQuestion(ctx *fiber.Ctx) error {
hlogger.Emit(models.InfoQuestionDelete{ hlogger.Emit(models.InfoQuestionDelete{
CtxUserID: accountID, CtxUserID: accountID,
CtxID: deleted.QuizId, CtxIDInt: int64(deleted.QuizId),
CtxQuestionID: deleted.Id, CtxQuestionID: int64(deleted.Id),
}) })
return ctx.JSON(DeactivateResp{ return ctx.JSON(DeactivateResp{

@ -101,7 +101,7 @@ func (s *Service) CreateQuiz(ctx *fiber.Ctx) error {
hlogger.Emit(models.InfoQuizCreated{ hlogger.Emit(models.InfoQuizCreated{
CtxUserID: accountId, CtxUserID: accountId,
CtxID: quizID, CtxIDInt: int64(quizID),
}) })
return ctx.Status(fiber.StatusCreated).JSON(record) return ctx.Status(fiber.StatusCreated).JSON(record)
@ -314,13 +314,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,
CtxID: 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,
CtxID: quiz.Id, CtxIDInt: int64(quiz.Id),
}) })
} }
@ -428,7 +428,7 @@ func (s *Service) DeleteQuiz(ctx *fiber.Ctx) error {
hlogger.Emit(models.InfoQuizDelete{ hlogger.Emit(models.InfoQuizDelete{
CtxUserID: accountId, CtxUserID: accountId,
CtxID: req.Id, CtxIDInt: int64(req.Id),
}) })
return ctx.JSON(DeactivateResp{ return ctx.JSON(DeactivateResp{
@ -513,7 +513,7 @@ func (s *Service) TemplateCopy(ctx *fiber.Ctx) error {
// todo либо возвращать id копируемого квиза либо поле с qid // todo либо возвращать id копируемого квиза либо поле с qid
// для него потому что id получаем уже в запросе sql // для него потому что id получаем уже в запросе sql
//CtxID: req.Qid, //CtxID: req.Qid,
CtxQuizID: uint64(qizID), CtxQuizID: qizID,
}) })
return ctx.Status(fiber.StatusOK).JSON(fiber.Map{"id": qizID}) return ctx.Status(fiber.StatusOK).JSON(fiber.Map{"id": qizID})