Client
GET /client/{id}
- Description: This endpoint retrieves the client that matches the specified
clientId
. - Sample request:
http://localhost:8083/client/9f26fbec-a289-48cb-a569-04e39f6b187f
POST /client/
- Description: This endpoint receives the client data for a new client to be created and returns the
added client item plus the DynamoDB auto-generated
clientId
andaccessToken
on successful operation. - Sample request:
http://localhost:8083/client
- Sample request body:
{
"clientname": "newClient",
"email": "[email protected]",
"accountSetting": {
"isPrivate": true,
"isAdult": true
}
}
PUT /client/{id}
- Description: This endpoint updates the client data for an existing client with
clientId
equal toid
. - Sample request:
http://localhost:8083/client/9f26fbec-a289-48cb-a569-04e39f6b187f
- Sample request body:
{
"clientname": "newClient",
"email": "[email protected]",
"accountSetting": {
"isPrivate": true,
"isAdult": true
}
}
DELETE /client/{id}
- Description: This endpoint deletes the client data for an existing client with
clientId
equal toid
. (Requied a header that has"Authorization"
as key and clientaccessToken
as value). - Sample request:
http://localhost:8083/client/9f26fbec-a289-48cb-a569-04e39f6b187f
Timeline
GET /timeline/client/{clientId}
- Description: This endpoint retrieves the timeline for the client whose
clientId
matches the givenclientId
. - Sample request:
http://localhost:8083/timeline/client/9f26fbec-a289-48cb-a569-04e39f6b187f
GET /timeline/media/{mediaId}
- Description: This endpoint retrieves the timeline for the media whose
mediaId
matches the givenmediaId
. - Sample request:
http://localhost:8083/timeline/media/tt0000001
GET /timeline/{clientId}/{mediaId}
- Description: This endpoint retrieves the timeline for the media whose
mediaId
matches the givenmediaId
as well as the client whoseclientId
matchedclientId
. - Sample request:
http://localhost:8083/timeline/9f26fbec-a289-48cb-a569-04e39f6b187f/tt0000001
POST /timeline/
- Description: This endpoint receives the timeline data for a new timeline to be created. (Requied a
header that has
"Authorization"
as key and clientaccessToken
as value) - Sample request:
http://localhost:8083/timeline
- Sample request body:
{
"timelineId": "9c84d4c4-609e-4db3-b95d-976673985e23-tt0000001",
"clientId": "9c84d4c4-609e-4db3-b95d-976673985e23",
"mediaId": "tt0000001",
"status": "DONE",
"rating": 1,
"comment": "it was horrible"
}
DELETE /timeline/{clientId}/{mediaId}
- Description: This endpoint deletes the timeline data for an existing timeline with client with
specified
clientId
andmediaId
. (Requied a header that has"Authorization"
as key and clientaccessToken
as value) - Sample request:
http://localhost:8083/timeline/9f26fbec-a289-48cb-a569-04e39f6b187f/tt0000001
All the functional-ready endpoints are end-to-end tested in the following tests
in ImdbPlusApplicationTests.java
file. Please clone the project and load it in IntelliJ IDEA.
To run all the tests in IntelliJ IDEA: Replace the empty string in DynamoDBConfig.java
with your
access key and secret key. Then run the main method in ImdbPlusApplication.java
file. Then run the
test file ImdbPlusApplicationTests.java
.
testClientSave()
tests the clientPOST
save endpoint with a single test client. The expected result is that the test client is added to the database.testClientSaveDuplicatedClientname()
tests the client savePOST
endpoint with duplicate clientnames. The expected behavior is that the second test client with the same clientname should not be added to the database.testTimelineSave()
tests the timelinePOST
save endpoint with a single test client and a single test timeline. The expected behavior is that the test timeline is added to the database.testTimelineGetByClientId()
tests the timelineGET
endpoint with a single test client and multiple test timelines. The expected behavior is that all test timelines can be retrieved from the database byclientId
.testTimelineGetByMediaId()
tests the timelineGET
endpoint with multiple test clients add timelines for the same media (mediaId
). For example,client1
adds a timeline formediaId
tt0000001
, andclient2
also adds a timeline formediaId
tt0000001
. The expected behavior is that both test timelines can be retrieved from the database bymediaId
.testTimelineGetTimelineByClientIdAndMediaId()
tests the timelineGET
endpoint that retrieves a single timeline item by aclientId
and amediaId
.
Test Configuration:
- Firmware version: Spring Boot 2.7.5
- Hardware: Apple M1 Pro
- Toolchain: IntelliJ IDEA
- SDK: JDK 11 OpenJDK
- Database: Amazon DynamoDB
- Style checker: Google Java Style Guide ( using CheckStyle-IDEA plugin): previous style check run result screenshots can be found here and here
- Test framework: JUnit Vintage Engine