serve frontend from go

This commit is contained in:
u80864958
2025-05-05 10:00:50 +02:00
parent a06444c4df
commit 73a62b63ae
88 changed files with 76 additions and 36 deletions

37
internal/model/auth.go Normal file
View File

@ -0,0 +1,37 @@
package model
import (
"time"
"github.com/google/uuid"
)
type Role string
const (
RoleAdmin Role = " admin"
RoleUser Role = "user"
RoleGuest Role = "guest"
)
// InvalidJWT Represents a JWT that has expired or is otherwise invalid.
type InvalidJWT struct {
JWT string `gorm:"primarykey"`
ValidUntil time.Time
}
// User represents a user with an ID, UUID, name, role, and password.
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:"-"`
}
// NewUser creates a new User struct with a generated UUID.
func NewUser() User {
return User{
UUID: uuid.New(),
}
}