add missing tags
This commit is contained in:
@@ -57,12 +57,18 @@ func (h *FileHandler) List(c *gin.Context) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type tagResponse struct {
|
||||||
|
ID string `json:"id"`
|
||||||
|
TagName string `json:"tag_name"`
|
||||||
|
TagType string `json:"tag_type"`
|
||||||
|
}
|
||||||
|
|
||||||
type fileResponse struct {
|
type fileResponse struct {
|
||||||
ID string `json:"id"`
|
ID string `json:"id"`
|
||||||
URL string `json:"url"`
|
URL string `json:"url"`
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
Size int64 `json:"size"`
|
Size int64 `json:"size"`
|
||||||
Tags []string `json:"tags"`
|
Tags []tagResponse `json:"tags"`
|
||||||
CreatedAt string `json:"createdAt"`
|
CreatedAt string `json:"createdAt"`
|
||||||
MimeType string `json:"mimeType"`
|
MimeType string `json:"mimeType"`
|
||||||
OcrText string `json:"ocrText,omitempty"`
|
OcrText string `json:"ocrText,omitempty"`
|
||||||
@@ -72,12 +78,24 @@ func (h *FileHandler) List(c *gin.Context) {
|
|||||||
resp := make([]fileResponse, len(files))
|
resp := make([]fileResponse, len(files))
|
||||||
for i, f := range files {
|
for i, f := range files {
|
||||||
|
|
||||||
|
tags := []tagResponse{}
|
||||||
|
|
||||||
|
for _, tag := range f.Tags {
|
||||||
|
|
||||||
|
tags = append(tags, tagResponse{
|
||||||
|
ID: tag.ID,
|
||||||
|
TagName: tag.Name,
|
||||||
|
TagType: tag.TagType,
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
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: tags,
|
||||||
CreatedAt: f.CreatedAt,
|
CreatedAt: f.CreatedAt,
|
||||||
OcrText: f.OcrText,
|
OcrText: f.OcrText,
|
||||||
UpdatedAt: f.UpdatedAt,
|
UpdatedAt: f.UpdatedAt,
|
||||||
|
|||||||
@@ -12,7 +12,8 @@ export interface FileItem {
|
|||||||
|
|
||||||
export interface Tag {
|
export interface Tag {
|
||||||
id: string;
|
id: string;
|
||||||
name: string;
|
tag_name: string;
|
||||||
|
tag_type: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface OcrJob {
|
export interface OcrJob {
|
||||||
|
|||||||
Reference in New Issue
Block a user