TC Message Service - Update Attachment Endpoints

Key Information

Register
Submit
The challenge is finished.

Challenge Overview

In this challenge, we would like to make the following updates in the tc-message-service:

 
  • Replace the current implementation of the uploadImageHandler to upload attachments to S3 bucket instead of Discourse.

  • Uploading an attachment should also make an entry in database. Table does not exists right now but will be there when this challenge is merged into main branch. Schema of the new table is as follows:

id bigint

postId bigint

originalFileName varchar(512)

fileSize int

sha1 varchar(40)

url varchar(255) // Unsigned S3 resource URL

createdAt Date

createdBy varchar(255)

updatedAt Date

updatedBy varchar(255)

deletedAt Date

deletedBy varchar(255)

  • Create a GET /v4/topics/{topicId}/posts/{postId}/attachments/{id} endpoint to redirect response to the signed S3 object URL.

  • Create a DELETE /v4/topics/{topicId}/posts/{postId}/attachments/{id} endpoint to delete the uploaded attachment.

    • This operation should soft-delete the attachment and only the user who uploaded the attachment or if the user is an admin should be able to perform this action.

    • Admins should be able to pass an optional hardDelete query parameter to hard-delete the attachment.

  • Update/create tests to cover the updated/new functionality.

  • Update the /local/README.md document to cover the updates from this challenge.

Resources:

Feel free to ask on the challenge forum in case of any doubt or question.

 


Final Submission Guidelines

  • Git patch for the latest commit in dev branch.

  • [Optional] The whole project folder (in case your patch file is corrupted).

The winner will be asked to submit a Pull request if a patch file is not provided.

 

ELIGIBLE EVENTS:

2018 Topcoder(R) Open

REVIEW STYLE:

Final Review:

Community Review Board

Approval:

User Sign-Off

SHARE:

ID: 30063014