Refactor api code: split between packages

This commit is contained in:
2025-10-15 22:52:43 +02:00
parent ae790b4b39
commit 7dcca84b7d
20 changed files with 284 additions and 214 deletions

View 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"`
}

View 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"`
}

View 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"`
}

View 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"`
}

View 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"`
}