AmplicaLabs / social-app-template

Social Application Template that uses Gateway Services
Apache License 2.0
0 stars 2 forks source link

Gateway-Backend: Connect Content Publishing Service For Uploading Assets #2

Closed enddynayn closed 3 months ago

enddynayn commented 3 months ago

Description Add Assets endpoint using content Publishing service. This in preparation of breaking up broadcasting a message consisting of two steps. The first step the client uploads the assets and attaching the asset identifiers from the response to a new broadcast message endpoint.

Note that this is only adding the upload asset endpoint.

Acceptance Criteria

Architecture

Image

Open API specs

{
  "/v2/assets": {
    "post": {
      "operationId": "postAssetsHandler",
      "summary": "Upload assets",
      "requestBody": {
        "required": true,
        "content": {
          "multipart/form-data": {
            "schema": {
              "$ref": "#/components/schemas/UploadAssetRequest"
            }
          }
        }
      },
      "responses": {
        "202": {
          "description": "Successful response",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UploadAssetResponse"
              }
            }
          }
        }
      }
    }
  }
}
{
  "components": {
    "schemas": {
      "UploadAssetRequest": {
        "type": "object",
        "properties": {
          "files": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "binary"
            }
          }
        },
        "required": [
          "files"
        ]
      },
      "UploadAssetResponse": {
        "type": "object",
        "properties": {
          "assetIds": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        "required": [
          "assetIds"
        ]
      }
    }
  }
}