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:
@@ -3,7 +3,6 @@ package stashbox
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"database/sql"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
@@ -249,9 +248,8 @@ func (c Client) SubmitStashBoxFingerprints(ctx context.Context, sceneIDs []strin
|
||||
qb := c.repository.Scene
|
||||
|
||||
for _, sceneID := range ids {
|
||||
// TODO - Find should return an appropriate not found error
|
||||
scene, err := qb.Find(ctx, sceneID)
|
||||
if err != nil && !errors.Is(err, sql.ErrNoRows) {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -832,12 +830,16 @@ func (c Client) SubmitSceneDraft(ctx context.Context, scene *models.Scene, endpo
|
||||
}
|
||||
|
||||
if scene.StudioID != nil {
|
||||
studio, err := sqb.Find(ctx, int(*scene.StudioID))
|
||||
studio, err := sqb.Find(ctx, *scene.StudioID)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if studio == nil {
|
||||
return nil, fmt.Errorf("studio with id %d not found", *scene.StudioID)
|
||||
}
|
||||
|
||||
studioDraft := graphql.DraftEntityInput{
|
||||
Name: studio.Name.String,
|
||||
Name: studio.Name,
|
||||
}
|
||||
|
||||
stashIDs, err := sqb.GetStashIDs(ctx, studio.ID)
|
||||
|
||||
Reference in New Issue
Block a user