This repository has been archived on 2023-11-13. You can view files and clone it, but cannot push or open issues or pull requests.
imagini/internal/models/db.go

46 lines
1.2 KiB
Go
Raw Normal View History

2021-01-12 04:48:32 +00:00
package models
import (
"gorm.io/gorm"
"time"
)
type ServerSetting struct {
gorm.Model
Name string `json:"name"`
Description string `json:"description"`
Value string `json:"value"`
}
type User struct {
gorm.Model
Email string `json:"email" gorm:"unique;not null"`
Username string `json:"username" gorm:"unique;not null"`
FirstName string `json:"first_name"`
LastName string `json:"last_name"`
AuthType string `json:"auth_type"`
2021-01-12 22:06:27 +00:00
Password string `json:"password"`
2021-01-12 04:48:32 +00:00
}
type MediaItem struct {
gorm.Model
User User `json:"user" gorm:"ForeignKey:ID"`
EXIFDate time.Time `json:"exif_date"`
Latitude string `json:"latitude"`
Longitude string `json:"longitude"`
MediaType uint `json:"media_type"`
RelPath string `json:"rel_path"`
Tags []Tag `json:"tags" gorm:"many2many:media_tags;"`
Albums []Album `json:"albums" gorm:"many2many:media_albums;"`
}
type Tag struct {
gorm.Model
Name string `json:"name"`
}
type Album struct {
gorm.Model
Name string `json:"name"`
}