storedfiles

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 27, 2026 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyBindResult

func ApplyBindResult(
	ctx context.Context,
	db *gorm.DB,
	provider blob.Provider,
	organizationID, factoryID uuid.UUID,
	result BindResult,
	txErr error,
) error

func CompleteUpload

func CompleteUpload(ctx context.Context, tx *gorm.DB, provider blob.Provider, file *models.File, body io.Reader) error

func ContentUploadURL

func ContentUploadURL(fileID uuid.UUID) string

func DeleteObject

func DeleteObject(ctx context.Context, provider blob.Provider, key string) error

func DeleteObjectAndRow

func DeleteObjectAndRow(ctx context.Context, tx *gorm.DB, provider blob.Provider, file *models.File) error

func DeleteObjects

func DeleteObjects(ctx context.Context, provider blob.Provider, keys []string) error

func DownloadURL

func DownloadURL(ctx context.Context, provider blob.Provider, file *models.File, ttl time.Duration) (string, error)

func RestoreFileRefs

func RestoreFileRefs(
	tx *gorm.DB,
	organizationID, factoryID, workOrderID uuid.UUID,
	markdown string,
) (string, error)

func SweepObjects

func SweepObjects(
	ctx context.Context,
	db *gorm.DB,
	provider blob.Provider,
	organizationID, factoryID uuid.UUID,
	keys []string,
) error

Types

type BindResult

type BindResult struct {
	StaleKeys  []string
	CopiedKeys []string
}

func BindDescriptionFiles

func BindDescriptionFiles(
	ctx context.Context,
	tx *gorm.DB,
	provider blob.Provider,
	organizationID, factoryID, workOrderID uuid.UUID,
	markdown string,
) (result BindResult, err error)

type DispatchFile

type DispatchFile struct {
	ID          uuid.UUID
	Filename    string
	ContentType string
	SizeBytes   int64
	Checksum    string
	URL         string
}

func DescriptionForDispatch

func DescriptionForDispatch(
	ctx context.Context,
	tx *gorm.DB,
	provider blob.Provider,
	organizationID, factoryID, workOrderID uuid.UUID,
	markdown string,
	ttl time.Duration,
) (string, []DispatchFile, error)

func (DispatchFile) Map

func (f DispatchFile) Map() map[string]any

type FetchFunc

type FetchFunc func(ctx context.Context, req *http.Request) (*http.Response, error)

func FetcherFromHTTP

func FetcherFromHTTP(httpCtx core.HTTPContext) FetchFunc

type IncomingFile

type IncomingFile struct {
	Filename    string
	ContentType string
	Body        io.Reader
	ReplaceURLs []string
}

IncomingFile is a downloaded remote file to store on a work order. ReplaceURLs are exact strings in the description that become the stored file reference. When none of them occur, the file is appended.

type IngestResult

type IngestResult struct {
	Markdown   string
	ObjectKeys []string
}

func AppendTaskFiles

func AppendTaskFiles(
	ctx context.Context,
	tx *gorm.DB,
	provider blob.Provider,
	organizationID, factoryID, workOrderID uuid.UUID,
	createdBy *uuid.UUID,
	markdown string,
	files []IncomingFile,
) (IngestResult, error)

func IngestRemoteImages

func IngestRemoteImages(
	ctx context.Context,
	tx *gorm.DB,
	provider blob.Provider,
	fetch FetchFunc,
	allow func(string) bool,
	organizationID, factoryID, workOrderID uuid.UUID,
	createdBy *uuid.UUID,
	markdown string,
) (IngestResult, error)

type PendingUpload

type PendingUpload struct {
	SizeBytes int64
	Checksum  string
}

func StorePendingUpload

func StorePendingUpload(ctx context.Context, provider blob.Provider, file *models.File, body io.Reader) (*PendingUpload, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL