Finally Framework
This commit is contained in:
@@ -5,41 +5,51 @@ import (
|
||||
"time"
|
||||
)
|
||||
|
||||
// Might not even need this
|
||||
type ServerSetting struct {
|
||||
gorm.Model
|
||||
Name string `json:"name"`
|
||||
Description string `json:"description"`
|
||||
Value string `json:"value"`
|
||||
Name string `json:"name" gorm:"not null"`
|
||||
Description string `json:"description" gorm:"not null"`
|
||||
Value string `json:"value" gorm:"not null"`
|
||||
}
|
||||
|
||||
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?
|
||||
type User struct {
|
||||
gorm.Model
|
||||
Email string `json:"email" gorm:"unique;not null"`
|
||||
Username string `json:"username" gorm:"unique;not null"`
|
||||
Email string `json:"email" gorm:"unique"`
|
||||
Username string `json:"username" gorm:"unique"`
|
||||
FirstName string `json:"first_name"`
|
||||
LastName string `json:"last_name"`
|
||||
AuthType string `json:"auth_type"`
|
||||
Password string `json:"password"`
|
||||
AuthType string `json:"auth_type" gorm:"default:Local;not null"`
|
||||
Password string `json:"-"`
|
||||
JWTSecret string `json:"-" gorm:"unique;not null"` // TODO: Auto Generate UUID
|
||||
}
|
||||
|
||||
type MediaItem struct {
|
||||
gorm.Model
|
||||
User User `json:"user" gorm:"ForeignKey:ID"`
|
||||
User User `json:"user" gorm:"ForeignKey:ID;not null"`
|
||||
EXIFDate time.Time `json:"exif_date"`
|
||||
Latitude string `json:"latitude"`
|
||||
Longitude string `json:"longitude"`
|
||||
MediaType uint `json:"media_type"`
|
||||
RelPath string `json:"rel_path"`
|
||||
MediaType string `json:"media_type" gorm:"default:Photo;not null"` // Photo, Video
|
||||
RelPath string `json:"rel_path" gorm:"not null"`
|
||||
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"`
|
||||
Name string `json:"name" gorm:"not null"`
|
||||
}
|
||||
|
||||
type Album struct {
|
||||
gorm.Model
|
||||
Name string `json:"name"`
|
||||
Name string `json:"name" gorm:"not null"`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user