enlarge quiz name

This commit is contained in:
skeris 2024-04-20 12:45:24 +03:00
parent c073c8ea10
commit 2ad39be1be
3 changed files with 9 additions and 5 deletions

@ -0,0 +1,2 @@
ALTER TABLE quiz
ALTER COLUMN name TYPE VARCHAR(280);

@ -0,0 +1,2 @@
ALTER TABLE quiz
ALTER COLUMN name TYPE VARCHAR(1024);

@ -18,7 +18,7 @@ type CreateQuizReq struct {
MailNotifications bool `json:"mail_notifications"` // set true if you want get an email with every quiz passing
UniqueAnswers bool `json:"unique_answers"` // set true if we you mention only last quiz passing
Name string `json:"name"` // max 280 chars
Name string `json:"name"` // max 700 chars
Description string `json:"description"`
Config string `json:"config"` // serialize json with config for page rules. fill it up only if implement one form scenario
Status string `json:"status"` // status of quiz as enum. see Status const. fill it up only if implement one form scenario
@ -47,8 +47,8 @@ func (s *Service) CreateQuiz(ctx *fiber.Ctx) error {
}
// check that we can store name
if utf8.RuneCountInString(req.Name) >= 280 {
return ctx.Status(fiber.StatusUnprocessableEntity).SendString("name field should have less then 280 chars")
if utf8.RuneCountInString(req.Name) > 700 {
return ctx.Status(fiber.StatusUnprocessableEntity).SendString("name field should have less then 700 chars")
}
// status should be empty or equal one of status enum strings
@ -201,8 +201,8 @@ func (s *Service) UpdateQuiz(ctx *fiber.Ctx) error {
return ctx.Status(fiber.StatusFailedDependency).SendString("need id of question for update")
}
if utf8.RuneCountInString(req.Name) >= 280 {
return ctx.Status(fiber.StatusUnprocessableEntity).SendString("name field should have less then 280 chars")
if utf8.RuneCountInString(req.Name) > 700 {
return ctx.Status(fiber.StatusUnprocessableEntity).SendString("name field should have less then 700 chars")
}
// status should be empty or equal one of status enum strings