feat: Added basic user authorization

This commit is contained in:
2025-08-20 01:24:49 +03:00
parent b72066f19e
commit fb4902dea6
15 changed files with 396 additions and 2 deletions

25
model/user.go Normal file
View File

@@ -0,0 +1,25 @@
package model
import (
"time"
"gorm.io/gorm"
)
type User struct {
ID uint64 `json:"id"`
Login string `json:"login"`
Password string `json:"-"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
}
func (*User) TableName() string {
return "users"
}
func (u *User) BeforeUpdate(*gorm.DB) error {
u.UpdatedAt = time.Now()
return nil
}