Attachment API can edit metadata

This commit is contained in:
LittleSheep 2024-09-10 21:31:51 +08:00
parent 42fedd7745
commit 78705e82a8
5 changed files with 11 additions and 56 deletions

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="dataSourceStorageLocal" created-in="GO-242.21829.165"> <component name="dataSourceStorageLocal" created-in="GO-242.21829.220">
<data-source name="hy_paperclip@localhost" uuid="bac83d8a-c619-4680-a07f-6674b93fbfea"> <data-source name="hy_paperclip@localhost" uuid="bac83d8a-c619-4680-a07f-6674b93fbfea">
<database-info product="PostgreSQL" version="16.3 (Homebrew)" jdbc-version="4.2" driver-name="PostgreSQL JDBC Driver" driver-version="42.6.0" dbms="POSTGRES" exact-version="16.3" exact-driver-version="42.6"> <database-info product="PostgreSQL" version="16.3 (Homebrew)" jdbc-version="4.2" driver-name="PostgreSQL JDBC Driver" driver-version="42.6.0" dbms="POSTGRES" exact-version="16.3" exact-driver-version="42.6">
<identifier-quote-string>&quot;</identifier-quote-string> <identifier-quote-string>&quot;</identifier-quote-string>

File diff suppressed because one or more lines are too long

View File

@ -1,4 +0,0 @@
<changelist name="Uncommitted_changes_before_Checkout_at_2024_8_20,_22_59_[更改]" date="1724166000114" recycled="true" deleted="true">
<option name="PATH" value="$PROJECT_DIR$/.idea/shelf/Uncommitted_changes_before_Checkout_at_2024_8_20,_22_59_[更改]/shelved.patch" />
<option name="DESCRIPTION" value="Uncommitted changes before Checkout at 2024/8/20, 22:59 [更改]" />
</changelist>

12
.idea/workspace.xml generated
View File

@ -4,12 +4,12 @@
<option name="autoReloadType" value="ALL" /> <option name="autoReloadType" value="ALL" />
</component> </component>
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="18dd0d68-b4b8-40db-9734-9119b5c848bd" name="更改" comment=":bug: Fix concurrent upload multipart cause incomplete"> <list default="true" id="18dd0d68-b4b8-40db-9734-9119b5c848bd" name="更改" comment=":bug: Fix account_id where clause causing indexing issue">
<change beforePath="$PROJECT_DIR$/.idea/dataSources.local.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/dataSources.local.xml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/.idea/dataSources.local.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/dataSources.local.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/shelf/Uncommitted_changes_before_Checkout_at_2024_8_20,_22_59_[更改]/shelved.patch" beforeDir="false" /> <change beforePath="$PROJECT_DIR$/.idea/shelf/Uncommitted_changes_before_Checkout_at_2024_8_20,_22_59_[更改]/shelved.patch" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/shelf/Uncommitted_changes_before_Checkout_at_2024_8_20__22_59___.xml" beforeDir="false" /> <change beforePath="$PROJECT_DIR$/.idea/shelf/Uncommitted_changes_before_Checkout_at_2024_8_20__22_59___.xml" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/pkg/internal/server/api/index_api.go" beforeDir="false" afterPath="$PROJECT_DIR$/pkg/internal/server/api/index_api.go" afterDir="false" /> <change beforePath="$PROJECT_DIR$/pkg/internal/server/api/attachments_api.go" beforeDir="false" afterPath="$PROJECT_DIR$/pkg/internal/server/api/attachments_api.go" afterDir="false" />
</list> </list>
<option name="SHOW_DIALOG" value="false" /> <option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" /> <option name="HIGHLIGHT_CONFLICTS" value="true" />
@ -99,8 +99,8 @@
<component name="SharedIndexes"> <component name="SharedIndexes">
<attachedChunks> <attachedChunks>
<set> <set>
<option value="bundled-gosdk-5df93f7ad4aa-df9ad98b711f-org.jetbrains.plugins.go.sharedIndexes.bundled-GO-242.21829.165" /> <option value="bundled-gosdk-5df93f7ad4aa-df9ad98b711f-org.jetbrains.plugins.go.sharedIndexes.bundled-GO-242.21829.220" />
<option value="bundled-js-predefined-d6986cc7102b-7c0b70fcd90d-JavaScript-GO-242.21829.165" /> <option value="bundled-js-predefined-d6986cc7102b-7c0b70fcd90d-JavaScript-GO-242.21829.220" />
</set> </set>
</attachedChunks> </attachedChunks>
</component> </component>
@ -120,7 +120,6 @@
</option> </option>
</component> </component>
<component name="VcsManagerConfiguration"> <component name="VcsManagerConfiguration">
<MESSAGE value=":recycle: Moved onto dealer" />
<MESSAGE value=":sparkles: Self reference detection" /> <MESSAGE value=":sparkles: Self reference detection" />
<MESSAGE value=":sparkles: List attachment original filter" /> <MESSAGE value=":sparkles: List attachment original filter" />
<MESSAGE value=":sparkles: Attachment pool basis" /> <MESSAGE value=":sparkles: Attachment pool basis" />
@ -145,7 +144,8 @@
<MESSAGE value=":bug: Fix direct upload will save as non-uploaded" /> <MESSAGE value=":bug: Fix direct upload will save as non-uploaded" />
<MESSAGE value=":bug: Fix uploader still using old cache api" /> <MESSAGE value=":bug: Fix uploader still using old cache api" />
<MESSAGE value=":bug: Fix concurrent upload multipart cause incomplete" /> <MESSAGE value=":bug: Fix concurrent upload multipart cause incomplete" />
<option name="LAST_COMMIT_MESSAGE" value=":bug: Fix concurrent upload multipart cause incomplete" /> <MESSAGE value=":bug: Fix account_id where clause causing indexing issue" />
<option name="LAST_COMMIT_MESSAGE" value=":bug: Fix account_id where clause causing indexing issue" />
</component> </component>
<component name="VgoProject"> <component name="VgoProject">
<settings-migrated>true</settings-migrated> <settings-migrated>true</settings-migrated>

View File

@ -90,6 +90,7 @@ func updateAttachmentMeta(c *fiber.Ctx) error {
var data struct { var data struct {
Alternative string `json:"alt"` Alternative string `json:"alt"`
Metadata map[string]any `json:"metadata"`
IsMature bool `json:"is_mature"` IsMature bool `json:"is_mature"`
} }
@ -103,6 +104,7 @@ func updateAttachmentMeta(c *fiber.Ctx) error {
} }
attachment.Alternative = data.Alternative attachment.Alternative = data.Alternative
attachment.Metadata = data.Metadata
attachment.IsMature = data.IsMature attachment.IsMature = data.IsMature
if attachment, err := services.UpdateAttachment(attachment); err != nil { if attachment, err := services.UpdateAttachment(attachment); err != nil {