mirror of
https://github.com/stashapp/stash.git
synced 2025-12-07 17:02:38 +01:00
* Add new configuration options * Refactor scan/clean * Schema changes * Add details to galleries * Remove redundant code * Refine thumbnail generation * Gallery overhaul * Don't allow modifying zip gallery images * Show gallery card overlays * Hide zoom slider when not in grid mode
30 lines
799 B
Go
30 lines
799 B
Go
package api
|
|
|
|
import (
|
|
"context"
|
|
"strconv"
|
|
|
|
"github.com/stashapp/stash/pkg/models"
|
|
)
|
|
|
|
func (r *queryResolver) FindImage(ctx context.Context, id *string, checksum *string) (*models.Image, error) {
|
|
qb := models.NewImageQueryBuilder()
|
|
var image *models.Image
|
|
var err error
|
|
if id != nil {
|
|
idInt, _ := strconv.Atoi(*id)
|
|
image, err = qb.Find(idInt)
|
|
} else if checksum != nil {
|
|
image, err = qb.FindByChecksum(*checksum)
|
|
}
|
|
return image, err
|
|
}
|
|
|
|
func (r *queryResolver) FindImages(ctx context.Context, imageFilter *models.ImageFilterType, imageIds []int, filter *models.FindFilterType) (*models.FindImagesResultType, error) {
|
|
qb := models.NewImageQueryBuilder()
|
|
images, total := qb.Query(imageFilter, filter)
|
|
return &models.FindImagesResultType{
|
|
Count: total,
|
|
Images: images,
|
|
}, nil
|
|
}
|