I can use the isdefault validator to make sure that a form field doesn't set a data field, but that may not be the best way.
This commit is contained in:
parent
de24d64f44
commit
77e4c3fa5b
2 changed files with 8 additions and 9 deletions
|
|
@ -40,4 +40,3 @@ func ReceivePost[T any](c *fiber.Ctx) (*T, error) {
|
||||||
|
|
||||||
return result, nil
|
return result, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,21 +1,21 @@
|
||||||
package data
|
package data
|
||||||
|
|
||||||
type Login struct {
|
type Login struct {
|
||||||
Username string `db:"username" validate:"required"`
|
Username string `db:"username" validate:"required,max=30"`
|
||||||
Password string `db:"password" validate:"required"`
|
Password string `db:"password" validate:"required,max=128"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type User struct {
|
type User struct {
|
||||||
Username string `db:"username" validate:"required"`
|
Username string `db:"username" validate:"required,max=30"`
|
||||||
Email string `db:"email" validate:"required,email"`
|
Email string `db:"email" validate:"required,email,max=128"`
|
||||||
Password string `db:"password" validate:"required"`
|
Password string `db:"password" validate:"required,min=8,max=64"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type Link struct {
|
type Link struct {
|
||||||
Id int `db:"id" json:"id"`
|
Id int `db:"id" json:"id" validate:"isdefault"`
|
||||||
StreamId int `db:"stream_id" json:"stream_id" form:"stream_id" validate:"required,numeric"`
|
StreamId int `db:"stream_id" json:"stream_id" form:"stream_id" validate:"required,numeric"`
|
||||||
Url string `db:"url" json:"url" form:"url" validate:"required,http_url"`
|
Url string `db:"url" json:"url" form:"url" validate:"required,http_url,max=150"`
|
||||||
Description string `db:"description" json:"description" form:"description" validate:"required"`
|
Description string `db:"description" json:"description" form:"description" validate:"required,max=300"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type Stream struct {
|
type Stream struct {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue