all repos — weimar @ a8921d226b7ab5b6d366d88c51d3308362388cf7

Unnamed repository; edit this file 'description' to name the repository.

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	FileSize      int64      `json:"file_size"`
29	Width         int        `json:"width"`
30	Height        int        `json:"height"`
31	MimeType      string     `json:"mime_type"`
32	CreatedAt     time.Time  `json:"created_at"`
33	UpdatedAt     time.Time  `json:"updated_at"`
34	Tags          []string   `json:"tags,omitempty"`
35}
36
37type Tag struct {
38	Tag        string `json:"tag"`
39	UsageCount int    `json:"usage_count"`
40}
41
42// ImageList is a paginated result of images.
43type ImageList struct {
44	Images []Image `json:"images"`
45	Total  int     `json:"total"`
46}