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:
@@ -2,7 +2,7 @@ package api
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"strconv"
|
||||
|
||||
"github.com/stashapp/stash/internal/api/urlbuilders"
|
||||
@@ -11,12 +11,16 @@ import (
|
||||
)
|
||||
|
||||
func (r *queryResolver) SceneStreams(ctx context.Context, id *string) ([]*manager.SceneStreamEndpoint, error) {
|
||||
sceneID, err := strconv.Atoi(*id)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// find the scene
|
||||
var scene *models.Scene
|
||||
if err := r.withReadTxn(ctx, func(ctx context.Context) error {
|
||||
idInt, _ := strconv.Atoi(*id)
|
||||
var err error
|
||||
scene, err = r.repository.Scene.Find(ctx, idInt)
|
||||
scene, err = r.repository.Scene.Find(ctx, sceneID)
|
||||
|
||||
if scene != nil {
|
||||
err = scene.LoadPrimaryFile(ctx, r.repository.File)
|
||||
@@ -28,7 +32,7 @@ func (r *queryResolver) SceneStreams(ctx context.Context, id *string) ([]*manage
|
||||
}
|
||||
|
||||
if scene == nil {
|
||||
return nil, errors.New("nil scene")
|
||||
return nil, fmt.Errorf("scene with id %d not found", sceneID)
|
||||
}
|
||||
|
||||
config := manager.GetInstance().Config
|
||||
|
||||
Reference in New Issue
Block a user