SQLite model refactoring (#3791)

* Remove ID from PerformerPartial
* Separate studio model from sqlite model
* Separate movie model from sqlite model
* Separate tag model from sqlite model
* Separate saved filter model from sqlite model
* Separate scene marker model from sqlite model
* Separate gallery chapter model from sqlite model
* Move ErrNoRows checks into sqlite, improve empty result error messages
* Move SQLiteDate and SQLiteTimestamp to sqlite
* Use changesetTranslator everywhere, refactor for consistency
* Make PerformerStore.DestroyImage private
* Fix rating on movie create
This commit is contained in:
DingDongSoLong4
2023-06-15 04:46:09 +02:00
committed by GitHub
parent 9180a68c45
commit 1c13c9e1b1
150 changed files with 3279 additions and 3129 deletions

View File

@@ -27,7 +27,7 @@ const (
errParentStudioID = 12
)
const (
var (
studioName = "testStudio"
url = "url"
details = "details"
@@ -37,7 +37,7 @@ const (
)
var parentStudio models.Studio = models.Studio{
Name: models.NullString(parentStudioName),
Name: parentStudioName,
}
var imageBytes = []byte("imageBytes")
@@ -59,22 +59,18 @@ var (
func createFullStudio(id int, parentID int) models.Studio {
ret := models.Studio{
ID: id,
Name: models.NullString(studioName),
URL: models.NullString(url),
Details: models.NullString(details),
CreatedAt: models.SQLiteTimestamp{
Timestamp: createTime,
},
UpdatedAt: models.SQLiteTimestamp{
Timestamp: updateTime,
},
Rating: models.NullInt64(rating),
ID: id,
Name: studioName,
URL: url,
Details: details,
CreatedAt: createTime,
UpdatedAt: updateTime,
Rating: &rating,
IgnoreAutoTag: autoTagIgnored,
}
if parentID != 0 {
ret.ParentID = models.NullInt64(int64(parentID))
ret.ParentID = &parentID
}
return ret
@@ -82,13 +78,9 @@ func createFullStudio(id int, parentID int) models.Studio {
func createEmptyStudio(id int) models.Studio {
return models.Studio{
ID: id,
CreatedAt: models.SQLiteTimestamp{
Timestamp: createTime,
},
UpdatedAt: models.SQLiteTimestamp{
Timestamp: updateTime,
},
ID: id,
CreatedAt: createTime,
UpdatedAt: updateTime,
}
}