Skip to content

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.

  1. HTTP 201 Created
  2. HTTP 400 Bad Request | Name is required
  3. HTTP 401 Unauthorized | Unauthorized: User not identified
  4. HTTP 500 Internal Server Error | Error creating wishlist

Create Parameters

ParameterTypeMandatoryDetails
nameStringMandatoryName of the users wishlist

PUT /update/:id

This endpoint creates updates a users wishlist name according the the wishlist ID.

  1. HTTP 200 OK
  2. HTTP 400 Bad Request | Wishlist ID and name are required
  3. HTTP 404 Not Found | Wishlist not found or you do not have permission to update this wishlist
  4. HTTP 500 Internal Server Error | Error updating wishlist

Update Parameters

ParameterTypeMandatoryDetails
nameStringMandatoryName of the users wishlist to be renamed

DELETE /delete/:id

Deletes Users Wishlist

  1. HTTP 200 OK | Wishlist deleted successfully
  2. HTTP 400 Bad Request | Wishlist ID is required
  3. 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.

  1. HTTP 200 OK
  2. HTTP 401 Unauthorized User | Unauthorized: User not identified
  3. HTTP 500 Internal Server Error | Error fetching wishlists

User Object

PropertyTypeDetails
idIntegerThe wishlist id
user_idIntegerThe user id associated with the wishlist id
nameStringThe name of the wishlist
created_atStringThe date and time the wishlist was created
updated_atStringThe date and time the wishlist was last updated
item_countIntegerNumber of items in the wishlist

GET /view/:id

This endpoint loads a Wishlist Object that contains information based off the wishlist id.

  1. HTTP 200 OK
  2. HTTP 400 Bad Request | Wishlist ID is required
  3. HTTP 404 Not Found | Wishlist not found
  4. HTTP 500 Internal Server Error| Error fetching wishlist

Wishlist Object

PropertyTypeDetails
wishlist_idIntegerThe wishlist id
nameStringThe name of the wishlist
created_atStringThe date and time the wishlist was created
updated_atStringThe date and time the wishlist was last updated
item_countIntegerNumber of items in the wishlist
itemsList[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.

  1. HTTP 201 Created | Wishlist items created successfully
  2. HTTP 400 Bad Request | message: Maximum of 100 card names allowed. ,success: false
  3. HTTP 404 Not Found | [missingCardNames]
  4. HTTP 500 Internal Server Error | Error creating wishlist items

Bulk Update Parameters

ParameterTypeMandatoryDetails
cardNamesList[String]MandatoryCards 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.

  1. HTTP 201 Created
  2. HTTP 400 Bad Request | message: Maximum of 100 card names allowed. ,success: false
  3. HTTP 500 Internal Server Error | Error creating wishlist items

Wish List Item Create Parameters

ParameterTypeMandatoryDetails
minimum_conditionStringMandatoryThe minimum condition of the card (Default: NM)
oracle_idStringMandatoryThe cards MTGJSON OracleID string
quantityIntegerMandatoryCard quantity count (Default: 1)
wishlist_idIntegerMandatoryThe wishlist ID we are adding the card into

POST /wishlist-item/update/:id

This endpoint updates a card entries parameters in the users wishlist.

  1. HTTP 200 OK
  2. HTTP 400 Bad Request | No valid fields to update
  3. HTTP 404 Not Found | Wishlist item not found
  4. HTTP 500 Internal Server Error | Error updating wishlist item

Wish List Item Update Parameters

ParameterTypeMandatoryDetails
quantityIntegerMandatoryThe quantity of the specific card the user wants
minimum_conditionStringMandatoryThe 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.

  1. HTTP 200 OK | Wishlist item deleted successfully
  2. HTTP 400 Bad Request | Item ID is required
  3. HTTP 404 Not Found | Wishlist item not found
  4. HTTP 500 Internal Server Error | Error deleting wishlist item