mirror of
https://git.vectorsigma.ru/public/photoview.git
synced 2026-07-29 00:18:54 +00:00
* Bump several API dependencies to the latest versions Bump github.com/stretchr/testify from 1.9.0 to 1.10.0 in /api Bump github.com/vektah/gqlparser/v2 from 2.5.19 to 2.5.20 in /api Bump gorm.io/driver/postgres from 1.5.10 to 1.5.11 in /api Bump golang.org/x/image from 0.22.0 to 0.23.0 in /api Bump golang.org/x/crypto from 0.29.0 to 0.30.0 in /api Bump github.com/99designs/gqlgen from 0.17.56 to 0.17.57 in /api * Regenerate GraphQL code --------- Co-authored-by: Konstantin Koval
44 lines
1.3 KiB
Go
44 lines
1.3 KiB
Go
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.57
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/photoview/photoview/api/graphql/models"
|
|
"gorm.io/gorm"
|
|
)
|
|
|
|
// SetThumbnailDownsampleMethod is the resolver for the setThumbnailDownsampleMethod field.
|
|
func (r *mutationResolver) SetThumbnailDownsampleMethod(ctx context.Context, method models.ThumbnailFilter) (models.ThumbnailFilter, error) {
|
|
db := r.DB(ctx)
|
|
|
|
// if method > 5 {
|
|
// return 0, errors.New("The requested filter is unsupported, defaulting to nearest neighbor")
|
|
// }
|
|
|
|
if err := db.
|
|
Session(&gorm.Session{AllowGlobalUpdate: true}).
|
|
Model(&models.SiteInfo{}).
|
|
Update("thumbnail_method", method).
|
|
Error; err != nil {
|
|
|
|
return models.ThumbnailFilterNearestNeighbor, err
|
|
}
|
|
|
|
var siteInfo models.SiteInfo
|
|
if err := db.First(&siteInfo).Error; err != nil {
|
|
return models.ThumbnailFilterNearestNeighbor, err
|
|
}
|
|
|
|
return siteInfo.ThumbnailMethod, nil
|
|
|
|
// var langTrans *models.LanguageTranslation = nil
|
|
// if language != nil {
|
|
// lng := models.LanguageTranslation(*language)
|
|
// langTrans = &lng
|
|
// }
|
|
}
|