Fix site_info, replace ID type in graphql queries

This commit is contained in:
viktorstrate
2020-11-30 16:42:13 +01:00
parent 31da5e1c07
commit 364521958b
13 changed files with 42 additions and 33 deletions

View File

@@ -7,6 +7,7 @@ import (
"github.com/pkg/errors"
"github.com/viktorstrate/photoview/api/graphql/models"
"github.com/viktorstrate/photoview/api/scanner"
"gorm.io/gorm"
)
func (r *mutationResolver) ScanAll(ctx context.Context) (*models.ScannerResult, error) {
@@ -66,7 +67,7 @@ func (r *mutationResolver) SetScannerConcurrentWorkers(ctx context.Context, work
return 0, errors.New("concurrent workers must at least be 1")
}
if err := r.Database.Model(&models.SiteInfo{}).Update("concurrent_workers", workers).Error; err != nil {
if err := r.Database.Session(&gorm.Session{AllowGlobalUpdate: true}).Model(&models.SiteInfo{}).Update("concurrent_workers", workers).Error; err != nil {
return 0, err
}