stash/pkg/models/model_movie.go
DingDongSoLong4 24e4719abc
Model refactor, part 2 (#4092)
* Move conversions into changesetTranslator
* Improve mutation error messages
* Use models.New and models.NewPartial everywhere
* Replace getStashIDsFor functions
* Remove ImageCreateInput
* Remove unused parameters
* Refactor matching functions
---------
Co-authored-by: WithoutPants <53250216+WithoutPants@users.noreply.github.com>
2023-09-11 12:24:15 +10:00

53 lines
1.7 KiB
Go

package models
import (
"time"
)
type Movie struct {
ID int `json:"id"`
Name string `json:"name"`
Aliases string `json:"aliases"`
Duration *int `json:"duration"`
Date *Date `json:"date"`
// Rating expressed in 1-100 scale
Rating *int `json:"rating"`
StudioID *int `json:"studio_id"`
Director string `json:"director"`
Synopsis string `json:"synopsis"`
URL string `json:"url"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
func NewMovie() Movie {
currentTime := time.Now()
return Movie{
CreatedAt: currentTime,
UpdatedAt: currentTime,
}
}
type MoviePartial struct {
Name OptionalString
Aliases OptionalString
Duration OptionalInt
Date OptionalDate
// Rating expressed in 1-100 scale
Rating OptionalInt
StudioID OptionalInt
Director OptionalString
Synopsis OptionalString
URL OptionalString
CreatedAt OptionalTime
UpdatedAt OptionalTime
}
func NewMoviePartial() MoviePartial {
currentTime := time.Now()
return MoviePartial{
UpdatedAt: NewOptionalTime(currentTime),
}
}
var DefaultMovieImage = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAABkCAYAAABw4pVUAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAA3XAAAN1wFCKJt4AAAAB3RJTUUH4wgVBQsJl1CMZAAAASJJREFUeNrt3N0JwyAYhlEj3cj9R3Cm5rbkqtAP+qrnGaCYHPwJpLlaa++mmLpbAERAgAgIEAEBIiBABERAgAgIEAEBIiBABERAgAgIEAHZuVflj40x4i94zhk9vqsVvEq6AsQqMP1EjORx20OACAgQRRx7T+zzcFBxcjNDfoB4ntQqTm5Awo7MlqywZxcgYQ+RlqywJ3ozJAQCSBiEJSsQA0gYBpDAgAARECACAkRAgAgIEAERECACAmSjUv6eAOSB8m8YIGGzBUjYbAESBgMkbBkDEjZbgITBAClcxiqQvEoatreYIWEBASIgJ4Gkf11ntXH3nS9uxfGWfJ5J9hAgAgJEQAQEiIAAERAgAgJEQAQEiIAAERAgAgJEQAQEiL7qBuc6RKLHxr0CAAAAAElFTkSuQmCC"