mirror of
https://github.com/mickael-kerjean/filestash.git
synced 2026-10-19 16:14:39 +00:00
chore (refactoring): simplify metadata handling
This commit is contained in:
@@ -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 {
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user