openapi: 3.0.1 info: title: All Things E-Store version: 1.0.0 description: An online store where you can buy ALMOST anything you can think of! paths: /api/v1/categories: summary: Category Management description: >- Endpoints related to retrieving and managing all categories withing the store's database. get: summary: Search and filter categories description: Retrieves categories from the store's database based on search criteria operationId: search_categories parameters: - in: query name: name schema: type: string description: Filter categories by name. Can be partial to return names that would be close. example: hats - in: query name: limit schema: type: integer description: The number of items to return. example: 25 - in: query name: offset schema: type: integer description: The number to offset for return items. Creates pagination. responses: "200": description: The list of categories was successfully retrieved. content: application/json: schema: type: array items: $ref: "#/components/schemas/Category" "400": description: The limit number must be greater than 1 content: application/json: schema: type: object properties: message: type: string description: error message example: Bad Request. Invalid limit number. Limit must be greater than 1 "404": description: No results were found. content: application/json: schema: type: object properties: message: type: string description: error message example: 'No results returned' "500": description: Server error content: application/json: schema: type: object properties: message: type: string description: error message example: 'Server error: ' tags: - Category post: summary: Add a category description: Adds a new category to the database operationId: add_category security: - bearerAuth: [] requestBody: description: The category to be created required: true content: application/json: schema: type: object required: - name - description properties: name: type: string description: type: string responses: "200": description: Category created content: application/json: schema: $ref: "#/components/schemas/Category" "500": description: Server error tags: - Category /api/v1/categories/{id}: summary: Retrieve a single category by ID description: Retrieves a single category from the database by given ID get: summary: Get a category description: This operation retrieves an object with the matching id operationId: get_category_id responses: "200": description: The category was successfully retrieved. content: application/json: schema: $ref: "#/components/schemas/Category" "404": description: No category found "500": description: Server error parameters: - name: id in: path description: The id of the category. required: true schema: type: string tags: - Category put: summary: Update a category description: Updates a category with the matching ID operationId: update_category security: - bearerAuth: [] requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/Category" responses: "200": description: The category was successfully updated. content: application/json: schema: $ref: "#/components/schemas/Category" "404": description: No category found "500": description: Server error tags: - Category delete: summary: Delete a category description: Deletes a category with the matching ID operationId: delete_category security: - bearerAuth: [] parameters: - name: id in: path schema: type: string required: true description: The id of the category. responses: "200": description: The category was deleted successfully "404": description: No category found "500": description: Server error tags: - Category /api/v1/products: summary: Product Management description: >- Endpoints related to retrieving and managing all products within the store's database. get: summary: Search and filter products description: Retrieves products from the store's database based on search criteria operationId: search_products parameters: - in: query name: categoryId schema: type: string description: Filter products by category ID - in: query name: name schema: type: string description: Search products by name - in: query name: minPrice schema: type: number format: float description: Filter products by minimum price - in: query name: maxPrice schema: type: number format: float description: Filter products by maximum price - in: query name: offset schema: type: integer description: The offset for pagination - in: query name: limit schema: type: integer description: The number of products per page responses: "200": description: The list of products was successfully retrieved content: application/json: schema: type: array items: $ref: "#/components/schemas/Product" "500": description: Server error tags: - Products post: summary: Add a product description: Adds a new product to the database operationId: add_product security: - bearerAuth: [] requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/Product" responses: "200": description: Product created content: application/json: schema: $ref: "#/components/schemas/Product" "500": description: Server error tags: - Products /api/v1/products/{id}: summary: Retrieve a single product by ID description: Retrieves a single product from the database by given ID get: summary: Get a product description: This operation retrieves an object with the matching id operationId: get_product_id responses: "200": description: The product was successfully retrieved. content: application/json: schema: $ref: "#/components/schemas/Product" "404": description: No product found "500": description: Server error parameters: - name: id in: path description: The id of the product. required: true schema: type: string tags: - Products put: summary: Update a product description: Updates a product with the matching ID operationId: update_product security: - bearerAuth: [] requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/Product" responses: "200": description: The product was successfully updated. content: application/json: schema: $ref: "#/components/schemas/Product" "404": description: No product found "500": description: Server error tags: - Products delete: summary: Delete a product description: Deletes a product with the matching ID operationId: delete_product security: - bearerAuth: [] parameters: - name: id in: path schema: type: string required: true description: The id of the product. responses: "200": description: The product was deleted successfully "404": description: No product found "500": description: Server error tags: - Products /api/v1/products/{productId}/variants: post: summary: Create a variant for a product description: Adds a new variant to a product operationId: create_variant security: - bearerAuth: [] requestBody: required: true content: application/json: schema: type: object properties: name: type: string price: type: number stock_quantity: type: integer responses: "200": description: Variant created "500": description: Server error tags: - Products /api/v1/products/{productId}/variants/{variantId}: put: summary: Update a variant description: Updates a variant of a product operationId: update_variant security: - bearerAuth: [] requestBody: required: true content: application/json: schema: type: object properties: name: type: string price: type: number stock_quantity: type: integer responses: "200": description: Variant updated "404": description: Variant not found "500": description: Server error tags: - Products delete: summary: Delete a variant description: Deletes a variant of a product operationId: delete_variant security: - bearerAuth: [] parameters: - name: variantId in: path schema: type: string required: true description: The id of the variant. responses: "200": description: Variant deleted "404": description: Variant not found "500": description: Server error tags: - Products /api/v1/user: summary: Endpoints for all user related requests /api/v1/user/{id}: summary: Allow the user to login. description: Endpoints relating to all user info. get: summary: Get a user description: This operation retrieves an object with the matching id operationId: get_user parameters: - in: path name: id schema: type: string description: The user's id. required: true security: - bearerAuth: [] responses: "200": description: The user was successfully retrieved. content: application/json: schema: $ref: "#/components/schemas/User" tags: - User delete: summary: Delete a user security: - bearerAuth: [] parameters: - in: path name: id schema: type: string required: true description: The user's id responses: "200": description: The user has been deleted tags: - User put: summary: Update a user description: This operation updates the user at the provided with the object within the request body. security: - bearerAuth: [] parameters: - in: path name: id schema: type: string required: true description: The user's id requestBody: content: application/json: schema: $ref: "#components/schemas/User" responses: "200": description: The user has been updated. content: application/json: schema: $ref: "#/components/schemas/User" tags: - User /api/v1/heros: get: summary: Get all heros description: Retrieves all heros (banners) from the database. operationId: get_all_heros responses: "200": description: A list of heros was successfully retrieved. content: application/json: schema: type: array items: $ref: "#/components/schemas/Hero" "404": description: No heros found. content: application/json: schema: type: object properties: message: type: string example: "No heros found." "500": description: Server error. content: application/json: schema: type: object properties: message: type: string example: "Server Error: " tags: - Heros post: summary: Create a new hero description: Adds a new hero (banner) to the database. operationId: create_hero requestBody: required: true content: application/json: schema: type: object required: - categoryId - productId - layout - heading properties: categoryId: type: integer description: The ID of the category associated with the hero. productId: type: integer description: The ID of the product associated with the hero. layout: type: integer description: The layout type of the hero. heading: type: string description: The main heading of the hero. subTitle1: type: string description: The first subtitle of the hero. subTitle2: type: string description: The second subtitle of the hero. backgroundColor: type: string description: The background color of the hero. textColor: type: string description: The text color of the hero. imageurl: type: string description: The URL of the hero's image. responses: "201": description: Hero created successfully. content: application/json: schema: $ref: "#/components/schemas/Hero" "400": description: Invalid request data. content: application/json: schema: type: object properties: message: type: string example: "Bad Request: Invalid data." "500": description: Server error. content: application/json: schema: type: object properties: message: type: string example: "Server Error: " tags: - Heros /api/v1/heros/{id}: put: summary: Update a hero description: Updates an existing hero (banner) in the database. operationId: update_hero parameters: - name: id in: path required: true schema: type: integer description: The ID of the hero to update. requestBody: required: true content: application/json: schema: type: object properties: categoryId: type: integer description: The ID of the category associated with the hero. productId: type: integer description: The ID of the product associated with the hero. layout: type: integer description: The layout type of the hero. heading: type: string description: The main heading of the hero. subTitle1: type: string description: The first subtitle of the hero. subTitle2: type: string description: The second subtitle of the hero. backgroundColor: type: string description: The background color of the hero. textColor: type: string description: The text color of the hero. imageurl: type: string description: The URL of the hero's image. responses: "200": description: Hero updated successfully. content: application/json: schema: $ref: "#/components/schemas/Hero" "404": description: Hero not found. content: application/json: schema: type: object properties: message: type: string example: "Hero not found." "500": description: Server error. content: application/json: schema: type: object properties: message: type: string example: "Server Error: " tags: - Heros delete: summary: Delete a hero description: Deletes an existing hero (banner) from the database. operationId: delete_hero parameters: - name: id in: path required: true schema: type: integer description: The ID of the hero to delete. responses: "200": description: Hero deleted successfully. content: application/json: schema: type: object properties: message: type: string example: "Hero deleted successfully." "404": description: Hero not found. content: application/json: schema: type: object properties: message: type: string example: "Hero not found." "500": description: Server error. content: application/json: schema: type: object properties: message: type: string example: "Server Error: " tags: - Heros /api/v1/discounts: summary: Discount Management description: >- Endpoints related to retrieving and managing all discounts within the store's database. get: summary: Search and filter discounts description: Retrieves discounts from the store's database based on search criteria. operationId: search_discounts parameters: - in: query name: limit schema: type: integer description: Maximum number of discounts to return. - in: query name: page schema: type: integer description: Page number for pagination. - in: query name: categoryId schema: type: integer description: Filter discounts by category ID. responses: '200': description: A list of discounts. content: application/json: schema: type: array items: $ref: '#/components/schemas/Discount' # Assuming you have a Discount schema defined '404': description: No discounts found. '500': description: Internal server error. security: - bearerAuth: [] tags: - Discounts post: summary: Add a discount description: Adds a new discount to the database. operationId: add_discount security: - bearerAuth: [] requestBody: content: application/json: schema: $ref: '#/components/schemas/Discount' # Assuming you have a Discount schema defined responses: '200': description: The created discount. '400': description: Invalid request object. '500': description: Internal server error. tags: - Discounts /api/v1/discounts/{id}: summary: Retrieve a single discount by ID description: Retrieves a single discount from the database by given ID. get: summary: Get a discount description: This operation retrieves an object with the matching id. operationId: get_discount_id parameters: - name: id in: path description: The id of the discount. required: true schema: type: string responses: '200': description: The discount was successfully retrieved. content: application/json: schema: $ref: '#/components/schemas/Discount' # Assuming you have a Discount schema defined '404': description: Discount not found. '500': description: Internal server error. security: - bearerAuth: [] tags: - Discounts put: summary: Update a discount. description: This operation updates an object with the matching id. operationId: update_discount_id parameters: - name: id in: path description: The id of the discount. required: true schema: type: string requestBody: content: application/json: schema: $ref: '#/components/schemas/Discount' # Assuming you have a Discount schema defined responses: '200': description: The discount was successfully updated. '404': description: Discount not found. '500': description: Internal server error. security: - bearerAuth: [] tags: - Discounts delete: summary: Delete a discount. description: This product deletes an object with the matching id. operationId: delete_discount_id parameters: - name: id in: path schema: type: string required: true responses: '200': description: The discount was deleted successfully. '404': description: Discount not found. '500': description: Server error. security: - bearerAuth: [] tags: - Discounts /api/v1/discounts/products: summary: Manage discounts on products description: Endpoints for adding and removing discounts from products. get: summary: Get discounted products description: Retrieves a list of products with discounts, with optional pagination and filtering by category. operationId: get_discounted_products parameters: - in: query name: limit schema: type: integer description: Maximum number of products to return. - in: query name: page schema: type: integer description: Page number for pagination. - in: query name: category schema: type: integer description: Filter products by category ID. responses: '200': description: A list of discounted products. '404': description: No discounted products found. '500': description: Internal server error. security: - bearerAuth: [] tags: - Discounts post: summary: Add a discount to a product description: Add a discount to a product or product variant. operationId: add_discount_to_product security: - bearerAuth: [] requestBody: required: true content: application/json: schema: type: object properties: productId: type: integer description: ID of the product. discountId: type: integer description: ID of the discount to add. productVariantId: type: integer description: ID of the product variant (optional). responses: '200': description: Discount added to product successfully. '400': description: Invalid request object. '500': description: Internal server error. tags: - Discounts delete: summary: Remove a discount from a product description: Remove a discount from a product or product variant. operationId: remove_discount_from_product security: - bearerAuth: [] requestBody: required: true content: application/json: schema: type: object properties: productDiscountId: type: integer description: ID of the product_discount entry (optional). productId: type: integer description: ID of the product. discountId: type: integer description: ID of the discount to remove. productVariantId: type: integer description: ID of the product variant (optional). responses: '200': description: Discount removed from product successfully. '400': description: Invalid request object. '404': description: Discount not found on product. '500': description: Internal server error. tags: - Discounts /api/v1/discounts/code/{code}: summary: Retrieve a single discount by code description: Retrieves a single discount from the database by given code. post: # Changed to POST as per your routes file summary: Get a discount by code description: This operation retrieves an object with the matching code. operationId: get_discount_code parameters: - name: code in: path description: The code of the discount. required: true schema: type: string responses: '200': description: The discount was successfully retrieved. '404': description: Discount not found. '500': description: Internal server error. security: - bearerAuth: [] tags: - Discounts /api/v1/auth/login: post: responses: "200": content: application/json: schema: type: object properties: accessToken: type: string tags: - Auth /api/v1/auth/register: post: summary: create user description: used to create a user account operationId: register_user requestBody: description: the user to be created required: true content: application/json: schema: type: object required: - email - name - password properties: email: type: string username: type: string password: type: string responses: "200": description: Create user successful content: application/json: schema: type: object properties: accessToken: type: string security: - bearerAuth: [] tags: - Auth /api/v1/auth/logout: post: summary: logout user description: used to log a user out operationId: logout_user responses: "200": description: User logged out "500": description: Server error tags: - Auth /api/v1/auth/admin: post: summary: create admin description: used to create an admin account operationId: create_admin requestBody: description: the admin to be created required: true content: application/json: schema: type: object required: - email properties: email: type: string responses: "200": description: Create admin successful content: application/json: schema: type: object properties: message: type: string example: "Admin created" "404": description: User not found content: application/json: schema: type: object properties: message: type: string example: "User with email not found" "500": description: Server error content: application/json: schema: type: object properties: message: type: string example: "Server error" security: - bearerAuth: [] tags: - Auth delete: summary: remove admin description: used to remove an account from admin operationId: delete_admin requestBody: description: the admin to be remove required: true content: application/json: schema: type: object required: - email properties: email: type: string responses: "200": description: Remove admin successful content: application/json: schema: type: object properties: message: type: string example: "Admin removed" email: type: string example: "adminTest@email.com" "404": description: User not found content: application/json: schema: type: object properties: message: type: string example: "User with email not found" "500": description: Server error content: application/json: schema: type: object properties: message: type: string example: "Server error" security: - bearerAuth: [] tags: - Auth /api/v1/carts: description: Endpoints relating to user carts. post: tags: - Carts /api/v1/carts{id}: put: tags: - Carts get: tags: - Carts delete: tags: - Carts /api/v1/orders: description: Endpoints for retrieving orders. get: summary: Get all orders description: This operation retrieves all orders with the matching id operationId: get_orders parameters: - in: query name: limit schema: type: integer minimum: 1 maximum: 100 default: 25 description: The number of orders to return example: 25 security: - bearerAuth: [] responses: "200": description: The user was successfully retrieved. content: application/json: schema: $ref: "#/components/schemas/Order" tags: - Orders post: tags: - Orders /api/v1/orders/{id}: put: tags: - Orders components: securitySchemes: bearerAuth: type: http scheme: bearer schemas: Category: type: object properties: id: type: integer description: Auto-incrementing primary key name: type: string description: The name of the category description: type: string description: The description for the category required: - id - name - description User: type: object properties: email: type: string description: The email for the user (PK) username: type: string maxLength: 50 description: The user's username. name: type: string maxLength: 254 description: The user's name streetName: type: string maxLength: 75 description: The name of the street the user ships to. streetNumber: type: string city: type: string state: type: string zipCode: type: string phoneNumber: type: string Discount: type: object properties: id: type: integer description: The id for the discount (PK) code: type: string description: The code (if needed) for the discount. percentOff: type: integer description: The percentage amount off as a whole number. amountOff: type: number description: The dollar amount the discount takes off of the product price expireDate: type: string description: the date the discount expires quantity: type: integer description: The quantity of the discount available. Hero: type: object properties: id: type: integer description: The ID of the hero. categoryId: type: integer description: The ID of the category associated with the hero. productId: type: integer description: The ID of the product associated with the hero. layout: type: integer description: The layout type of the hero. heading: type: string description: The main heading of the hero. subTitle1: type: string description: The first subtitle of the hero. subTitle2: type: string description: The second subtitle of the hero. backgroundColor: type: string description: The background color of the hero. textColor: type: string description: The text color of the hero. imageurl: type: string description: The URL of the hero's image. Order: type: object properties: id: type: integer description: Auto-incrementing primary key userId: type: string description: The user's id products: type: array items: type: string description: The products in the order purchaseDate: type: string format: date description: The date the order was purchased status: type: string description: The status of the order discounts: type: array items: type: string description: The discounts applied to the order orderTotal: type: number format: float description: The total cost of the order Product: type: object properties: id: type: integer description: Auto-incrementing primary key barcode: type: string maxLength: 20 description: The barcode of the product nullable: true name: type: string maxLength: 50 description: The name of the product description: type: string maxLength: 254 description: A detailed description of the product nullable: true price: type: number format: float description: The price of the product, must be greater than 0 quantity: type: integer description: The quantity of the product in stock, must be greater than 0 required: - id - name - price - quantity