Challenge Overview
Project Overview
In this project, we want to build the RESTful API to be used by TopCoder Direct and other TopCoder applications. The API will mainly focus on management of challenge like creating draft challenge, updating challenge, getting a list of active challenges etc. and management of direct project like creating new project, updating a project, getting project challenges.
The project will based on Java 6 and use Spring 3.2 framework.
Competition Task Overview
Refactor
The completed direct api assembly implements the my created challenges api.
In this challenge, we should refactor the existing code to use tech-core (https://github.com/cloudspokes/tech-core).
You should check out this project, use maven to compile and package it and then add tech-core as dependency to the pom.xml of direct api code.
We will use the ApiController of tech-core project to handle all api requests, it will auto lookup all "service" classes in the classpath.
So the controllers and services in existing code should be merged into tech-core service.
Here is a sample: https://github.com/cloudspokes/tech-core/tree/master/tech.core/tech.core.sample.basic
My challenges api just query the data so it should implement RESTQueryService
And we should need to implement the related classes to the challenges. (e.g. model class)
Please follow the below defenation to build the model classes from scratch. many models are not needed now (e.g. RESTResult)
Challenge extends AbstractIdResource:
- id:Integer
- challengeName:String
- challengeType:String
- clientName:String
- clientId:Integer
- billingName:String
- billingId:Integer
- directProjectName:String
- directProjectId:Integer
- challengeTechnologies:List<String>
- challengePlatforms:List<String>
- challengeStartDate:String
- challengeEndDate:String
- memberPrize:MemberPrize
- drPoints:Double
- reviewCost:Double
- challengeFee:Double
MemberPrize: (similar to the MemberCostData in existing code)
- prizes:List<Prize>
- checkPointPrizes:List<Prize>
- totalPrize:Double
- drPoints:Double
- reliabilityBonus:Double
Prize extends AbstractIdResource: (similar to the MemberPrize in existing code)
- id:Integer
- placement:Integer
- numberOfPrize:Integer
- prizeAmount:Double
- prizeType:Integer
- challengeId:Integer
Security
The tech-core doesn't implement security features yet.
Let's refactor the existing security related code to a security utility to authenticate the user.
API Standard
This standard needs to be followed for all direct apis.
My Challenges API
The my challenges api should return all challenges the caller has access. Here is a query for reference: https://coder.topcoder.com/internal/database/scripts/trunk/tcs_catalog/query_tool/query_direct_project_stat_v2.txt
It's the logic of this api and we should remove the TC staff part.
The my created challenges api can be merged into this api with a new filter - creator. If the creator filter exists, it must be caller's handle, otherwise return an error message. When creator filter exists, you can use p.creator_id = user_id instead of project_id in (....).
The response format is same to the my created challenges api.
The my challenges api doesn't need to support filters now(when createor filter exists, we should still have same filters as the existing code).
Integration Test
Integration test should be provided. You can find the example in https://github.com/cloudspokes/tech-core/tree/master/tech.core/tech.core.sample.basic/src/test
Environment Setup
The tomcat should be setup in your local environment for development, for the informix database, you can either setup the informix 11.5 database at your local environment or request a VM to use the informix database on VM remotely.
VM Environment:
If You need a TopCoder VM which has informix database setup to work on this challenge, please request the VM in the challenge forum.
Information about VM can be found below:
VM specific information is found here: http://www.topcoder.com/wiki/display/docs/VM+Image+2.5. Upon registration as a submitter or reviewer you will need to request a VM based on the new TopCoder image. To request your image, please use the forum. Before requesting your VM, you need to ensure that you have an SSH key created and in your member profile. Instructions to do so are here: http://www.topcoder.com/wiki/display/projects/Generate+SSH+Key, and instructions to connect afterwards are here: http://www.topcoder.com/wiki/display/projects/Connect+Using+SSH+Key.
Final Submission Guidelines
- Deployment Guide with the details on setup the local development environment
- Source Code
- Test Data