add users

This commit is contained in:
u80864958
2025-04-30 16:41:30 +02:00
parent f4adfb6a62
commit eed1718a7e
17 changed files with 538 additions and 60 deletions

View File

@ -1,9 +1,34 @@
package model
type Login struct {
Name string `json:"name"`
Password string `json:"Password"`
import (
"time"
"github.com/google/uuid"
)
type Role string
const (
RoleAdmin Role = " admin"
RoleUser Role = "user"
RoleGuest Role = "guest"
)
type InvalidJWT struct {
JWT string `gorm:"primarykey"`
ValidUntil time.Time
}
type LoginResponse struct {
Token string `json:"token"`
type User struct {
ID uint `gorm:"primarykey" json:"-"`
UUID uuid.UUID `gorm:"type:uuid" json:"uuid"`
Name string `json:"name" gorm:"unique"`
Role Role `json:"role"`
Password []byte `json:"-"`
}
func NewUser() User {
return User{
UUID: uuid.New(),
}
}