Register
Submit a solution
The challenge is finished.

Challenge Overview

For this challenge, we'd like to add a new endpoint for retrieving files related to the given submission id.


Functional Requirements

Endpoint

GET /v3/submissions/:submissionId/files

- It should support filtering by type


add support to the submission service to fetch submissions by filter. The Core library provides functionality to translate filter query params into java objects, for example:

    @GET
    @Timed
    public ApiResponse searchChallengesOfUser(@PathParam("handle") String handle, @APIQueryParam(repClass = Challenge.class) QueryParameter query) {
        try {
            logger.debug("searchChallengesOfUser");
            QueryParameter augmentedQueryParam = query;
            augmentedQueryParam.getFilter().put("userHandles", handle.toLowerCase());

            return MetadataApiResponseFactory.createResponse(challengeManager.searchUserChallenges(augmentedQueryParam));

        } catch (Exception e) {
            return ErrorHandler.handle(e, logger);
        }
    }

?filter=type%3D{TYPES}

The above should return only submission files that are tied to given TYPES list.

- for each submission retrieved we need to refresh the pre-signed URL from the file service before retrieving, so that the pre signed url is valid when the client receives it.
- a user token need to be passed when calling file service, making sure the user can access files for the given submission, otherwise, error should be return.
- You can reference the responses about List All Submissions API, the expected response should be similar as


{
"id": "-617961fc:14f2abcda80:-7e20",
"result": {
    "success": true,
    "status": 200,
    "metadata": null,
    "version": "v3",
    "content":{
        "files": [
            {
                "name": "submission.zip",
                "type": "SUBMISSION_ZIP",
                "mediaType": "application/octet-stream"
                "preSignedUrl": "https://bucket.s3.aws.com/submissions/2/submission.zip",
                "status": "PENDING",
                "uploadedAt": null
            }, {
                "name": "source.zip",
                "type": "SOURCE_ZIP",
                "mediaType": "application/octet-stream"
                "preSignedUrl": "https://bucket.s3.aws.com/submissions/2/source.zip",
                "status": "PENDING",
                "uploadedAt": null
            }, {
                "name": "cover.png",
                "type": "DESIGN_COVER",
                "mediaType": "image/png"
                "preSignedUrl": "https://bucket.s3.aws.com/submissions/2/cover.png",
                "status": "PENDING",
                "uploadedAt": null
            }
        ]
    }
}

Update API Doc
Please update the service/apiary.apib to reflect the new changes.

About Tests and Documentation
- Complete javadoc is required: All classes, methods and fields must have javadoc comments, any method with more than 7 lines must also have inline comments
- Test code coverage must not decrease, please properly add tests for the new added logic

About Submission System
To play with the whole submission system, you can follow https://github.com/appirio-tech/tc-common-tutorials/tree/master/submission-system,  The latest source code will be attached in forum.

Final Submission Guidelines

1. Code changes for implementing the requirements including documentation and tests
2. Test Data for verification
3. Verfication Steps

Review style

Final Review

Community Review Board

Approval

User Sign-Off

ID: 30054553