From 78705e82a8078192039684b2825894cc93450e0d Mon Sep 17 00:00:00 2001 From: LittleSheep Date: Tue, 10 Sep 2024 21:31:51 +0800 Subject: [PATCH] :sparkles: Attachment API can edit metadata --- .idea/dataSources.local.xml | 2 +- .../shelved.patch | 43 ------------------- ...before_Checkout_at_2024_8_20__22_59___.xml | 4 -- .idea/workspace.xml | 12 +++--- pkg/internal/server/api/attachments_api.go | 6 ++- 5 files changed, 11 insertions(+), 56 deletions(-) delete mode 100644 .idea/shelf/Uncommitted_changes_before_Checkout_at_2024_8_20,_22_59_[更改]/shelved.patch delete mode 100644 .idea/shelf/Uncommitted_changes_before_Checkout_at_2024_8_20__22_59___.xml diff --git a/.idea/dataSources.local.xml b/.idea/dataSources.local.xml index 3647521..7163d61 100644 --- a/.idea/dataSources.local.xml +++ b/.idea/dataSources.local.xml @@ -1,6 +1,6 @@ - + " diff --git a/.idea/shelf/Uncommitted_changes_before_Checkout_at_2024_8_20,_22_59_[更改]/shelved.patch b/.idea/shelf/Uncommitted_changes_before_Checkout_at_2024_8_20,_22_59_[更改]/shelved.patch deleted file mode 100644 index 3036b92..0000000 --- a/.idea/shelf/Uncommitted_changes_before_Checkout_at_2024_8_20,_22_59_[更改]/shelved.patch +++ /dev/null @@ -1,43 +0,0 @@ -Index: .idea/workspace.xml -IDEA additional info: -Subsystem: com.intellij.openapi.diff.impl.patch.BaseRevisionTextPatchEP -<+>\n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n {\n "customColor": "",\n "associatedIndex": 7\n}\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n true\n \n -Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP -<+>UTF-8 -=================================================================== -diff --git a/.idea/workspace.xml b/.idea/workspace.xml ---- a/.idea/workspace.xml (revision 7a8fa116d324fbd238cda8733d77dd56340f1fe3) -+++ b/.idea/workspace.xml (date 1724165765609) -@@ -4,13 +4,7 @@ - - -- -- -- -- -- -- -- -+ - - - -- - - - -@@ -145,7 +138,8 @@ - - - -- - - true diff --git a/.idea/shelf/Uncommitted_changes_before_Checkout_at_2024_8_20__22_59___.xml b/.idea/shelf/Uncommitted_changes_before_Checkout_at_2024_8_20__22_59___.xml deleted file mode 100644 index 0e886dc..0000000 --- a/.idea/shelf/Uncommitted_changes_before_Checkout_at_2024_8_20__22_59___.xml +++ /dev/null @@ -1,4 +0,0 @@ - - \ No newline at end of file diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 71c6e47..bbadbf2 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -4,12 +4,12 @@ - + - + - @@ -145,7 +144,8 @@ - true diff --git a/pkg/internal/server/api/attachments_api.go b/pkg/internal/server/api/attachments_api.go index 0e63d51..684462e 100644 --- a/pkg/internal/server/api/attachments_api.go +++ b/pkg/internal/server/api/attachments_api.go @@ -89,8 +89,9 @@ func updateAttachmentMeta(c *fiber.Ctx) error { user := c.Locals("user").(models.Account) var data struct { - Alternative string `json:"alt"` - IsMature bool `json:"is_mature"` + Alternative string `json:"alt"` + Metadata map[string]any `json:"metadata"` + IsMature bool `json:"is_mature"` } if err := exts.BindAndValidate(c, &data); err != nil { @@ -103,6 +104,7 @@ func updateAttachmentMeta(c *fiber.Ctx) error { } attachment.Alternative = data.Alternative + attachment.Metadata = data.Metadata attachment.IsMature = data.IsMature if attachment, err := services.UpdateAttachment(attachment); err != nil {