chore: trailing slash and associate clients with user

This commit is contained in:
2025-06-09 17:55:51 +01:00
parent 9bc18666ad
commit 4935a65112
9 changed files with 157 additions and 73 deletions
+2 -1
View File
@@ -7,7 +7,8 @@ import (
)
type Client struct {
ID uint32 `json:"id" gorm:"primaryKey"`
ID string `json:"id" gorm:"primaryKey"`
UserID string `json:"userId"`
CreatedAt time.Time `json:"createAt"`
UpdatedAt time.Time `json:"updatedAt"`
DeletedAt gorm.DeletedAt `json:"deletedAt" gorm:"index"`
+3 -2
View File
@@ -22,6 +22,7 @@ type User struct {
Email string `json:"email"`
Username string `json:"username" gorm:"unique"`
Password string `json:"-"`
Clients []Client `json:"clients" gorm:"constraint:OnUpdate:CASCADE,onDelete:CASCADE"`
}
type CreateUserRequestBody struct {
@@ -42,10 +43,10 @@ type UpdateUserRequestBody struct {
Country string `json:"country" validate:"omitempty,alpha"`
Phone string `json:"phone" validate:"omitempty,e164"`
Email string `json:"email" validate:"omitempty,email"`
Username string `json:"username"`
}
type UpdateUserSecurityDetailsBody struct {
Username string `json:"username"`
type UpdateUserSecurityCredentialsBody struct {
Password string `json:"password" validate:"password"`
ConfirmPassword string `json:"confirmPassword" validate:"password,eqcsfield=Password"`
}