fix: session authentication middleware

This commit is contained in:
2025-06-09 12:56:59 +01:00
parent ea9c5f0902
commit 14ce860c37
12 changed files with 283 additions and 97 deletions
+6
View File
@@ -0,0 +1,6 @@
package types
type LoginRequestBody struct {
Username string `json:"username" validate:"required"`
Password string `json:"password" validate:"password"`
}
+1 -1
View File
@@ -7,7 +7,7 @@ import (
)
type Client struct {
ID uint32 `json:"id"`
ID uint32 `json:"id" gorm:"primaryKey"`
CreatedAt time.Time `json:"createAt"`
UpdatedAt time.Time `json:"updatedAt"`
DeletedAt gorm.DeletedAt `json:"deletedAt" gorm:"index"`
+4 -3
View File
@@ -7,7 +7,8 @@ import (
)
type User struct {
ID uint32 `json:"id"`
ID string `json:"id" gorm:"primaryKey"`
SessionID string `json:"-"`
CreatedAt time.Time `json:"createAt"`
UpdatedAt time.Time `json:"updatedAt"`
DeletedAt gorm.DeletedAt `json:"deletedAt" gorm:"index"`
@@ -19,8 +20,8 @@ type User struct {
Country string `json:"country"`
Phone string `json:"phone"`
Email string `json:"email"`
Username string `json:"username"`
Password string `json:"password"`
Username string `json:"username" gorm:"unique"`
Password string `json:"-"`
}
type CreateUserRequestBody struct {