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:
DingDongSoLong4
2023-06-15 04:46:09 +02:00
committed by GitHub
parent 9180a68c45
commit 1c13c9e1b1
150 changed files with 3279 additions and 3129 deletions

View File

@@ -246,7 +246,7 @@ func TestGetStudioName(t *testing.T) {
studioErr := errors.New("error getting image")
mockStudioReader.On("Find", testCtx, studioID).Return(&models.Studio{
Name: models.NullString(studioName),
Name: studioName,
}, nil).Once()
mockStudioReader.On("Find", testCtx, missingStudioID).Return(nil, nil).Once()
mockStudioReader.On("Find", testCtx, errStudioID).Return(nil, studioErr).Once()
@@ -394,10 +394,10 @@ func TestGetSceneMoviesJSON(t *testing.T) {
movieErr := errors.New("error getting movie")
mockMovieReader.On("Find", testCtx, validMovie1).Return(&models.Movie{
Name: models.NullString(movie1Name),
Name: movie1Name,
}, nil).Once()
mockMovieReader.On("Find", testCtx, validMovie2).Return(&models.Movie{
Name: models.NullString(movie2Name),
Name: movie2Name,
}, nil).Once()
mockMovieReader.On("Find", testCtx, invalidMovie).Return(nil, movieErr).Once()
@@ -513,24 +513,16 @@ var validMarkers = []*models.SceneMarker{
Title: markerTitle1,
PrimaryTagID: validTagID1,
Seconds: markerSeconds1,
CreatedAt: models.SQLiteTimestamp{
Timestamp: createTime,
},
UpdatedAt: models.SQLiteTimestamp{
Timestamp: updateTime,
},
CreatedAt: createTime,
UpdatedAt: updateTime,
},
{
ID: validMarkerID2,
Title: markerTitle2,
PrimaryTagID: validTagID2,
Seconds: markerSeconds2,
CreatedAt: models.SQLiteTimestamp{
Timestamp: createTime,
},
UpdatedAt: models.SQLiteTimestamp{
Timestamp: updateTime,
},
CreatedAt: createTime,
UpdatedAt: updateTime,
},
}