Fix scene marker issues (#3955)

* Fix scene marker NOT NULL constraint error
* similar changes to gallery chapters
* Fix NULL conversion error if names are NULL in DB
* Fix scene marker form resetting
This commit is contained in:
DingDongSoLong4
2023-07-28 03:22:43 +02:00
committed by GitHub
parent 7b77b8986f
commit 95a78de3aa
9 changed files with 84 additions and 75 deletions

View File

@@ -25,7 +25,7 @@ GROUP BY scene_markers.id
type sceneMarkerRow struct {
ID int `db:"id" goqu:"skipinsert"`
Title string `db:"title"`
Title string `db:"title"` // TODO: make db schema (and gql schema) nullable
Seconds float64 `db:"seconds"`
PrimaryTagID int `db:"primary_tag_id"`
SceneID int `db:"scene_id"`
@@ -62,7 +62,12 @@ type sceneMarkerRowRecord struct {
}
func (r *sceneMarkerRowRecord) fromPartial(o models.SceneMarkerPartial) {
r.setNullString("title", o.Title)
// TODO: replace with setNullString after schema is made nullable
// r.setNullString("title", o.Title)
// saves a null input as the empty string
if o.Title.Set {
r.set("title", o.Title.Value)
}
r.setFloat64("seconds", o.Seconds)
r.setInt("primary_tag_id", o.PrimaryTagID)
r.setInt("scene_id", o.SceneID)