Wish Lists
Wish Lists Service File Structure
DirectorySNAPCASTER-BACKEND
Directoryservices
Directorywishlist
Directorysrc
Directoryconfig
- database.ts
- mongo.ts
- sesClient.ts
Directorycontrollers
- wishlistController.ts
- wishlistItemController.ts
- middleware
- authMiddleware.ts
Directoryroutes
- wishlistItemRoutes.ts
- wishlistRoutes.ts
Directoryservices
- sendEmailService.ts
- templates
Directorytypes
- types.d.ts
- types.ts
- server.ts
- .dockerignore
- .gitignore
- docker-entrypoint.sh
- Dockerfile
- nodemon.json
- package.json
- pnpm-lock.yaml
- tsconfig.json
- …
Wish List Routes
POST /create
This endpoint creates a user wishlist and assigns a wishlit id to a user id.
HTTP 201 Created
HTTP 400 Bad Request | Name is required
HTTP 401 Unauthorized | Unauthorized: User not identified
HTTP 500 Internal Server Error | Error creating wishlist
Create Parameters
Parameter | Type | Mandatory | Details |
---|---|---|---|
name | String | Mandatory | Name of the users wishlist |
PUT /update/:id
This endpoint creates updates a users wishlist name according the the wishlist ID.
HTTP 200 OK
HTTP 400 Bad Request | Wishlist ID and name are required
HTTP 404 Not Found | Wishlist not found or you do not have permission to update this wishlist
HTTP 500 Internal Server Error | Error updating wishlist
Update Parameters
Parameter | Type | Mandatory | Details |
---|---|---|---|
name | String | Mandatory | Name of the users wishlist to be renamed |
DELETE /delete/:id
Deletes Users Wishlist
HTTP 200 OK | Wishlist deleted successfully
HTTP 400 Bad Request | Wishlist ID is required
HTTP 500 Error deleting wishlist
GET /user
This endpoint returns a list User Objects
which are wishlists associated with a user for them to select from.
HTTP 200 OK
HTTP 401 Unauthorized User | Unauthorized: User not identified
HTTP 500 Internal Server Error | Error fetching wishlists
User Object
Property | Type | Details |
---|---|---|
id | Integer | The wishlist id |
user_id | Integer | The user id associated with the wishlist id |
name | String | The name of the wishlist |
created_at | String | The date and time the wishlist was created |
updated_at | String | The date and time the wishlist was last updated |
item_count | Integer | Number of items in the wishlist |
GET /view/:id
This endpoint loads a Wishlist Object
that contains information based off the wishlist id.
HTTP 200 OK
HTTP 400 Bad Request | Wishlist ID is required
HTTP 404 Not Found | Wishlist not found
HTTP 500 Internal Server Error| Error fetching wishlist
Wishlist Object
Property | Type | Details |
---|---|---|
wishlist_id | Integer | The wishlist id |
name | String | The name of the wishlist |
created_at | String | The date and time the wishlist was created |
updated_at | String | The date and time the wishlist was last updated |
item_count | Integer | Number of items in the wishlist |
items | List[wishlistItems] | A List of card objects containing information such as price, condition, name, etc. |
POST /:id /bulk
The endpoint that allows the user to bulk edit their wishlists in a single text box.
HTTP 201 Created | Wishlist items created successfully
HTTP 400 Bad Request | message: Maximum of 100 card names allowed. ,success: false
HTTP 404 Not Found | [missingCardNames]
HTTP 500 Internal Server Error | Error creating wishlist items
Bulk Update Parameters
Parameter | Type | Mandatory | Details |
---|---|---|---|
cardNames | List[String] | Mandatory | Cards to be added to a wishlist using the format: [#] [card name] |
Wish List Item Routes
POST /wishlist-item/create
This endpoint creates an individual card entry in the users wishlist.
HTTP 201 Created
HTTP 400 Bad Request | message: Maximum of 100 card names allowed. ,success: false
HTTP 500 Internal Server Error | Error creating wishlist items
Wish List Item Create Parameters
Parameter | Type | Mandatory | Details |
---|---|---|---|
minimum_condition | String | Mandatory | The minimum condition of the card (Default: NM) |
oracle_id | String | Mandatory | The cards MTGJSON OracleID string |
quantity | Integer | Mandatory | Card quantity count (Default: 1) |
wishlist_id | Integer | Mandatory | The wishlist ID we are adding the card into |
POST /wishlist-item/update/:id
This endpoint updates a card entries parameters in the users wishlist.
HTTP 200 OK
HTTP 400 Bad Request | No valid fields to update
HTTP 404 Not Found | Wishlist item not found
HTTP 500 Internal Server Error | Error updating wishlist item
Wish List Item Update Parameters
Parameter | Type | Mandatory | Details |
---|---|---|---|
quantity | Integer | Mandatory | The quantity of the specific card the user wants |
minimum_condition | String | Mandatory | The lowest acceptable condition grade the user is willing to accept |
DELETE /wishlist-item/delete/:id
This endpoint deletes an individual card from a users wishlist.
HTTP 200 OK | Wishlist item deleted successfully
HTTP 400 Bad Request | Item ID is required
HTTP 404 Not Found | Wishlist item not found
HTTP 500 Internal Server Error | Error deleting wishlist item