mirror of
https://github.com/stashapp/stash.git
synced 2025-12-18 04:44:37 +03:00
Model refactor, part 2 (#4092)
* Move conversions into changesetTranslator * Improve mutation error messages * Use models.New and models.NewPartial everywhere * Replace getStashIDsFor functions * Remove ImageCreateInput * Remove unused parameters * Refactor matching functions --------- Co-authored-by: WithoutPants <53250216+WithoutPants@users.noreply.github.com>
This commit is contained in:
@@ -74,32 +74,32 @@ func (u UpdateSet) UpdateInput() models.SceneUpdateInput {
|
||||
}
|
||||
|
||||
func AddPerformer(ctx context.Context, qb models.SceneUpdater, o *models.Scene, performerID int) error {
|
||||
_, err := qb.UpdatePartial(ctx, o.ID, models.ScenePartial{
|
||||
PerformerIDs: &models.UpdateIDs{
|
||||
IDs: []int{performerID},
|
||||
Mode: models.RelationshipUpdateModeAdd,
|
||||
},
|
||||
})
|
||||
scenePartial := models.NewScenePartial()
|
||||
scenePartial.PerformerIDs = &models.UpdateIDs{
|
||||
IDs: []int{performerID},
|
||||
Mode: models.RelationshipUpdateModeAdd,
|
||||
}
|
||||
_, err := qb.UpdatePartial(ctx, o.ID, scenePartial)
|
||||
return err
|
||||
}
|
||||
|
||||
func AddTag(ctx context.Context, qb models.SceneUpdater, o *models.Scene, tagID int) error {
|
||||
_, err := qb.UpdatePartial(ctx, o.ID, models.ScenePartial{
|
||||
TagIDs: &models.UpdateIDs{
|
||||
IDs: []int{tagID},
|
||||
Mode: models.RelationshipUpdateModeAdd,
|
||||
},
|
||||
})
|
||||
scenePartial := models.NewScenePartial()
|
||||
scenePartial.TagIDs = &models.UpdateIDs{
|
||||
IDs: []int{tagID},
|
||||
Mode: models.RelationshipUpdateModeAdd,
|
||||
}
|
||||
_, err := qb.UpdatePartial(ctx, o.ID, scenePartial)
|
||||
return err
|
||||
}
|
||||
|
||||
func AddGallery(ctx context.Context, qb models.SceneUpdater, o *models.Scene, galleryID int) error {
|
||||
_, err := qb.UpdatePartial(ctx, o.ID, models.ScenePartial{
|
||||
TagIDs: &models.UpdateIDs{
|
||||
IDs: []int{galleryID},
|
||||
Mode: models.RelationshipUpdateModeAdd,
|
||||
},
|
||||
})
|
||||
scenePartial := models.NewScenePartial()
|
||||
scenePartial.TagIDs = &models.UpdateIDs{
|
||||
IDs: []int{galleryID},
|
||||
Mode: models.RelationshipUpdateModeAdd,
|
||||
}
|
||||
_, err := qb.UpdatePartial(ctx, o.ID, scenePartial)
|
||||
return err
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user