Refactor api code: split between packages
This commit is contained in:
6
internal/dto/bookpostcreate.go
Normal file
6
internal/dto/bookpostcreate.go
Normal file
@@ -0,0 +1,6 @@
|
||||
package dto
|
||||
|
||||
type BookPostCreate struct {
|
||||
Title string `json:"title" binding:"required,max=300"`
|
||||
Author string `json:"author" binding:"max=100"`
|
||||
}
|
||||
6
internal/dto/booksearchget.go
Normal file
6
internal/dto/booksearchget.go
Normal file
@@ -0,0 +1,6 @@
|
||||
package dto
|
||||
|
||||
type BookSearchGet struct {
|
||||
Title string `json:"title" binding:"required,max=300"`
|
||||
Author string `json:"author" binding:"max=100"`
|
||||
}
|
||||
7
internal/dto/bookuserget.go
Normal file
7
internal/dto/bookuserget.go
Normal file
@@ -0,0 +1,7 @@
|
||||
package dto
|
||||
|
||||
type BookUserGet struct {
|
||||
Title string `json:"title" binding:"required,max=300"`
|
||||
Author string `json:"author" binding:"max=100"`
|
||||
Rating int `json:"rating" binding:"min=0,max=10"`
|
||||
}
|
||||
6
internal/dto/userlogin.go
Normal file
6
internal/dto/userlogin.go
Normal file
@@ -0,0 +1,6 @@
|
||||
package dto
|
||||
|
||||
type UserLogin struct {
|
||||
Username string `json:"username" binding:"required,min=2,max=20"`
|
||||
Password string `json:"password" binding:"required,min=6,max=100"`
|
||||
}
|
||||
6
internal/dto/usersignup.go
Normal file
6
internal/dto/usersignup.go
Normal file
@@ -0,0 +1,6 @@
|
||||
package dto
|
||||
|
||||
type UserSignup struct {
|
||||
Username string `json:"username" binding:"required,min=2,max=20"`
|
||||
Password string `json:"password" binding:"required,min=6,max=100"`
|
||||
}
|
||||
Reference in New Issue
Block a user