mirror of
https://github.com/gabehf/Koito.git
synced 2026-03-14 18:05:55 -07:00
chore: initial public commit
This commit is contained in:
commit
fc9054b78c
250 changed files with 32809 additions and 0 deletions
37
internal/models/user.go
Normal file
37
internal/models/user.go
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
package models
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/google/uuid"
|
||||
)
|
||||
|
||||
type UserRole string
|
||||
|
||||
const (
|
||||
UserRoleUser UserRole = "user"
|
||||
UserRoleAdmin UserRole = "admin"
|
||||
)
|
||||
|
||||
type User struct {
|
||||
ID int32 `json:"id"`
|
||||
Username string `json:"username"`
|
||||
Role UserRole `json:"role"` // 'admin' | 'user'
|
||||
Password []byte `json:"-"`
|
||||
}
|
||||
|
||||
type ApiKey struct {
|
||||
ID int32 `json:"id"`
|
||||
Key string `json:"key"`
|
||||
Label string `json:"label"`
|
||||
UserID int32 `json:"user_id"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
}
|
||||
|
||||
type Session struct {
|
||||
ID uuid.UUID
|
||||
UserID int32
|
||||
CreatedAt time.Time
|
||||
ExpiresAt time.Time
|
||||
Persistent bool
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue