Skip to content

Commit b56a58d

Browse files
committed
merging
2 parents f3ae1ec + 5fb8d0f commit b56a58d

File tree

14 files changed

+1674
-670
lines changed

14 files changed

+1674
-670
lines changed

README.md

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Work Microservice
1+
# Review Microservice
22
A microservice for generic units of work (e.g., a challenge)
33

44
## Getting Started
@@ -8,7 +8,7 @@ This microservice is using [dropwizard](dropwizard.io) as the REST API framework
88
We are using Maven 2 to build and building is as simple as `mvn package`. *Make sure you are using Java 8 for build and runtime*
99

1010
### Configuration
11-
Configuration is managed through a yaml file. The `src/main/resources/work-service.yaml` file should contain the necessary configuration for you to run locally.
11+
Configuration is managed through a yaml file. The `src/main/resources/review-service.yaml` file should contain the necessary configuration for you to run locally.
1212

1313
### Framework Stack
1414
- dropwizard-core - core REST API
@@ -22,30 +22,28 @@ Configuration is managed through a yaml file. The `src/main/resources/work-servi
2222
### Database
2323
We are using mysql RDS for the database. For development use, connect to the topcoder-dev instance. Database access should be limited to the DAO layer. We are using the [JDBI](http://jdbi.org/) framework for database access. Where possible we should use the [SQL Objects API](http://jdbi.org/sql_object_overview/) approach listed in the JDBI documentation.
2424

25-
For this service, the DAO is managed by `WorkItemDAO`
25+
For this service, the DAO is managed by `ReviewDAO`
2626

2727
**We need to keep the data model clean and name properties of our representation (model) objects as the column names so we can use the automatic bean mapping facilities instead of needing to manually wire things together. Any deviation requires prior approval.**
2828

2929
### API Endpoint
30-
The API endpoint for this service is `com.appirio.service.work.resources.WorkItemResource` It contains the specific resource paths supported by this service. The root of the service is /v3/workitem. API methods should be annotated with the appropriate jax-rs annotations and the `@Timed` annotation for metrics. An example method is shown below.
30+
The API endpoint for this service is `com.appirio.service.review.resources.ReviewResource` It contains the specific resource paths supported by this service. The root of the service is /v3/reviews. API methods should be annotated with the appropriate jax-rs annotations and the `@Timed` annotation for metrics. An example method is shown below.
3131
```
3232
@GET
3333
@Timed
34-
@Path("{id}")
35-
public WorkItem getWorkItemById(@Auth TCAuth auth, @PathParam("id") LongParam id) {
36-
logger.debug("get work item for id {}", id);
34+
public ApiResponse getReviews(@Auth AuthUser auth,
35+
@APIQueryParam(repClass = Review.class) QueryParameter queryParameter)
36+
logger.debug("getReviews, filter : " + queryParameter.getFilter().getFields());
3737
38-
WorkItem wi = dao.findWorkItemById(id.get());
39-
return wi;
38+
return MetadataApiResponseFactory.createResponse(reviewManager.getReviews(auth, queryParameter,
39+
new BaseAuthorizationContext(auth)));
4040
}
4141
```
4242

4343
Note the `TCAuth` parameter provided by the `ServiceAuthenticator` class will provide user auth information and is a required parameterfor all secured API calls.
44+
You must set up `TC_JWT_KEY` environment variable, the sample value is `4WvoZLWhFPZ5jauw2+XCU+p772S4oBN25tNPyjHR`.
4445

4546
### Testing
4647
All API endpoint methods should have unit tests. For this service we are following the dropwizard testing recommendations as described [here](http://dropwizard.io/manual/testing.html)
4748

4849
For manual API testing, the [postman chrome app](https://chrome.google.com/webstore/detail/postman-rest-client/fdmmgilgnpjigdojojpjoooidkmcomcm?hl=en) is useful.
49-
50-
### Healthcheck
51-
This service has a healhcheck service located at `com.appirio.service.work.health.ServiceHealthCheck`. If any new dependent services are added, the healthcheck service should be updated to test its availability in order to determine if this service is healthy. This is important for application monitoring and failover.

0 commit comments

Comments
 (0)