internal/db/models.go (view raw)
1package db
2
3import "time"
4
5type User struct {
6 ID int64 `json:"id"`
7 Username string `json:"username"`
8 PasswordHash string `json:"-"`
9 IsAdmin bool `json:"is_admin"`
10 CreatedAt time.Time `json:"created_at"`
11 UpdatedAt time.Time `json:"updated_at"`
12}
13
14type Session struct {
15 ID int64 `json:"id"`
16 UserID int64 `json:"user_id"`
17 Token string `json:"token"`
18 ExpiresAt time.Time `json:"expires_at"`
19 CreatedAt time.Time `json:"created_at"`
20}
21
22type Image struct {
23 ID int64 `json:"id"`
24 Filename string `json:"filename"`
25 StoragePath string `json:"storage_path"`
26 ThumbnailPath *string `json:"thumbnail_path"`
27 UploadedBy int64 `json:"uploaded_by"`
28 UploaderUsername string `json:"uploader_username"`
29 FileSize int64 `json:"file_size"`
30 Width int `json:"width"`
31 Height int `json:"height"`
32 MimeType string `json:"mime_type"`
33 CreatedAt time.Time `json:"created_at"`
34 UpdatedAt time.Time `json:"updated_at"`
35 Tags []string `json:"tags,omitempty"`
36}
37
38type Tag struct {
39 Tag string `json:"tag"`
40 UsageCount int `json:"usage_count"`
41}
42
43// ImageList is a paginated result of images.
44type ImageList struct {
45 Images []Image `json:"images"`
46 Total int `json:"total"`
47}