- Move box ID validation, file listing/pathing, manifest creation, and uploads to `boxstore` - Use shared helpers for safe filenames and polling interval env parsing - Add file status constants to `models` to avoid duplicated magic strings across handlersrefactor(server): use boxstore helpers and file status consts - Move box ID validation, file listing/pathing, manifest creation, and uploads to `boxstore` - Use shared helpers for safe filenames and polling interval env parsing - Add file status constants to `models` to avoid duplicated magic strings across handlers
41 lines
945 B
Go
41 lines
945 B
Go
package models
|
|
|
|
const (
|
|
FileStatusFailed = "failed"
|
|
FileStatusReady = "complete"
|
|
FileStatusWait = "pending"
|
|
FileStatusWork = "uploading"
|
|
)
|
|
|
|
type BoxFile struct {
|
|
ID string `json:"id"`
|
|
Name string `json:"name"`
|
|
Size int64 `json:"size"`
|
|
SizeLabel string `json:"size_label"`
|
|
MimeType string `json:"mime_type"`
|
|
Status string `json:"status"`
|
|
StatusLabel string `json:"status_label"`
|
|
Title string `json:"title"`
|
|
IconPath string `json:"icon_path"`
|
|
DownloadPath string `json:"download_path"`
|
|
UploadPath string `json:"upload_path"`
|
|
IsComplete bool `json:"is_complete"`
|
|
}
|
|
|
|
type BoxManifest struct {
|
|
Files []BoxFile `json:"files"`
|
|
}
|
|
|
|
type CreateBoxRequest struct {
|
|
Files []CreateBoxFileRequest `json:"files"`
|
|
}
|
|
|
|
type CreateBoxFileRequest struct {
|
|
Name string `json:"name"`
|
|
Size int64 `json:"size"`
|
|
}
|
|
|
|
type UpdateFileStatusRequest struct {
|
|
Status string `json:"status"`
|
|
}
|