Architecture


users - DynamoDB
"{userID}": { // partition key // Number
"email": "{users email}", // secondary index
"password": "*********", // should be hidden
"trips_awaiting_approval": [
"{tripID}",
],
"approved_trips": [
"{tripID}",
],
}trips - DynamoDB
"{tripID}": { // partition key // Number
"start_date": 05478968550, // sort key
"end_date": 86768156751,
"admin_id": "{userID}" // secondary index
"location": "london", // secondary index
"title": "text",
"description": "text",
"awaiting_approval": [
"{userID}"
], // must have a limit
"approved": [
"{userID}"
], // must have a limit
}
Tasks of each service
FastAPI - ECS
| MoSCoW | Requirements |
|---|---|
| MUST | Points messages to the correct lambda |
| MUST | For each call will validate the user’s token for userID by checking if:a. userID is in userTokenCacheb. the token matches the token in userTokenCache |
TripMgr - Lambda
| MoSCoW | Requirements |
|---|---|
| MUST | GET trips General: - Return most recent start date Specify location:- Return only trips with that locationSpecify start_date:- Return trips from a certain start_dateSpecify adminID:- Return trips that have that adminID |
| MUST | UPDATE If user wants to go on a trip it must: - add their userID to the awaiting_approval column in the trip entry- it must also add the tripID to the trips_awaiting_approval in the user entry |
| MUST | UPDATE The admin must beadle to approve or disapprove of users attempting to go on the trip: Approval flow: - Update trip by moving the userID from awaiting_approval to approved- Update user by moving the tripID from trips_awaiting_approval to approved_tripsDenied flow: - Delete the tripID from the trips_awaiting_approval or approved_trips- Delete the userID from awaiting_approval or approved |
| MUST | UPDATE If the user decides to not go: - Delete the userID from awaiting_approval- Delete the tripID from the user |
| MUST | CREATE If user wants to make a trip they must specify: - start_date- end_date- location- title- descriptionThe trip will be added to master with the following attributes:- adminID - the userID of the creator- awaiting_approval - set to an empty array- approved - set to an empty array- start_date- end_date- location- title- descriptionThe user row will also get the tripID appended to admin_trips |
| MUST | DELETE If a user wants to delete a trip: The request must specify: - tripIDRequirements: - The requesters userID must match the adminIDAction: - All the users that are mentioned in awaiting_approval & approved must get the trip removed from theres respective lists- The adminID must get the tripID removed from admin_trips |
| SHOULD | If any request fails the original message should be added to the DLQ |
AccountMgr - Lambda
| MoSCoW | Requirements |
|---|---|
| MUST | CREATE A user must be able to sign up, for an account they must specify: - email- password |
| SHOULD | UPDATE A user should be able to update there password: - they would enter their current password and a new one, this will then update the users password- the cached token for the user sign-in must then be removed from userTokenCache (stored on ECS) |
| SHOULD | DELETE A user should be able to delete their account: - For each tripID in awaiting_approval & approved the userID must be removed- Call Delete on TripMgr for all tripIDs in admin_trips |
| MUST | SIGN-IN If A user wants to sign in: - Must return a token for the user to use as a access token- Must add that token to the userTokenCache (stored on ECS) |
| SHOULD | If any request fails the original message should be added to the DLQ |
WeatherMgr - Within the ECS
| MoSCoW | Requirements |
|---|---|
| MUST | GET If the user requests for the weather: 1. Check if the weather for that location and date is in weatherCachea. If it exists return the data else b. call the OpenWeatherMap API |
| SHOULD | If any request fails the original message should be added to the DLQ |
ImageMgr - Within the ECS
| MoSCoW | Requirements |
|---|---|
| MUST | If the user requests for an image: 1. Check if the image for that location is in imageCachea. If it exists return the data else b. call the Google places API |