diff --git a/schema/000009_init.down.sql b/schema/000009_init.down.sql new file mode 100644 index 0000000..342ea06 --- /dev/null +++ b/schema/000009_init.down.sql @@ -0,0 +1,2 @@ +ALTER TABLE quiz +ALTER COLUMN name TYPE VARCHAR(280); diff --git a/schema/000009_init.up.sql b/schema/000009_init.up.sql new file mode 100644 index 0000000..0c3038e --- /dev/null +++ b/schema/000009_init.up.sql @@ -0,0 +1,2 @@ +ALTER TABLE quiz +ALTER COLUMN name TYPE VARCHAR(1024); diff --git a/service/quiz_svc.go b/service/quiz_svc.go index 4ea228a..3271f45 100644 --- a/service/quiz_svc.go +++ b/service/quiz_svc.go @@ -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