Challenge Overview
For this challenge, we'd like to improve the List All Submissions API (GET /submissions/) in Submission Microservice.
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);
}
}
We want to support 2 filters that should work individually or together:
?filter=reference.id%3D{CHALLENGE_ID}
The above should return only submissions that are tied to a given challenge id, based on the id field of the reference field of the submission.
?filter=status%3D{STATUS}
The above should only return submissions that are in the specified status based on the status field of the submission.
?filter=reference.id%3D{CHALLENGE_ID}%26status%3D{STATUS}
The above should return all submissions tied to a specific challenge that are in a specific status.
For the filters, we need the queries to be indexed to speed up the fetching of the results. Please provide DDL statements to create the appropriate indexes. If indexing of json fields is not possible, or may cause performance issues, please suggest an alternate approach such as denormalizing the data.
Pagination Support
Using the limit and offset parameters.
Also, we need to make sure that we return at most 50 items. If no limit is specified return 10 by default, if the user specifies a limit greater than 50, return only 50 items.
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.
2. Test Data for verification
3. Verfication Steps
Functional Requirements
Filtering Submission By Status And Referenceadd 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);
}
}
We want to support 2 filters that should work individually or together:
?filter=reference.id%3D{CHALLENGE_ID}
The above should return only submissions that are tied to a given challenge id, based on the id field of the reference field of the submission.
?filter=status%3D{STATUS}
The above should only return submissions that are in the specified status based on the status field of the submission.
?filter=reference.id%3D{CHALLENGE_ID}%26status%3D{STATUS}
The above should return all submissions tied to a specific challenge that are in a specific status.
For the filters, we need the queries to be indexed to speed up the fetching of the results. Please provide DDL statements to create the appropriate indexes. If indexing of json fields is not possible, or may cause performance issues, please suggest an alternate approach such as denormalizing the data.
Pagination Support
Using the limit and offset parameters.
Also, we need to make sure that we return at most 50 items. If no limit is specified return 10 by default, if the user specifies a limit greater than 50, return only 50 items.
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 tests2. Test Data for verification
3. Verfication Steps