Stores all purchases made on the website.
All requests to this service must:
- have an userID cookie
- have an authToken cookie
The session must be validated with the Auth service before doing anything.
{
"ID": string,
"products": [Product],
"created-at": time,
"userID": string,
}
Fetches purchases from an specific user by it's ID.
Stores a new purchase in the database.
Deletes a purchase from the database.
Deals with all products displayed on the products page of the website.
All requests to this service must:
- have an userID cookie
- have an authToken cookie
The session must be validated with the Auth service before doing anything.
{
"ID": string,
"name": string,
"price": float,
"category": string,
"description": string,
"pic_url": string,
}
Fetches all products from the database.
Stores a new product in the database.
Deletes a product from the database.
Mainly takes care of user signup and login.
{
"ID": string,
"name": string,
"password": string,
}
Stores a new account in the database. Used for signup
Checks if an account with matching name and password exists on the database.
Used for login.
The value of ID in the object will be null.
Deletes an account from the database.
Used to delete the account that is logged in.
Requests must have:
- A valid token in the authToken cookie.
- An ID in the userID cookie that is the same as the account ID being deleted.
Used to guarantee authenticity for users.
Uses a Redis database to store 6 characters long random string as key and the accountID as value.
{
"authToken": string,
"accountID": string,
}
Generates a 6 characters long random string and stores it as key on a key-value database with the accountID as value.
Used on login.
authToken on request token object is null.
Checks if the token is currently on the database and the accountID is the same.
Checks that the accountID matches and then deletes the token from the database.