2021-01-12 04:48:32 +00:00
|
|
|
package models
|
|
|
|
|
|
|
|
import (
|
|
|
|
"gorm.io/gorm"
|
|
|
|
"time"
|
|
|
|
)
|
|
|
|
|
2021-01-16 22:00:17 +00:00
|
|
|
// Might not even need this
|
2021-01-12 04:48:32 +00:00
|
|
|
type ServerSetting struct {
|
|
|
|
gorm.Model
|
2021-01-16 22:00:17 +00:00
|
|
|
Name string `json:"name" gorm:"not null"`
|
|
|
|
Description string `json:"description" gorm:"not null"`
|
|
|
|
Value string `json:"value" gorm:"not null"`
|
2021-01-12 04:48:32 +00:00
|
|
|
}
|
|
|
|
|
2021-01-16 22:00:17 +00:00
|
|
|
type Device struct {
|
|
|
|
gorm.Model
|
|
|
|
User User `json:"user" gorm:"ForeignKey:ID"`
|
|
|
|
DeviceName string `json:"name"`
|
|
|
|
Type string `json:"type"` // Android, iOS, Chrome, FireFox, Edge, etc
|
|
|
|
}
|
|
|
|
|
|
|
|
// TODO: ID -> UUID?
|
2021-01-12 04:48:32 +00:00
|
|
|
type User struct {
|
|
|
|
gorm.Model
|
2021-01-16 22:00:17 +00:00
|
|
|
Email string `json:"email" gorm:"unique"`
|
|
|
|
Username string `json:"username" gorm:"unique"`
|
2021-01-12 04:48:32 +00:00
|
|
|
FirstName string `json:"first_name"`
|
|
|
|
LastName string `json:"last_name"`
|
2021-01-16 22:00:17 +00:00
|
|
|
AuthType string `json:"auth_type" gorm:"default:Local;not null"`
|
|
|
|
Password string `json:"-"`
|
|
|
|
JWTSecret string `json:"-" gorm:"unique;not null"` // TODO: Auto Generate UUID
|
2021-01-12 04:48:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
type MediaItem struct {
|
|
|
|
gorm.Model
|
2021-01-16 22:00:17 +00:00
|
|
|
User User `json:"user" gorm:"ForeignKey:ID;not null"`
|
2021-01-12 04:48:32 +00:00
|
|
|
EXIFDate time.Time `json:"exif_date"`
|
|
|
|
Latitude string `json:"latitude"`
|
|
|
|
Longitude string `json:"longitude"`
|
2021-01-16 22:00:17 +00:00
|
|
|
MediaType string `json:"media_type" gorm:"default:Photo;not null"` // Photo, Video
|
|
|
|
RelPath string `json:"rel_path" gorm:"not null"`
|
2021-01-12 04:48:32 +00:00
|
|
|
Tags []Tag `json:"tags" gorm:"many2many:media_tags;"`
|
|
|
|
Albums []Album `json:"albums" gorm:"many2many:media_albums;"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type Tag struct {
|
|
|
|
gorm.Model
|
2021-01-16 22:00:17 +00:00
|
|
|
Name string `json:"name" gorm:"not null"`
|
2021-01-12 04:48:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
type Album struct {
|
|
|
|
gorm.Model
|
2021-01-16 22:00:17 +00:00
|
|
|
Name string `json:"name" gorm:"not null"`
|
2021-01-12 04:48:32 +00:00
|
|
|
}
|