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

MoSCoWRequirements
MUSTPoints messages to the correct lambda
MUSTFor each call will validate the user’s token for userID by checking if:
a. userID is in userTokenCache
b. the token matches the token in userTokenCache

TripMgr - Lambda

MoSCoWRequirements
MUSTGET trips

General:
- Return most recent start date

Specify location:
- Return only trips with that location

Specify start_date:
- Return trips from a certain start_date

Specify adminID:
- Return trips that have that adminID
MUSTUPDATE
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
MUSTUPDATE
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_trips

Denied flow:
- Delete the tripID from the trips_awaiting_approval or approved_trips
- Delete the userID from awaiting_approval or approved
MUSTUPDATE
If the user decides to not go:
- Delete the userID from awaiting_approval
- Delete the tripID from the user
MUSTCREATE
If user wants to make a trip they must specify:
- start_date
- end_date
- location
- title
- description

The 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
- description

The user row will also get the tripID appended to admin_trips
MUSTDELETE
If a user wants to delete a trip:

The request must specify:
- tripID

Requirements:
- The requesters userID must match the adminID

Action:
- 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
SHOULDIf any request fails the original message should be added to the DLQ

AccountMgr - Lambda

MoSCoWRequirements
MUSTCREATE
A user must be able to sign up, for an account they must specify:
- email
- password
SHOULDUPDATE
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)
SHOULDDELETE
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
MUSTSIGN-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)
SHOULDIf any request fails the original message should be added to the DLQ

WeatherMgr - Within the ECS

MoSCoWRequirements
MUSTGET
If the user requests for the weather:
1. Check if the weather for that location and date is in weatherCache
a. If it exists return the data else
b. call the OpenWeatherMap API
SHOULDIf any request fails the original message should be added to the DLQ

ImageMgr - Within the ECS

MoSCoWRequirements
MUSTIf the user requests for an image:
1. Check if the image for that location is in imageCache
a. If it exists return the data else
b. call the Google places API