mirror of
https://github.com/stashapp/stash.git
synced 2025-12-06 08:26:00 +01:00
* Refactor transaction hooks. Add preCommit * Add BlobStore * Use blobStore for tag images * Use blobStore for studio images * Use blobStore for performer images * Use blobStore for scene covers * Don't generate screenshots in legacy directory * Run post-hooks outside original transaction * Use blobStore for movie images * Remove unnecessary DestroyImage methods * Add missing filter for scene cover * Add covers to generate options * Add generate cover option to UI * Add screenshot migration * Delete thumb files as part of screenshot migration
50 lines
917 B
Go
50 lines
917 B
Go
package config
|
|
|
|
import (
|
|
"fmt"
|
|
"io"
|
|
"strconv"
|
|
)
|
|
|
|
type BlobsStorageType string
|
|
|
|
const (
|
|
// Database
|
|
BlobStorageTypeDatabase BlobsStorageType = "DATABASE"
|
|
// Filesystem
|
|
BlobStorageTypeFilesystem BlobsStorageType = "FILESYSTEM"
|
|
)
|
|
|
|
var AllBlobStorageType = []BlobsStorageType{
|
|
BlobStorageTypeDatabase,
|
|
BlobStorageTypeFilesystem,
|
|
}
|
|
|
|
func (e BlobsStorageType) IsValid() bool {
|
|
switch e {
|
|
case BlobStorageTypeDatabase, BlobStorageTypeFilesystem:
|
|
return true
|
|
}
|
|
return false
|
|
}
|
|
|
|
func (e BlobsStorageType) String() string {
|
|
return string(e)
|
|
}
|
|
|
|
func (e *BlobsStorageType) UnmarshalGQL(v interface{}) error {
|
|
str, ok := v.(string)
|
|
if !ok {
|
|
return fmt.Errorf("enums must be strings")
|
|
}
|
|
|
|
*e = BlobsStorageType(str)
|
|
if !e.IsValid() {
|
|
return fmt.Errorf("%s is not a valid BlobStorageType", str)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (e BlobsStorageType) MarshalGQL(w io.Writer) {
|
|
fmt.Fprint(w, strconv.Quote(e.String()))
|
|
}
|