Skip to content

Commit

Permalink
Updated the readmMe and the Integration Tests and the PostMan Collection
Browse files Browse the repository at this point in the history
  • Loading branch information
RoryConnollyLIT committed Aug 7, 2019
1 parent ac2b4cc commit 420cf09
Show file tree
Hide file tree
Showing 3 changed files with 218 additions and 129 deletions.
73 changes: 41 additions & 32 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ npm run test
### Helpful Links
* [Swagger Documentation](http://ec2-52-91-239-59.compute-1.amazonaws.com:3000/swag-docs)
* [GitHub Repository](https://github.com/RoryConnolly/DogCollarService)
* [Post Man Collection](./documentation/DogCollar.postmanCollection.json)
* [Post Man Collection](./documentation/DogCollarRequests.postman_collection.json)

-----

Expand All @@ -50,20 +50,21 @@ Each of the different functions of the service is accessed by adding

Followed by routes such as:

/fetch/all
/fetch/allByPartitionKey
/fetch/ByPartitionAndSortKeys
/fetch/ByPartitionAndActivity
/remove
/pushCollarData

/fetch/all
/fetch/allByPartitionKey
/fetch/allByActivityType
/fetch/ByPartitionAndActivity
/fetch/ByPartitionAndSortKeys
/remove
/pushCollarData

The following routes also require query parameters such as

/fetch/allByPartitionKey?partitionKey=abc3
/fetch/ByPartitionAndSortKeys?partitionKey=abc1&sortKey=1
/fetch/ByPartitionAndActivity?barking=low
/remove?partitionKey=abc3&sortKey=11
/fetch/allByPartitionKey?partitionKey=12345-12345-1ab2cd3
/fetch/allByActivityType?activityType=PHYSICAL_ACTIVITY
/fetch/ByPartitionAndActivity?partitionKey=54668-30073-6ad9de2&activityType=BARK
/fetch/ByPartitionAndSortKeys?partitionKey=54668-30073-6ad9de2&sortKey=1565105507274_BARK
/remove?partitionKey=54668-30073-6ad9de2&sortKey=1565105507274_LOCATION

The following route requires a request object:

Expand All @@ -72,21 +73,22 @@ Followed by routes such as:

Example request object:

{
activity: "medium",
location: "90210",
barking: "low",
dogName: "Dash",
sortKey: "1",
partitionKey: "abc1"
}
{
"partitionKey": "12345-12345-1ab2cd3",
"activityType": "LOCATION",
"actionData": {
"location": {
"lat": "11.17",
"long": "90.33"
}
}
}

## Example Endpoints

http://ec2-52-91-239-59.compute-1.amazonaws.com:3000/api/fetch/ByPartitionAndSortKeys?partitionKey=abc1&sortKey=1

http://ec2-52-91-239-59.compute-1.amazonaws.com:3000/api/fetch/ByPartitionAndActivity?barking=low
http://ec2-52-91-239-59.compute-1.amazonaws.com:3000/api/fetch/ByPartitionAndSortKeys?partitionKey=54668-30073-6ad9de2&sortKey=1565105507274_BARK

http://ec2-52-91-239-59.compute-1.amazonaws.com:3000/api/fetch/ByPartitionAndActivity?partitionKey=54668-30073-6ad9de2&activityType=BARK



Expand All @@ -97,7 +99,7 @@ The service can be run locally by cloning this repo and installing the AWS CLI a
```bash
aws configure
```
You will be prompted for Region (us-east-1), AWS access key and AWS secret access key. These are for accessing the DynamoDb (please contact the repo owner for these).
You will be prompted for Region (us-east-1), AWS access key and AWS secret access key. These are for accessing the DynamoDb (please contact the repo owner for these).
Then in your terminal window run:

```bash
Expand All @@ -116,30 +118,37 @@ http://localhost:3000/api/fetch/all
Returns all the dog collar responses in database
Caution - may cause performance issues if database is large

http://localhost:3000/api/fetch/allByPartitionKey?partitionKey=abc3
http://localhost:3000/api/fetch/allByPartitionKey?partitionKey=12345-12345-1ab2cd3

Returns all responses associated with a specific collar
Takes 'partitionKey' as a query param

http://localhost:3000/api/fetch/ByPartitionAndActivity?barking=low
http://localhost:3000/api/fetch/ByPartitionAndActivity?partitionKey=54668-30073-6ad9de2&activityType=BARK

Returns all responses with a specific level of barking
Takes 'barking' as a query param
Returns all responses with a specific partition key and activity type
Takes 'partitionKey' and 'activityType' as a query param


http://localhost:3000/api/fetch/ByPartitionAndSortKeys?partitionKey=abc1&sortKey=1
http://localhost:3000/api/fetch/ByPartitionAndSortKeys?partitionKey=54668-30073-6ad9de2&sortKey=1565105507274_BARK

Returns a specific collar responses
Takes 'partitionKey' and 'sortKey' as query params

http://localhost:3000/api/remove?partitionKey=abc3&sortKey=11

http://localhost:3000/api/fetch/allByActivityType?activityType=BARK

Returns all collar responses with the specified activity type
Takes 'activityType' as query params

http://localhost:3000/api/remove?partitionKey=12345-12345-1ab2cd3&sortKey=7530742165588_BARK


Removes a specific collar repsonses from the database
Takes 'partitionKey' and 'sortKey' as query params

http://localhost:3000/api/pushCollarData

Returns a specific collar responses
Takes 'partitionKey' and 'sortKey' as query params(this one requires a request object - see example above)
Posts a collar response to the db.
Requires a request object - see example above


Loading

0 comments on commit 420cf09

Please sign in to comment.