added omitempty for settings firld in resp
This commit is contained in:
parent
2e7d9fb5ee
commit
17fdefdd83
@ -79,7 +79,7 @@ type GetQuizDataReq struct {
|
||||
|
||||
// GetQuizDataResp response with prepared data for user
|
||||
type GetQuizDataResp struct {
|
||||
Settings ShavedQuiz `json:"settings"`
|
||||
Settings *ShavedQuiz `json:"settings,omitempty"`
|
||||
Items []ShavedQuestion `json:"items"`
|
||||
Count uint64 `json:"cnt"`
|
||||
ShowBadge bool `json:"show_badge"`
|
||||
@ -136,8 +136,9 @@ func (s *Service) GetQuizData(c *fiber.Ctx) error {
|
||||
}
|
||||
|
||||
if req.Limit == 0 && req.NeedConfig {
|
||||
quizDto := dao2dtoQuiz(quiz)
|
||||
return c.Status(fiber.StatusOK).JSON(GetQuizDataResp{
|
||||
Settings: dao2dtoQuiz(quiz),
|
||||
Settings: &quizDto,
|
||||
})
|
||||
}
|
||||
|
||||
@ -199,7 +200,8 @@ func (s *Service) GetQuizData(c *fiber.Ctx) error {
|
||||
}
|
||||
|
||||
if req.NeedConfig {
|
||||
result.Settings = dao2dtoQuiz(quiz)
|
||||
quizDto := dao2dtoQuiz(quiz)
|
||||
result.Settings = &quizDto
|
||||
}
|
||||
|
||||
for _, q := range questions {
|
||||
|
Loading…
Reference in New Issue
Block a user