mirror of
https://github.com/stashapp/stash.git
synced 2025-12-18 04:44:37 +03:00
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:
@@ -29,7 +29,6 @@ import (
|
||||
"github.com/stashapp/stash/pkg/sliceutil/stringslice"
|
||||
"github.com/stashapp/stash/pkg/studio"
|
||||
"github.com/stashapp/stash/pkg/tag"
|
||||
"github.com/stashapp/stash/pkg/utils"
|
||||
)
|
||||
|
||||
type ExportTask struct {
|
||||
@@ -1107,8 +1106,8 @@ func (t *ExportTask) exportMovie(ctx context.Context, wg *sync.WaitGroup, jobCha
|
||||
}
|
||||
|
||||
if t.includeDependencies {
|
||||
if m.StudioID.Valid {
|
||||
t.studios.IDs = intslice.IntAppendUnique(t.studios.IDs, int(m.StudioID.Int64))
|
||||
if m.StudioID != nil {
|
||||
t.studios.IDs = intslice.IntAppendUnique(t.studios.IDs, *m.StudioID)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1140,7 +1139,7 @@ func (t *ExportTask) ExportScrapedItems(ctx context.Context, repo Repository) {
|
||||
if scrapedItem.StudioID.Valid {
|
||||
studio, _ := sqb.Find(ctx, int(scrapedItem.StudioID.Int64))
|
||||
if studio != nil {
|
||||
studioName = studio.Name.String
|
||||
studioName = studio.Name
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1155,8 +1154,8 @@ func (t *ExportTask) ExportScrapedItems(ctx context.Context, repo Repository) {
|
||||
if scrapedItem.URL.Valid {
|
||||
newScrapedItemJSON.URL = scrapedItem.URL.String
|
||||
}
|
||||
if scrapedItem.Date.Valid {
|
||||
newScrapedItemJSON.Date = utils.GetYMDFromDatabaseDate(scrapedItem.Date.String)
|
||||
if scrapedItem.Date != nil {
|
||||
newScrapedItemJSON.Date = scrapedItem.Date.String()
|
||||
}
|
||||
if scrapedItem.Rating.Valid {
|
||||
newScrapedItemJSON.Rating = scrapedItem.Rating.String
|
||||
@@ -1184,7 +1183,7 @@ func (t *ExportTask) ExportScrapedItems(ctx context.Context, repo Repository) {
|
||||
}
|
||||
|
||||
newScrapedItemJSON.Studio = studioName
|
||||
updatedAt := json.JSONTime{Time: scrapedItem.UpdatedAt.Timestamp} // TODO keeping ruby format
|
||||
updatedAt := json.JSONTime{Time: scrapedItem.UpdatedAt} // TODO keeping ruby format
|
||||
newScrapedItemJSON.UpdatedAt = updatedAt
|
||||
|
||||
scraped = append(scraped, newScrapedItemJSON)
|
||||
|
||||
Reference in New Issue
Block a user