mirror of
https://github.com/stashapp/stash.git
synced 2025-12-17 20:34:37 +03:00
File storage rewrite (#2676)
* Restructure data layer part 2 (#2599) * Refactor and separate image model * Refactor image query builder * Handle relationships in image query builder * Remove relationship management methods * Refactor gallery model/query builder * Add scenes to gallery model * Convert scene model * Refactor scene models * Remove unused methods * Add unit tests for gallery * Add image tests * Add scene tests * Convert unnecessary scene value pointers to values * Convert unnecessary pointer values to values * Refactor scene partial * Add scene partial tests * Refactor ImagePartial * Add image partial tests * Refactor gallery partial update * Add partial gallery update tests * Use zero/null package for null values * Add files and scan system * Add sqlite implementation for files/folders * Add unit tests for files/folders * Image refactors * Update image data layer * Refactor gallery model and creation * Refactor scene model * Refactor scenes * Don't set title from filename * Allow galleries to freely add/remove images * Add multiple scene file support to graphql and UI * Add multiple file support for images in graphql/UI * Add multiple file for galleries in graphql/UI * Remove use of some deprecated fields * Remove scene path usage * Remove gallery path usage * Remove path from image * Move funscript to video file * Refactor caption detection * Migrate existing data * Add post commit/rollback hook system * Lint. Comment out import/export tests * Add WithDatabase read only wrapper * Prepend tasks to list * Add 32 pre-migration * Add warnings in release and migration notes
This commit is contained in:
@@ -5,8 +5,10 @@ package mocks
|
||||
import (
|
||||
context "context"
|
||||
|
||||
models "github.com/stashapp/stash/pkg/models"
|
||||
file "github.com/stashapp/stash/pkg/file"
|
||||
mock "github.com/stretchr/testify/mock"
|
||||
|
||||
models "github.com/stashapp/stash/pkg/models"
|
||||
)
|
||||
|
||||
// GalleryReaderWriter is an autogenerated mock type for the GalleryReaderWriter type
|
||||
@@ -58,27 +60,18 @@ func (_m *GalleryReaderWriter) Count(ctx context.Context) (int, error) {
|
||||
return r0, r1
|
||||
}
|
||||
|
||||
// Create provides a mock function with given fields: ctx, newGallery
|
||||
func (_m *GalleryReaderWriter) Create(ctx context.Context, newGallery models.Gallery) (*models.Gallery, error) {
|
||||
ret := _m.Called(ctx, newGallery)
|
||||
// Create provides a mock function with given fields: ctx, newGallery, fileIDs
|
||||
func (_m *GalleryReaderWriter) Create(ctx context.Context, newGallery *models.Gallery, fileIDs []file.ID) error {
|
||||
ret := _m.Called(ctx, newGallery, fileIDs)
|
||||
|
||||
var r0 *models.Gallery
|
||||
if rf, ok := ret.Get(0).(func(context.Context, models.Gallery) *models.Gallery); ok {
|
||||
r0 = rf(ctx, newGallery)
|
||||
var r0 error
|
||||
if rf, ok := ret.Get(0).(func(context.Context, *models.Gallery, []file.ID) error); ok {
|
||||
r0 = rf(ctx, newGallery, fileIDs)
|
||||
} else {
|
||||
if ret.Get(0) != nil {
|
||||
r0 = ret.Get(0).(*models.Gallery)
|
||||
}
|
||||
r0 = ret.Error(0)
|
||||
}
|
||||
|
||||
var r1 error
|
||||
if rf, ok := ret.Get(1).(func(context.Context, models.Gallery) error); ok {
|
||||
r1 = rf(ctx, newGallery)
|
||||
} else {
|
||||
r1 = ret.Error(1)
|
||||
}
|
||||
|
||||
return r0, r1
|
||||
return r0
|
||||
}
|
||||
|
||||
// Destroy provides a mock function with given fields: ctx, id
|
||||
@@ -119,15 +112,15 @@ func (_m *GalleryReaderWriter) Find(ctx context.Context, id int) (*models.Galler
|
||||
}
|
||||
|
||||
// FindByChecksum provides a mock function with given fields: ctx, checksum
|
||||
func (_m *GalleryReaderWriter) FindByChecksum(ctx context.Context, checksum string) (*models.Gallery, error) {
|
||||
func (_m *GalleryReaderWriter) FindByChecksum(ctx context.Context, checksum string) ([]*models.Gallery, error) {
|
||||
ret := _m.Called(ctx, checksum)
|
||||
|
||||
var r0 *models.Gallery
|
||||
if rf, ok := ret.Get(0).(func(context.Context, string) *models.Gallery); ok {
|
||||
var r0 []*models.Gallery
|
||||
if rf, ok := ret.Get(0).(func(context.Context, string) []*models.Gallery); ok {
|
||||
r0 = rf(ctx, checksum)
|
||||
} else {
|
||||
if ret.Get(0) != nil {
|
||||
r0 = ret.Get(0).(*models.Gallery)
|
||||
r0 = ret.Get(0).([]*models.Gallery)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -188,15 +181,15 @@ func (_m *GalleryReaderWriter) FindByImageID(ctx context.Context, imageID int) (
|
||||
}
|
||||
|
||||
// FindByPath provides a mock function with given fields: ctx, path
|
||||
func (_m *GalleryReaderWriter) FindByPath(ctx context.Context, path string) (*models.Gallery, error) {
|
||||
func (_m *GalleryReaderWriter) FindByPath(ctx context.Context, path string) ([]*models.Gallery, error) {
|
||||
ret := _m.Called(ctx, path)
|
||||
|
||||
var r0 *models.Gallery
|
||||
if rf, ok := ret.Get(0).(func(context.Context, string) *models.Gallery); ok {
|
||||
var r0 []*models.Gallery
|
||||
if rf, ok := ret.Get(0).(func(context.Context, string) []*models.Gallery); ok {
|
||||
r0 = rf(ctx, path)
|
||||
} else {
|
||||
if ret.Get(0) != nil {
|
||||
r0 = ret.Get(0).(*models.Gallery)
|
||||
r0 = ret.Get(0).([]*models.Gallery)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -279,75 +272,6 @@ func (_m *GalleryReaderWriter) GetImageIDs(ctx context.Context, galleryID int) (
|
||||
return r0, r1
|
||||
}
|
||||
|
||||
// GetPerformerIDs provides a mock function with given fields: ctx, galleryID
|
||||
func (_m *GalleryReaderWriter) GetPerformerIDs(ctx context.Context, galleryID int) ([]int, error) {
|
||||
ret := _m.Called(ctx, galleryID)
|
||||
|
||||
var r0 []int
|
||||
if rf, ok := ret.Get(0).(func(context.Context, int) []int); ok {
|
||||
r0 = rf(ctx, galleryID)
|
||||
} else {
|
||||
if ret.Get(0) != nil {
|
||||
r0 = ret.Get(0).([]int)
|
||||
}
|
||||
}
|
||||
|
||||
var r1 error
|
||||
if rf, ok := ret.Get(1).(func(context.Context, int) error); ok {
|
||||
r1 = rf(ctx, galleryID)
|
||||
} else {
|
||||
r1 = ret.Error(1)
|
||||
}
|
||||
|
||||
return r0, r1
|
||||
}
|
||||
|
||||
// GetSceneIDs provides a mock function with given fields: ctx, galleryID
|
||||
func (_m *GalleryReaderWriter) GetSceneIDs(ctx context.Context, galleryID int) ([]int, error) {
|
||||
ret := _m.Called(ctx, galleryID)
|
||||
|
||||
var r0 []int
|
||||
if rf, ok := ret.Get(0).(func(context.Context, int) []int); ok {
|
||||
r0 = rf(ctx, galleryID)
|
||||
} else {
|
||||
if ret.Get(0) != nil {
|
||||
r0 = ret.Get(0).([]int)
|
||||
}
|
||||
}
|
||||
|
||||
var r1 error
|
||||
if rf, ok := ret.Get(1).(func(context.Context, int) error); ok {
|
||||
r1 = rf(ctx, galleryID)
|
||||
} else {
|
||||
r1 = ret.Error(1)
|
||||
}
|
||||
|
||||
return r0, r1
|
||||
}
|
||||
|
||||
// GetTagIDs provides a mock function with given fields: ctx, galleryID
|
||||
func (_m *GalleryReaderWriter) GetTagIDs(ctx context.Context, galleryID int) ([]int, error) {
|
||||
ret := _m.Called(ctx, galleryID)
|
||||
|
||||
var r0 []int
|
||||
if rf, ok := ret.Get(0).(func(context.Context, int) []int); ok {
|
||||
r0 = rf(ctx, galleryID)
|
||||
} else {
|
||||
if ret.Get(0) != nil {
|
||||
r0 = ret.Get(0).([]int)
|
||||
}
|
||||
}
|
||||
|
||||
var r1 error
|
||||
if rf, ok := ret.Get(1).(func(context.Context, int) error); ok {
|
||||
r1 = rf(ctx, galleryID)
|
||||
} else {
|
||||
r1 = ret.Error(1)
|
||||
}
|
||||
|
||||
return r0, r1
|
||||
}
|
||||
|
||||
// Query provides a mock function with given fields: ctx, galleryFilter, findFilter
|
||||
func (_m *GalleryReaderWriter) Query(ctx context.Context, galleryFilter *models.GalleryFilterType, findFilter *models.FindFilterType) ([]*models.Gallery, int, error) {
|
||||
ret := _m.Called(ctx, galleryFilter, findFilter)
|
||||
@@ -400,35 +324,12 @@ func (_m *GalleryReaderWriter) QueryCount(ctx context.Context, galleryFilter *mo
|
||||
}
|
||||
|
||||
// Update provides a mock function with given fields: ctx, updatedGallery
|
||||
func (_m *GalleryReaderWriter) Update(ctx context.Context, updatedGallery models.Gallery) (*models.Gallery, error) {
|
||||
func (_m *GalleryReaderWriter) Update(ctx context.Context, updatedGallery *models.Gallery) error {
|
||||
ret := _m.Called(ctx, updatedGallery)
|
||||
|
||||
var r0 *models.Gallery
|
||||
if rf, ok := ret.Get(0).(func(context.Context, models.Gallery) *models.Gallery); ok {
|
||||
r0 = rf(ctx, updatedGallery)
|
||||
} else {
|
||||
if ret.Get(0) != nil {
|
||||
r0 = ret.Get(0).(*models.Gallery)
|
||||
}
|
||||
}
|
||||
|
||||
var r1 error
|
||||
if rf, ok := ret.Get(1).(func(context.Context, models.Gallery) error); ok {
|
||||
r1 = rf(ctx, updatedGallery)
|
||||
} else {
|
||||
r1 = ret.Error(1)
|
||||
}
|
||||
|
||||
return r0, r1
|
||||
}
|
||||
|
||||
// UpdateFileModTime provides a mock function with given fields: ctx, id, modTime
|
||||
func (_m *GalleryReaderWriter) UpdateFileModTime(ctx context.Context, id int, modTime models.NullSQLiteTimestamp) error {
|
||||
ret := _m.Called(ctx, id, modTime)
|
||||
|
||||
var r0 error
|
||||
if rf, ok := ret.Get(0).(func(context.Context, int, models.NullSQLiteTimestamp) error); ok {
|
||||
r0 = rf(ctx, id, modTime)
|
||||
if rf, ok := ret.Get(0).(func(context.Context, *models.Gallery) error); ok {
|
||||
r0 = rf(ctx, updatedGallery)
|
||||
} else {
|
||||
r0 = ret.Error(0)
|
||||
}
|
||||
@@ -450,13 +351,13 @@ func (_m *GalleryReaderWriter) UpdateImages(ctx context.Context, galleryID int,
|
||||
return r0
|
||||
}
|
||||
|
||||
// UpdatePartial provides a mock function with given fields: ctx, updatedGallery
|
||||
func (_m *GalleryReaderWriter) UpdatePartial(ctx context.Context, updatedGallery models.GalleryPartial) (*models.Gallery, error) {
|
||||
ret := _m.Called(ctx, updatedGallery)
|
||||
// UpdatePartial provides a mock function with given fields: ctx, id, updatedGallery
|
||||
func (_m *GalleryReaderWriter) UpdatePartial(ctx context.Context, id int, updatedGallery models.GalleryPartial) (*models.Gallery, error) {
|
||||
ret := _m.Called(ctx, id, updatedGallery)
|
||||
|
||||
var r0 *models.Gallery
|
||||
if rf, ok := ret.Get(0).(func(context.Context, models.GalleryPartial) *models.Gallery); ok {
|
||||
r0 = rf(ctx, updatedGallery)
|
||||
if rf, ok := ret.Get(0).(func(context.Context, int, models.GalleryPartial) *models.Gallery); ok {
|
||||
r0 = rf(ctx, id, updatedGallery)
|
||||
} else {
|
||||
if ret.Get(0) != nil {
|
||||
r0 = ret.Get(0).(*models.Gallery)
|
||||
@@ -464,53 +365,11 @@ func (_m *GalleryReaderWriter) UpdatePartial(ctx context.Context, updatedGallery
|
||||
}
|
||||
|
||||
var r1 error
|
||||
if rf, ok := ret.Get(1).(func(context.Context, models.GalleryPartial) error); ok {
|
||||
r1 = rf(ctx, updatedGallery)
|
||||
if rf, ok := ret.Get(1).(func(context.Context, int, models.GalleryPartial) error); ok {
|
||||
r1 = rf(ctx, id, updatedGallery)
|
||||
} else {
|
||||
r1 = ret.Error(1)
|
||||
}
|
||||
|
||||
return r0, r1
|
||||
}
|
||||
|
||||
// UpdatePerformers provides a mock function with given fields: ctx, galleryID, performerIDs
|
||||
func (_m *GalleryReaderWriter) UpdatePerformers(ctx context.Context, galleryID int, performerIDs []int) error {
|
||||
ret := _m.Called(ctx, galleryID, performerIDs)
|
||||
|
||||
var r0 error
|
||||
if rf, ok := ret.Get(0).(func(context.Context, int, []int) error); ok {
|
||||
r0 = rf(ctx, galleryID, performerIDs)
|
||||
} else {
|
||||
r0 = ret.Error(0)
|
||||
}
|
||||
|
||||
return r0
|
||||
}
|
||||
|
||||
// UpdateScenes provides a mock function with given fields: ctx, galleryID, sceneIDs
|
||||
func (_m *GalleryReaderWriter) UpdateScenes(ctx context.Context, galleryID int, sceneIDs []int) error {
|
||||
ret := _m.Called(ctx, galleryID, sceneIDs)
|
||||
|
||||
var r0 error
|
||||
if rf, ok := ret.Get(0).(func(context.Context, int, []int) error); ok {
|
||||
r0 = rf(ctx, galleryID, sceneIDs)
|
||||
} else {
|
||||
r0 = ret.Error(0)
|
||||
}
|
||||
|
||||
return r0
|
||||
}
|
||||
|
||||
// UpdateTags provides a mock function with given fields: ctx, galleryID, tagIDs
|
||||
func (_m *GalleryReaderWriter) UpdateTags(ctx context.Context, galleryID int, tagIDs []int) error {
|
||||
ret := _m.Called(ctx, galleryID, tagIDs)
|
||||
|
||||
var r0 error
|
||||
if rf, ok := ret.Get(0).(func(context.Context, int, []int) error); ok {
|
||||
r0 = rf(ctx, galleryID, tagIDs)
|
||||
} else {
|
||||
r0 = ret.Error(0)
|
||||
}
|
||||
|
||||
return r0
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user