chore (refactoring): simplify metadata handling

This commit is contained in:
MickaelK
2026-07-23 20:04:46 +10:00
parent b2c9f22e0a
commit a44fac5b4b
2 changed files with 14 additions and 14 deletions
+7 -7
View File
@@ -120,13 +120,13 @@ type WorkflowSpecs struct {
}
type File struct {
FName string `json:"name"`
FType string `json:"type"`
FTime int64 `json:"time"`
FSize int64 `json:"size"`
FPath string `json:"path,omitempty"`
Offline bool `json:"offline,omitempty"`
Metadata map[string]any `json:"metadata,omitempty"`
FName string `json:"name"`
FType string `json:"type"`
FTime int64 `json:"time"`
FSize int64 `json:"size"`
FPath string `json:"path,omitempty"`
Offline bool `json:"offline,omitempty"`
Metadata any `json:"metadata,omitempty"`
}
func (f File) Name() string {
+7 -7
View File
@@ -15,12 +15,12 @@ import (
)
type FileInfo struct {
Name string `json:"name"`
Type string `json:"type"`
Size int64 `json:"size"`
Time int64 `json:"time"`
Offline bool `json:"offline,omitempty"`
Metadata map[string]any `json:"metadata,omitempty"`
Name string `json:"name"`
Type string `json:"type"`
Size int64 `json:"size"`
Time int64 `json:"time"`
Offline bool `json:"offline,omitempty"`
Metadata any `json:"metadata,omitempty"`
}
func FileLs(ctx *App, res http.ResponseWriter, req *http.Request) {
@@ -119,10 +119,10 @@ func FileLs(ctx *App, res http.ResponseWriter, req *http.Request) {
}
return "directory"
}(entries[i].Mode()),
Metadata: entries[i].Sys(),
}
if f, ok := entries[i].Sys().(File); ok {
files[i].Offline = f.Offline
files[i].Metadata = f.Metadata
}
}