feat: Added basic user authorization
This commit is contained in:
25
model/user.go
Normal file
25
model/user.go
Normal 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
|
||||
}
|
||||
Reference in New Issue
Block a user