package models import ( "encoding/json" "time" "github.com/jackc/pgx/v5/pgtype" ) type User struct { Name string `json:"name"` IsAdmin bool `json:"is_admin"` } type MIME struct { Name string `json:"name"` Extension string `json:"extension"` } type ( CategoryCore struct { ID string `json:"id"` Name string `json:"name"` Color pgtype.Text `json:"color"` } CategoryItem struct { CategoryCore } CategoryFull struct { CategoryCore CreatedAt time.Time `json:"created_at"` Creator User `json:"creator"` Notes pgtype.Text `json:"notes"` } ) type ( FileCore struct { ID string `json:"id"` Name pgtype.Text `json:"name"` MIME MIME `json:"mime"` } FileItem struct { FileCore CreatedAt time.Time `json:"created_at"` Creator User `json:"creator"` } FileFull struct { FileCore CreatedAt time.Time `json:"created_at"` Creator User `json:"creator"` Notes pgtype.Text `json:"notes"` Metadata *json.RawMessage `json:"metadata"` } ) type ( TagCore struct { ID string `json:"id"` Name string `json:"name"` Color pgtype.Text `json:"color"` } TagItem struct { TagCore Category CategoryCore `json:"category"` } TagFull struct { TagCore Category CategoryCore `json:"category"` CreatedAt time.Time `json:"created_at"` Creator User `json:"creator"` Notes pgtype.Text `json:"notes"` } ) type Autotag struct { TriggerTag TagCore `json:"trigger_tag"` AddTag TagCore `json:"add_tag"` IsActive bool `json:"is_active"` } type ( PoolCore struct { ID string `json:"id"` Name string `json:"name"` } PoolItem struct { PoolCore } PoolFull struct { PoolCore CreatedAt time.Time `json:"created_at"` Creator User `json:"creator"` Notes pgtype.Text `json:"notes"` } ) type Session struct { ID int `json:"id"` UserAgent string `json:"user_agent"` StartedAt time.Time `json:"started_at"` ExpiresAt time.Time `json:"expires_at"` LastActivity time.Time `json:"last_activity"` } type Pagination struct { Total int `json:"total"` Offset int `json:"offset"` Limit int `json:"limit"` Count int `json:"count"` } type Slice[T any] struct { Pagination Pagination `json:"pagination"` Data []T `json:"data"` }