Add batch delete for performers/tags/studios/movies (#1053)

* Add batch delete for performers/tags/studios/movies
* Fix ListFilter styling bug
This commit is contained in:
InfiniteTF
2021-01-13 01:57:53 +01:00
committed by GitHub
parent 8a3d940aa7
commit aad4ddc46d
21 changed files with 353 additions and 56 deletions

View File

@@ -222,3 +222,18 @@ func (r *mutationResolver) MovieDestroy(ctx context.Context, input models.MovieD
}
return true, nil
}
func (r *mutationResolver) MoviesDestroy(ctx context.Context, ids []string) (bool, error) {
qb := models.NewMovieQueryBuilder()
tx := database.DB.MustBeginTx(ctx, nil)
for _, id := range ids {
if err := qb.Destroy(id, tx); err != nil {
_ = tx.Rollback()
return false, err
}
}
if err := tx.Commit(); err != nil {
return false, err
}
return true, nil
}