mirror of https://github.com/gabehf/Koito.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
667 B
38 lines
667 B
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
|
|
}
|