all repos — weimar @ cf03eeda27ccb78fc82bbbb91a92e2b30bd2eb18

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	AvatarPath   *string   `json:"-"`
11	CreatedAt    time.Time `json:"created_at"`
12	UpdatedAt    time.Time `json:"updated_at"`
13}
14
15type Session struct {
16	ID        int64     `json:"id"`
17	UserID    int64     `json:"user_id"`
18	Token     string    `json:"token"`
19	ExpiresAt time.Time `json:"expires_at"`
20	CreatedAt time.Time `json:"created_at"`
21}
22
23type Image struct {
24	ID              int64      `json:"id"`
25	Filename        string     `json:"filename"`
26	StoragePath     string     `json:"storage_path"`
27	ThumbnailPath   *string    `json:"thumbnail_path"`
28	UploadedBy      int64      `json:"uploaded_by"`
29	UploaderUsername string    `json:"uploader_username"`
30	AvatarURL       string     `json:"avatar_url"`
31	FileSize        int64      `json:"file_size"`
32	Width           int        `json:"width"`
33	Height          int        `json:"height"`
34	MimeType        string     `json:"mime_type"`
35	CreatedAt       time.Time  `json:"created_at"`
36	UpdatedAt       time.Time  `json:"updated_at"`
37	Tags            []string   `json:"tags,omitempty"`
38}
39
40type Tag struct {
41	Tag        string `json:"tag"`
42	UsageCount int    `json:"usage_count"`
43}
44
45// ImageList is a paginated result of images.
46type ImageList struct {
47	Images []Image `json:"images"`
48	Total  int     `json:"total"`
49}