add missing tags

This commit is contained in:
m
2026-07-13 13:05:13 +02:00
parent 0aa3549561
commit ca2d5a54e1
2 changed files with 30 additions and 11 deletions
+28 -10
View File
@@ -57,27 +57,45 @@ 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"`
UpdatedAt string `json:"updatedAt"` UpdatedAt string `json:"updatedAt"`
} }
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,
+2 -1
View File
@@ -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 {