mirror of
https://github.com/stashapp/stash.git
synced 2025-12-17 20:34:37 +03:00
Date precision (#6359)
* Remove month/year only formats from ParseDateStringAsTime * Add precision field to Date and handle parsing year/month-only dates * Add date precision columns for date columns * Adjust UI to account for fuzzy dates
This commit is contained in:
@@ -34,15 +34,16 @@ type imageRow struct {
|
||||
Title zero.String `db:"title"`
|
||||
Code zero.String `db:"code"`
|
||||
// expressed as 1-100
|
||||
Rating null.Int `db:"rating"`
|
||||
Date NullDate `db:"date"`
|
||||
Details zero.String `db:"details"`
|
||||
Photographer zero.String `db:"photographer"`
|
||||
Organized bool `db:"organized"`
|
||||
OCounter int `db:"o_counter"`
|
||||
StudioID null.Int `db:"studio_id,omitempty"`
|
||||
CreatedAt Timestamp `db:"created_at"`
|
||||
UpdatedAt Timestamp `db:"updated_at"`
|
||||
Rating null.Int `db:"rating"`
|
||||
Date NullDate `db:"date"`
|
||||
DatePrecision null.Int `db:"date_precision"`
|
||||
Details zero.String `db:"details"`
|
||||
Photographer zero.String `db:"photographer"`
|
||||
Organized bool `db:"organized"`
|
||||
OCounter int `db:"o_counter"`
|
||||
StudioID null.Int `db:"studio_id,omitempty"`
|
||||
CreatedAt Timestamp `db:"created_at"`
|
||||
UpdatedAt Timestamp `db:"updated_at"`
|
||||
}
|
||||
|
||||
func (r *imageRow) fromImage(i models.Image) {
|
||||
@@ -51,6 +52,7 @@ func (r *imageRow) fromImage(i models.Image) {
|
||||
r.Code = zero.StringFrom(i.Code)
|
||||
r.Rating = intFromPtr(i.Rating)
|
||||
r.Date = NullDateFromDatePtr(i.Date)
|
||||
r.DatePrecision = datePrecisionFromDatePtr(i.Date)
|
||||
r.Details = zero.StringFrom(i.Details)
|
||||
r.Photographer = zero.StringFrom(i.Photographer)
|
||||
r.Organized = i.Organized
|
||||
@@ -74,7 +76,7 @@ func (r *imageQueryRow) resolve() *models.Image {
|
||||
Title: r.Title.String,
|
||||
Code: r.Code.String,
|
||||
Rating: nullIntPtr(r.Rating),
|
||||
Date: r.Date.DatePtr(),
|
||||
Date: r.Date.DatePtr(r.DatePrecision),
|
||||
Details: r.Details.String,
|
||||
Photographer: r.Photographer.String,
|
||||
Organized: r.Organized,
|
||||
@@ -103,7 +105,7 @@ func (r *imageRowRecord) fromPartial(i models.ImagePartial) {
|
||||
r.setNullString("title", i.Title)
|
||||
r.setNullString("code", i.Code)
|
||||
r.setNullInt("rating", i.Rating)
|
||||
r.setNullDate("date", i.Date)
|
||||
r.setNullDate("date", "date_precision", i.Date)
|
||||
r.setNullString("details", i.Details)
|
||||
r.setNullString("photographer", i.Photographer)
|
||||
r.setBool("organized", i.Organized)
|
||||
|
||||
Reference in New Issue
Block a user