Files
photoprism/internal/form/batch/selection.go
2025-05-04 14:09:23 +02:00

32 lines
725 B
Go

package batch
import "strings"
// PhotosRequest represents items selected in the user interface.
type PhotosRequest struct {
Return bool `json:"return,omitempty"`
Filter string `json:"filter,omitempty"`
Photos []string `json:"photos"`
Values *PhotosForm `json:"values,omitempty"`
}
// Empty checks if any specific items were selected.
func (f PhotosRequest) Empty() bool {
switch {
case len(f.Photos) > 0:
return false
}
return true
}
// Get returns a string slice with the selected item UIDs.
func (f PhotosRequest) Get() []string {
return f.Photos
}
// String returns a string containing all selected item UIDs.
func (f PhotosRequest) String() string {
return strings.Join(f.Get(), ", ")
}