mirror of
https://git.vectorsigma.ru/public/photoview.git
synced 2026-08-03 18:29:17 +00:00
Update periodic scanner value from UI
This commit is contained in:
@@ -39,3 +39,23 @@ func (r *mutationResolver) ScanUser(ctx context.Context, userID int) (*models.Sc
|
||||
Message: &startMessage,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (r *mutationResolver) SetPeriodicScanInterval(ctx context.Context, interval int) (int, error) {
|
||||
if interval < 0 {
|
||||
return 0, errors.New("interval must be 0 or above")
|
||||
}
|
||||
|
||||
_, err := r.Database.Exec("UPDATE site_info SET periodic_scan_interval = ?", interval)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
|
||||
var dbInterval int
|
||||
|
||||
row := r.Database.QueryRow("SELECT periodic_scan_interval FROM site_info")
|
||||
if err = row.Scan(&dbInterval); err != nil {
|
||||
return 0, err
|
||||
}
|
||||
|
||||
return dbInterval, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user