From ca2d5a54e1aa254263d7af13a9569f3c74819e71 Mon Sep 17 00:00:00 2001 From: m Date: Mon, 13 Jul 2026 13:05:13 +0200 Subject: [PATCH] add missing tags --- backend/internal/handler/files.go | 38 +++++++++++++++++++++++-------- mobile/types/index.ts | 3 ++- 2 files changed, 30 insertions(+), 11 deletions(-) diff --git a/backend/internal/handler/files.go b/backend/internal/handler/files.go index dd6556e..0097fdb 100644 --- a/backend/internal/handler/files.go +++ b/backend/internal/handler/files.go @@ -57,27 +57,45 @@ func (h *FileHandler) List(c *gin.Context) { return } + type tagResponse struct { + ID string `json:"id"` + TagName string `json:"tag_name"` + TagType string `json:"tag_type"` + } + type fileResponse struct { - ID string `json:"id"` - URL string `json:"url"` - Name string `json:"name"` - Size int64 `json:"size"` - Tags []string `json:"tags"` - CreatedAt string `json:"createdAt"` - MimeType string `json:"mimeType"` - OcrText string `json:"ocrText,omitempty"` - UpdatedAt string `json:"updatedAt"` + ID string `json:"id"` + URL string `json:"url"` + Name string `json:"name"` + Size int64 `json:"size"` + Tags []tagResponse `json:"tags"` + CreatedAt string `json:"createdAt"` + MimeType string `json:"mimeType"` + OcrText string `json:"ocrText,omitempty"` + UpdatedAt string `json:"updatedAt"` } resp := make([]fileResponse, len(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{ ID: f.ID, URL: h.urls.GenerateDownloadURL(f.ID), Name: f.Name, Size: f.Size, - Tags: []string{}, + Tags: tags, CreatedAt: f.CreatedAt, OcrText: f.OcrText, UpdatedAt: f.UpdatedAt, diff --git a/mobile/types/index.ts b/mobile/types/index.ts index c276831..450db5c 100644 --- a/mobile/types/index.ts +++ b/mobile/types/index.ts @@ -12,7 +12,8 @@ export interface FileItem { export interface Tag { id: string; - name: string; + tag_name: string; + tag_type: string; } export interface OcrJob {