add missing infos
This commit is contained in:
@@ -55,10 +55,6 @@ func (h *FileHandler) List(c *gin.Context) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
for i := range files {
|
|
||||||
files[i].CreatedAt = "" // clean for response
|
|
||||||
}
|
|
||||||
|
|
||||||
type fileResponse struct {
|
type fileResponse struct {
|
||||||
ID string `json:"id"`
|
ID string `json:"id"`
|
||||||
URL string `json:"url"`
|
URL string `json:"url"`
|
||||||
@@ -66,32 +62,23 @@ func (h *FileHandler) List(c *gin.Context) {
|
|||||||
Size int64 `json:"size"`
|
Size int64 `json:"size"`
|
||||||
Tags []string `json:"tags"`
|
Tags []string `json:"tags"`
|
||||||
CreatedAt string `json:"createdAt"`
|
CreatedAt string `json:"createdAt"`
|
||||||
|
MimeType string `json:"mimeType"`
|
||||||
|
OcrText string `json:"ocrText,omitempty"`
|
||||||
|
UpdatedAt string `json:"updatedAt"`
|
||||||
}
|
}
|
||||||
|
|
||||||
resp := make([]fileResponse, len(files))
|
resp := make([]fileResponse, len(files))
|
||||||
for i, f := range files {
|
for i, f := range files {
|
||||||
|
|
||||||
metadata, err := h.files.Get(f.ID)
|
|
||||||
if err != nil {
|
|
||||||
|
|
||||||
resp[i] = fileResponse{
|
resp[i] = fileResponse{
|
||||||
ID: f.ID,
|
ID: f.ID,
|
||||||
URL: h.urls.GenerateDownloadURL(f.ID),
|
URL: h.urls.GenerateDownloadURL(f.ID),
|
||||||
Name: f.Name,
|
Name: f.Name,
|
||||||
Size: f.Size,
|
Size: f.Size,
|
||||||
Tags: []string{},
|
Tags: []string{},
|
||||||
}
|
CreatedAt: f.CreatedAt,
|
||||||
continue
|
UpdatedAt: f.UpdatedAt,
|
||||||
|
MimeType: f.MimeType,
|
||||||
}
|
|
||||||
|
|
||||||
resp[i] = fileResponse{
|
|
||||||
ID: f.ID,
|
|
||||||
URL: h.urls.GenerateDownloadURL(f.ID),
|
|
||||||
Name: f.Name,
|
|
||||||
Size: f.Size,
|
|
||||||
Tags: []string{},
|
|
||||||
CreatedAt: metadata.CreatedAt,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user