mirror of
https://git.vectorsigma.ru/public/photoview.git
synced 2026-08-03 18:29:17 +00:00
Fix gqlgen (#1105)
This commit is contained in:
@@ -1,17 +1,23 @@
|
||||
package resolvers
|
||||
|
||||
// This file will be automatically regenerated based on the schema, any resolver implementations
|
||||
// will be copied through when generating and any unknown code will be moved to the end.
|
||||
// Code generated by github.com/99designs/gqlgen version v0.17.55
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/photoview/photoview/api/database/drivers"
|
||||
"github.com/photoview/photoview/api/graphql/models"
|
||||
"github.com/photoview/photoview/api/scanner/periodic_scanner"
|
||||
"github.com/photoview/photoview/api/scanner/scanner_queue"
|
||||
"github.com/pkg/errors"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
// ScanAll is the resolver for the scanAll field.
|
||||
func (r *mutationResolver) ScanAll(ctx context.Context) (*models.ScannerResult, error) {
|
||||
err := scanner_queue.AddAllToQueue()
|
||||
if err != nil {
|
||||
@@ -27,10 +33,11 @@ func (r *mutationResolver) ScanAll(ctx context.Context) (*models.ScannerResult,
|
||||
}, nil
|
||||
}
|
||||
|
||||
// ScanUser is the resolver for the scanUser field.
|
||||
func (r *mutationResolver) ScanUser(ctx context.Context, userID int) (*models.ScannerResult, error) {
|
||||
var user models.User
|
||||
if err := r.DB(ctx).First(&user, userID).Error; err != nil {
|
||||
return nil, errors.Wrap(err, "get user from database")
|
||||
return nil, fmt.Errorf("get user from database: %w", err)
|
||||
}
|
||||
|
||||
scanner_queue.AddUserToQueue(&user)
|
||||
@@ -43,6 +50,7 @@ func (r *mutationResolver) ScanUser(ctx context.Context, userID int) (*models.Sc
|
||||
}, nil
|
||||
}
|
||||
|
||||
// SetPeriodicScanInterval is the resolver for the setPeriodicScanInterval field.
|
||||
func (r *mutationResolver) SetPeriodicScanInterval(ctx context.Context, interval int) (int, error) {
|
||||
db := r.DB(ctx)
|
||||
if interval < 0 {
|
||||
@@ -68,6 +76,7 @@ func (r *mutationResolver) SetPeriodicScanInterval(ctx context.Context, interval
|
||||
return siteInfo.PeriodicScanInterval, nil
|
||||
}
|
||||
|
||||
// SetScannerConcurrentWorkers is the resolver for the setScannerConcurrentWorkers field.
|
||||
func (r *mutationResolver) SetScannerConcurrentWorkers(ctx context.Context, workers int) (int, error) {
|
||||
db := r.DB(ctx)
|
||||
if workers < 1 {
|
||||
|
||||
Reference in New Issue
Block a user