stash/pkg/models/model_movie.go
DingDongSoLong4 33f2ebf2a3
Model refactor, part 3 (#4152)
* Remove manager.Repository
* Refactor other repositories
* Fix tests and add database mock
* Add AssertExpectations method
* Refactor routes
* Move default movie image to internal/static and add convenience methods
* Refactor default performer image boxes
2023-10-16 14:26:34 +11:00

51 lines
1.1 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),
}
}