[Files Refactor] Bug fixes (#2868)

* Return error if multiple rows returned for id
* Add missing LoadFiles calls
* Show id if path is empty
This commit is contained in:
WithoutPants
2022-09-02 11:18:37 +10:00
parent 273cf0383d
commit 94d39da706
23 changed files with 93 additions and 26 deletions

View File

@@ -4,6 +4,7 @@ import (
"context"
"errors"
"path/filepath"
"strconv"
"time"
"github.com/stashapp/stash/pkg/file"
@@ -96,6 +97,16 @@ func (i Image) GetTitle() string {
return ""
}
// DisplayName returns a display name for the scene for logging purposes.
// It returns Path if not empty, otherwise it returns the ID.
func (i Image) DisplayName() string {
if i.Path != "" {
return i.Path
}
return strconv.Itoa(i.ID)
}
type ImageCreateInput struct {
*Image
FileIDs []file.ID