stash/pkg/models/model_gallery_chapter.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

39 lines
898 B
Go

package models
import (
"time"
)
type GalleryChapter struct {
ID int `json:"id"`
Title string `json:"title"`
ImageIndex int `json:"image_index"`
GalleryID int `json:"gallery_id"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
func NewGalleryChapter() GalleryChapter {
currentTime := time.Now()
return GalleryChapter{
CreatedAt: currentTime,
UpdatedAt: currentTime,
}
}
// GalleryChapterPartial represents part of a GalleryChapter object.
// It is used to update the database entry.
type GalleryChapterPartial struct {
Title OptionalString
ImageIndex OptionalInt
GalleryID OptionalInt
CreatedAt OptionalTime
UpdatedAt OptionalTime
}
func NewGalleryChapterPartial() GalleryChapterPartial {
currentTime := time.Now()
return GalleryChapterPartial{
UpdatedAt: NewOptionalTime(currentTime),
}
}