Initial commit
CI / test (push) Canceled after 0s

This commit is contained in:
2026-09-12 22:22:17 +02:00
commit 904d14b64c
314 changed files with 31884 additions and 0 deletions
+44
View File
@@ -0,0 +1,44 @@
package storage
import "time"
// MaxImageSize is the largest image payload accepted by storage, in bytes.
const MaxImageSize = 10 << 20
// ImageModelInterface persists garden-owned image data and assignment history.
type ImageModelInterface interface {
Insert(image Image) (Image, error)
Get(gardenID, id int) (Image, error)
GetAllForGarden(gardenID int, filter ImageFilter) ([]Image, error)
CountForGarden(gardenID int) (int, error)
RecordAssignment(change ImageAssignment) error
}
// Image is a binary image stored in a garden's reusable media library.
type Image struct {
ID int `json:"id"`
GardenID int `json:"garden_id"`
FileName string `json:"file_name"`
MediaType string `json:"media_type"`
Size int64 `json:"size"`
Source string `json:"source"`
CreatedBy int `json:"created_by"`
CreatedAt time.Time `json:"created_at"`
Data []byte `json:"-"`
}
// ImageFilter restricts image-library queries by filename or media type.
type ImageFilter struct {
Source string
Query string
}
// ImageAssignment records an image change on a garden entity.
type ImageAssignment struct {
GardenID int
EntityType string
EntityID int
PreviousImageID *int
ImageID *int
ChangedBy int
}