ProjectLibertyLabs / social-app-template

Social Application Template that uses Gateway Services
Apache License 2.0
1 stars 4 forks source link

Implement Endpoint to Edit Post #18

Closed enddynayn closed 7 months ago

enddynayn commented 7 months ago

Description We need to implement a new PUT endpoint to allow to editing content of a specific post. This allows users to update their post without creating a new one,

Acceptance Criteria

Technical Specs Endpoint: PUT /v1/content/{type}/{contentHash} Authentication: Required (tokenAuth) Parameters:

Request Body: Must match the EditPostRequest schema, requiring targetContentHash, targetAnnouncementType, and content.

Responses:

Open API Snippet

{
"/v1/content/{type}/{contentHash}": {
"put": {
"operationId": "editContent",
"security": [
{
"tokenAuth": []
}
],
"summary": "Edit the content of a specific post",
"parameters": [
{
"name": "contentHash",
"in": "path",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "type",
"description": "Broadcast or Reply",
"in": "path",
"required": true,
"schema": {
"type": "string"
}
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/EditPostRequest"
}
}
}
},
"responses": {
"200": {
"description": "Successful response",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/BroadcastExtended"
}
}
}
},
"401": {
"$ref": "#/components/responses/UnauthorizedError"
}
}
}
}
}
{
"components": {
"schemas": {
"EditPostRequest": {
"type": "object",
"properties": {
"targetContentHash": {
"type": "string"
},
"targetAnnouncementType": {
"type": "integer"
},
"content": {
"type": "string"
}
},
"required": [
"content",
"targetAnnouncementType",
"targetContentHash"
]
}
}
}
}