🐛 Fix validation conditions
This commit is contained in:
parent
fba515fc70
commit
5af3e280b9
@ -20,7 +20,7 @@ func createArticle(c *fiber.Ctx) error {
|
|||||||
|
|
||||||
var data struct {
|
var data struct {
|
||||||
Title string `json:"title" validate:"required,max=1024"`
|
Title string `json:"title" validate:"required,max=1024"`
|
||||||
Description *string `json:"description" validate:"max=2048"`
|
Description *string `json:"description"`
|
||||||
Content string `json:"content" validate:"required"`
|
Content string `json:"content" validate:"required"`
|
||||||
Attachments []uint `json:"attachments"`
|
Attachments []uint `json:"attachments"`
|
||||||
Tags []models.Tag `json:"tags"`
|
Tags []models.Tag `json:"tags"`
|
||||||
@ -85,7 +85,7 @@ func editArticle(c *fiber.Ctx) error {
|
|||||||
|
|
||||||
var data struct {
|
var data struct {
|
||||||
Title string `json:"title" validate:"required,max=1024"`
|
Title string `json:"title" validate:"required,max=1024"`
|
||||||
Description *string `json:"description" validate:"max=2048"`
|
Description *string `json:"description"`
|
||||||
Content string `json:"content" validate:"required"`
|
Content string `json:"content" validate:"required"`
|
||||||
Attachments []uint `json:"attachments"`
|
Attachments []uint `json:"attachments"`
|
||||||
Tags []models.Tag `json:"tags"`
|
Tags []models.Tag `json:"tags"`
|
||||||
|
@ -24,7 +24,7 @@ func MapAPIs(app *fiber.App, baseURL string) {
|
|||||||
articles := api.Group("/articles").Name("Article API")
|
articles := api.Group("/articles").Name("Article API")
|
||||||
{
|
{
|
||||||
articles.Post("/", createArticle)
|
articles.Post("/", createArticle)
|
||||||
articles.Put("/:articleId", editArticle)
|
articles.Put("/:postId", editArticle)
|
||||||
}
|
}
|
||||||
|
|
||||||
posts := api.Group("/posts").Name("Posts API")
|
posts := api.Group("/posts").Name("Posts API")
|
||||||
|
@ -19,9 +19,9 @@ func createStory(c *fiber.Ctx) error {
|
|||||||
user := c.Locals("user").(models.Account)
|
user := c.Locals("user").(models.Account)
|
||||||
|
|
||||||
var data struct {
|
var data struct {
|
||||||
Title *string `json:"title" validate:"max=1024"`
|
Title *string `json:"title"`
|
||||||
Content string `json:"content" validate:"required,max=4096"`
|
Content string `json:"content" validate:"required,max=4096"`
|
||||||
Location *string `json:"location" validate:"max=2048"`
|
Location *string `json:"location"`
|
||||||
Attachments []uint `json:"attachments"`
|
Attachments []uint `json:"attachments"`
|
||||||
Tags []models.Tag `json:"tags"`
|
Tags []models.Tag `json:"tags"`
|
||||||
Categories []models.Category `json:"categories"`
|
Categories []models.Category `json:"categories"`
|
||||||
@ -103,9 +103,9 @@ func editStory(c *fiber.Ctx) error {
|
|||||||
user := c.Locals("user").(models.Account)
|
user := c.Locals("user").(models.Account)
|
||||||
|
|
||||||
var data struct {
|
var data struct {
|
||||||
Title *string `json:"title" validate:"max=1024"`
|
Title *string `json:"title"`
|
||||||
Content string `json:"content" validate:"required,max=4096"`
|
Content string `json:"content" validate:"required,max=4096"`
|
||||||
Location *string `json:"location" validate:"max=2048"`
|
Location *string `json:"location"`
|
||||||
Attachments []uint `json:"attachments"`
|
Attachments []uint `json:"attachments"`
|
||||||
Tags []models.Tag `json:"tags"`
|
Tags []models.Tag `json:"tags"`
|
||||||
Categories []models.Category `json:"categories"`
|
Categories []models.Category `json:"categories"`
|
||||||
|
Loading…
Reference in New Issue
Block a user