From e10f452c0805be2742944c4c5e9c51c94f8455f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Muth?= Date: Sat, 2 Nov 2024 10:32:16 +0000 Subject: [PATCH] docs(documentation): docs: add create a price doc --- .../.gitbook/assets/openapi (1).yaml | 118 +++++++++++ .../.gitbook/assets/openapi (2).yaml | 158 +++++++++++++++ .../.gitbook/assets/openapi (3).yaml | 158 +++++++++++++++ .../.gitbook/assets/openapi (4).yaml | 167 ++++++++++++++++ .../.gitbook/assets/openapi (5).yaml | 183 ++++++++++++++++++ .../.gitbook/assets/openapi (6).yaml | 181 +++++++++++++++++ documentation/.gitbook/assets/openapi.yaml | 81 ++++++++ documentation/README.md | 69 +------ documentation/SUMMARY.md | 6 + documentation/v1/prices/create-a-price.md | 6 + 10 files changed, 1059 insertions(+), 68 deletions(-) create mode 100644 documentation/.gitbook/assets/openapi (1).yaml create mode 100644 documentation/.gitbook/assets/openapi (2).yaml create mode 100644 documentation/.gitbook/assets/openapi (3).yaml create mode 100644 documentation/.gitbook/assets/openapi (4).yaml create mode 100644 documentation/.gitbook/assets/openapi (5).yaml create mode 100644 documentation/.gitbook/assets/openapi (6).yaml create mode 100644 documentation/.gitbook/assets/openapi.yaml create mode 100644 documentation/SUMMARY.md create mode 100644 documentation/v1/prices/create-a-price.md diff --git a/documentation/.gitbook/assets/openapi (1).yaml b/documentation/.gitbook/assets/openapi (1).yaml new file mode 100644 index 0000000..1bdb58a --- /dev/null +++ b/documentation/.gitbook/assets/openapi (1).yaml @@ -0,0 +1,118 @@ +openapi: 3.1.0 +info: + title: Price Comparator API + description: An API for comparing prices of foods, cosmetics and more. + version: 1.0.0 +servers: + - url: https://pcomparator.vercel.app/api + description: The production server. +paths: + /prices: + post: + operationId: createPrice + summary: Create a new price + description: Creates a new price in the database. + requestBody: + description: The price to create. + content: + application/json: + schema: + $ref: "#/components/schemas/components" + responses: + "201": + description: The burger was created successfully. + content: + application/json: + schema: + type: object + properties: + id: + type: string + format: uuid + barcode: + type: string + minLength: 1 + name: + type: string + minLength: 1 + description: + type: + - string + - "null" + minLength: 1 + categoryId: + type: + - string + - "null" + format: uuid + brandId: + type: + - string + - "null" + format: uuid + nutritionScore: + type: "null" + createdAt: + type: string + updatedAt: + type: string + required: + - id + - barcode + - name + - createdAt + - updatedAt +components: + schemas: + components: + type: object + properties: + barcode: + type: string + example: "2929292929292" + storeName: + type: string + example: Auchan + productName: + type: string + example: Nutella + categoryName: + type: string + example: Pate a tartiner + brandName: + type: string + example: Ferrero + location: + type: string + example: 4 rue du dome, 67000, Strasbourg + amount: + type: number + exclusiveMinimum: 0 + example: 9.99 + proof: + type: string + example: https://pcomparator/files + currency: + type: string + enum: + - EUR + - USD + - GBP + - CHF + - AUD + - CAD + - CNY + - JPY + - AED + example: EUR + required: + - barcode + - storeName + - productName + - categoryName + - brandName + - location + - amount + - proof + - currency + diff --git a/documentation/.gitbook/assets/openapi (2).yaml b/documentation/.gitbook/assets/openapi (2).yaml new file mode 100644 index 0000000..69e682a --- /dev/null +++ b/documentation/.gitbook/assets/openapi (2).yaml @@ -0,0 +1,158 @@ +openapi: 3.1.0 +info: + title: Price Comparator API + description: An API for comparing prices of foods, cosmetics and more. + version: 1.0.0 +servers: + - url: https://pcomparator.vercel.app/api + description: The production server. +paths: + /prices: + post: + operationId: createPrice + summary: Create a new price + description: Creates a new price in the database. + requestBody: + description: The price to create. + content: + application/json: + schema: + type: object + properties: + barcode: + type: string + example: "8690804407383" + storeName: + type: string + example: Auchan + productName: + type: string + example: Nutella + categoryName: + type: string + example: Pate a tartiner + brandName: + type: string + example: Ferrero + location: + type: string + example: 4 rue du dome, 67000, Strasbourg + amount: + type: number + exclusiveMinimum: 0 + example: 9.99 + proof: + type: string + example: https://pcomparator/files + currency: + type: string + enum: + - EUR + - USD + - GBP + - CHF + - AUD + - CAD + - CNY + - JPY + - AED + example: EUR + required: + - barcode + - storeName + - productName + - categoryName + - brandName + - location + - amount + - proof + - currency + responses: + "201": + description: The burger was created successfully. + content: + application/json: + schema: + type: object + properties: + id: + type: string + format: uuid + barcode: + type: string + minLength: 1 + name: + type: string + minLength: 1 + description: + type: + - string + - "null" + minLength: 1 + categoryId: + type: + - string + - "null" + format: uuid + brandId: + type: + - string + - "null" + format: uuid + nutritionScore: + type: "null" + createdAt: + type: string + updatedAt: + type: string + required: + - id + - barcode + - name + - createdAt + - updatedAt +components: + schemas: + components: + type: object + properties: + barcode: + type: string + storeName: + type: string + productName: + type: string + categoryName: + type: string + brandName: + type: string + location: + type: string + amount: + type: number + exclusiveMinimum: 0 + proof: + type: string + currency: + type: string + enum: + - EUR + - USD + - GBP + - CHF + - AUD + - CAD + - CNY + - JPY + - AED + required: + - barcode + - storeName + - productName + - categoryName + - brandName + - location + - amount + - proof + - currency + diff --git a/documentation/.gitbook/assets/openapi (3).yaml b/documentation/.gitbook/assets/openapi (3).yaml new file mode 100644 index 0000000..69e682a --- /dev/null +++ b/documentation/.gitbook/assets/openapi (3).yaml @@ -0,0 +1,158 @@ +openapi: 3.1.0 +info: + title: Price Comparator API + description: An API for comparing prices of foods, cosmetics and more. + version: 1.0.0 +servers: + - url: https://pcomparator.vercel.app/api + description: The production server. +paths: + /prices: + post: + operationId: createPrice + summary: Create a new price + description: Creates a new price in the database. + requestBody: + description: The price to create. + content: + application/json: + schema: + type: object + properties: + barcode: + type: string + example: "8690804407383" + storeName: + type: string + example: Auchan + productName: + type: string + example: Nutella + categoryName: + type: string + example: Pate a tartiner + brandName: + type: string + example: Ferrero + location: + type: string + example: 4 rue du dome, 67000, Strasbourg + amount: + type: number + exclusiveMinimum: 0 + example: 9.99 + proof: + type: string + example: https://pcomparator/files + currency: + type: string + enum: + - EUR + - USD + - GBP + - CHF + - AUD + - CAD + - CNY + - JPY + - AED + example: EUR + required: + - barcode + - storeName + - productName + - categoryName + - brandName + - location + - amount + - proof + - currency + responses: + "201": + description: The burger was created successfully. + content: + application/json: + schema: + type: object + properties: + id: + type: string + format: uuid + barcode: + type: string + minLength: 1 + name: + type: string + minLength: 1 + description: + type: + - string + - "null" + minLength: 1 + categoryId: + type: + - string + - "null" + format: uuid + brandId: + type: + - string + - "null" + format: uuid + nutritionScore: + type: "null" + createdAt: + type: string + updatedAt: + type: string + required: + - id + - barcode + - name + - createdAt + - updatedAt +components: + schemas: + components: + type: object + properties: + barcode: + type: string + storeName: + type: string + productName: + type: string + categoryName: + type: string + brandName: + type: string + location: + type: string + amount: + type: number + exclusiveMinimum: 0 + proof: + type: string + currency: + type: string + enum: + - EUR + - USD + - GBP + - CHF + - AUD + - CAD + - CNY + - JPY + - AED + required: + - barcode + - storeName + - productName + - categoryName + - brandName + - location + - amount + - proof + - currency + diff --git a/documentation/.gitbook/assets/openapi (4).yaml b/documentation/.gitbook/assets/openapi (4).yaml new file mode 100644 index 0000000..44e76c8 --- /dev/null +++ b/documentation/.gitbook/assets/openapi (4).yaml @@ -0,0 +1,167 @@ +openapi: 3.1.0 +info: + title: Price Comparator API + description: An API for comparing prices of foods, cosmetics and more. + version: 1.0.0 +servers: + - url: https://pcomparator.vercel.app/api + description: The production server. +paths: + /prices: + post: + operationId: createPrice + summary: Create a new price + description: Creates a new price in the database. + requestBody: + description: The price to create. + content: + application/json: + schema: + type: object + properties: + barcode: + type: string + example: "8690804407383" + storeName: + type: string + example: Auchan + productName: + type: string + example: Nutella + categoryName: + type: string + example: Pate a tartiner + brandName: + type: string + example: Ferrero + location: + type: string + example: 4 rue du dome, 67000, Strasbourg + amount: + type: number + exclusiveMinimum: 0 + example: 9.99 + proof: + type: string + example: https://pcomparator/files + currency: + type: string + enum: + - EUR + - USD + - GBP + - CHF + - AUD + - CAD + - CNY + - JPY + - AED + example: EUR + required: + - barcode + - storeName + - productName + - categoryName + - brandName + - location + - amount + - proof + - currency + responses: + "201": + description: The burger was created successfully. + content: + application/json: + schema: + type: object + properties: + id: + type: string + format: uuid + example: 010f21e3-c5b9-4d91-a5b1-b713d2324b17 + barcode: + type: string + minLength: 1 + example: "8690804407383" + name: + type: string + minLength: 1 + example: Nutella + description: + type: + - string + - "null" + minLength: 1 + example: Nutella is a sweet hazelnut and cocoa spread made by Ferrero. + categoryId: + type: + - string + - "null" + format: uuid + example: 77230970-93e1-46ed-9797-85fc96d7eb0b + brandId: + type: + - string + - "null" + format: uuid + example: d0ecb566-74ee-4409-aeb3-31f30985a6f4 + nutritionScore: + type: "null" + example: "" + createdAt: + type: string + example: 2024-11-01T17:53:12.921Z + updatedAt: + type: string + example: 2024-11-01T17:53:12.921Z + required: + - id + - barcode + - name + - createdAt + - updatedAt +components: + schemas: + components: + type: object + properties: + barcode: + type: string + storeName: + type: string + productName: + type: string + categoryName: + type: string + brandName: + type: string + location: + type: string + amount: + type: number + exclusiveMinimum: 0 + proof: + type: string + currency: + type: string + enum: + - EUR + - USD + - GBP + - CHF + - AUD + - CAD + - CNY + - JPY + - AED + required: + - barcode + - storeName + - productName + - categoryName + - brandName + - location + - amount + - proof + - currency + diff --git a/documentation/.gitbook/assets/openapi (5).yaml b/documentation/.gitbook/assets/openapi (5).yaml new file mode 100644 index 0000000..fd1d68a --- /dev/null +++ b/documentation/.gitbook/assets/openapi (5).yaml @@ -0,0 +1,183 @@ +openapi: 3.1.0 +info: + title: Price Comparator API + description: An API for comparing prices of foods, cosmetics and more. + version: 1.0.0 +servers: + - url: https://pcomparator.vercel.app/api + description: The production server. +paths: + /prices: + post: + operationId: createPrice + summary: Create a new price + description: Creates a new price in the database. + requestBody: + description: The price to create. + content: + application/json: + schema: + type: object + properties: + barcode: + type: string + example: "8690804407383" + description: Unique identifier for the product in barcode format + storeName: + type: string + example: Auchan + description: Name of the store where the product is sold + productName: + type: string + example: Nutella + description: Name of the product + categoryName: + type: string + example: Pate a tartiner + description: Category of the product + brandName: + type: string + example: Ferrero + description: Brand or manufacturer of the product + location: + type: string + example: 4 rue du dome, 67000, Strasbourg + description: Address of the store where the product was found + amount: + type: number + exclusiveMinimum: 0 + example: 9.99 + description: Price of the product + proof: + type: string + example: https://pcomparator/files + description: Link to an image or file providing proof of the price + currency: + type: string + enum: + - EUR + - USD + - GBP + - CHF + - AUD + - CAD + - CNY + - JPY + - AED + example: EUR + description: Currency used for the product price + required: + - barcode + - storeName + - productName + - categoryName + - brandName + - location + - amount + - proof + - currency + description: Creates a new price entry for a product, allowing users to add + price information for a product found in a specific store. The + route accepts details such as the product's barcode, name, + brand, category, store location, price, and a link to a proof + image. This enables the application to update its database with + current prices from various stores, helping users compare prices + effectively. + responses: + "201": + description: The burger was created successfully. + content: + application/json: + schema: + type: object + properties: + id: + type: string + format: uuid + example: 010f21e3-c5b9-4d91-a5b1-b713d2324b17 + barcode: + type: string + minLength: 1 + example: "8690804407383" + name: + type: string + minLength: 1 + example: Nutella + description: + type: + - string + - "null" + minLength: 1 + example: Nutella is a sweet hazelnut and cocoa spread made by Ferrero. + categoryId: + type: + - string + - "null" + format: uuid + example: 77230970-93e1-46ed-9797-85fc96d7eb0b + brandId: + type: + - string + - "null" + format: uuid + example: d0ecb566-74ee-4409-aeb3-31f30985a6f4 + nutritionScore: + type: "null" + example: "" + createdAt: + type: string + example: 2024-11-01T18:00:20.566Z + updatedAt: + type: string + example: 2024-11-01T18:00:20.566Z + required: + - id + - barcode + - name + - createdAt + - updatedAt +components: + schemas: + components: + type: object + properties: + barcode: + type: string + storeName: + type: string + productName: + type: string + categoryName: + type: string + brandName: + type: string + location: + type: string + amount: + type: number + exclusiveMinimum: 0 + proof: + type: string + currency: + type: string + enum: + - EUR + - USD + - GBP + - CHF + - AUD + - CAD + - CNY + - JPY + - AED + required: + - barcode + - storeName + - productName + - categoryName + - brandName + - location + - amount + - proof + - currency + diff --git a/documentation/.gitbook/assets/openapi (6).yaml b/documentation/.gitbook/assets/openapi (6).yaml new file mode 100644 index 0000000..728e49d --- /dev/null +++ b/documentation/.gitbook/assets/openapi (6).yaml @@ -0,0 +1,181 @@ +openapi: 3.1.0 +info: + title: Price Comparator API + description: An API for comparing prices of foods, cosmetics and more. + version: 1.0.0 +servers: + - url: https://pcomparator.vercel.app/api + description: The production server. +paths: + /prices: + post: + operationId: createPrice + summary: Create a new price + description: Creates a new price entry for a product, allowing users to add + price information for a product found in a specific store. The route + accepts details such as the product's barcode, name, brand, category, + store location, price, and a link to a proof image. This enables the + application to update its database with current prices from various + stores, helping users compare prices effectively. + requestBody: + description: The price to create. + content: + application/json: + schema: + type: object + properties: + barcode: + type: string + example: "8690804407383" + description: Unique identifier for the product in barcode format + storeName: + type: string + example: Auchan + description: Name of the store where the product is sold + productName: + type: string + example: Nutella + description: Name of the product + categoryName: + type: string + example: Pate a tartiner + description: Category of the product + brandName: + type: string + example: Ferrero + description: Brand or manufacturer of the product + location: + type: string + example: 4 rue du dome, 67000, Strasbourg + description: Address of the store where the product was found + amount: + type: number + exclusiveMinimum: 0 + example: 9.99 + description: Price of the product + proof: + type: string + example: https://pcomparator/files + description: Link to an image or file providing proof of the price + currency: + type: string + enum: + - EUR + - USD + - GBP + - CHF + - AUD + - CAD + - CNY + - JPY + - AED + example: EUR + description: Currency used for the product price + required: + - barcode + - storeName + - productName + - categoryName + - brandName + - location + - amount + - proof + - currency + responses: + "201": + description: The burger was created successfully. + content: + application/json: + schema: + type: object + properties: + id: + type: string + format: uuid + example: 010f21e3-c5b9-4d91-a5b1-b713d2324b17 + barcode: + type: string + minLength: 1 + example: "8690804407383" + name: + type: string + minLength: 1 + example: Nutella + description: + type: + - string + - "null" + minLength: 1 + example: Nutella is a sweet hazelnut and cocoa spread made by Ferrero. + categoryId: + type: + - string + - "null" + format: uuid + example: 77230970-93e1-46ed-9797-85fc96d7eb0b + brandId: + type: + - string + - "null" + format: uuid + example: d0ecb566-74ee-4409-aeb3-31f30985a6f4 + nutritionScore: + type: "null" + example: "" + createdAt: + type: string + example: 2024-11-01T18:01:29.198Z + updatedAt: + type: string + example: 2024-11-01T18:01:29.198Z + required: + - id + - barcode + - name + - createdAt + - updatedAt +components: + schemas: + components: + type: object + properties: + barcode: + type: string + storeName: + type: string + productName: + type: string + categoryName: + type: string + brandName: + type: string + location: + type: string + amount: + type: number + exclusiveMinimum: 0 + proof: + type: string + currency: + type: string + enum: + - EUR + - USD + - GBP + - CHF + - AUD + - CAD + - CNY + - JPY + - AED + required: + - barcode + - storeName + - productName + - categoryName + - brandName + - location + - amount + - proof + - currency + diff --git a/documentation/.gitbook/assets/openapi.yaml b/documentation/.gitbook/assets/openapi.yaml new file mode 100644 index 0000000..82210ae --- /dev/null +++ b/documentation/.gitbook/assets/openapi.yaml @@ -0,0 +1,81 @@ +openapi: 3.1.0 +info: + title: Price Comparator API + description: An API for comparing prices of foods, cosmetics and more. + version: 1.0.0 +servers: + - url: https://pcomparator.vercel.app/api + description: The production server. +paths: + /prices: + post: + operationId: createPrice + summary: Create a new price + description: Creates a new price in the database. + requestBody: + description: The price to create. + content: + application/json: + schema: + $ref: "#/components/schemas/components" + responses: + "201": + description: The burger was created successfully. + content: + application/json: + schema: + $ref: "#/components/schemas/components" +components: + schemas: + components: + type: object + properties: + barcode: + type: string + example: "2929292929292" + storeName: + type: string + example: Auchan + productName: + type: string + example: Nutella + categoryName: + type: string + example: Pate a tartiner + brandName: + type: string + example: Ferrero + location: + type: string + example: 4 rue du dome, 67000, Strasbourg + amount: + type: number + exclusiveMinimum: 0 + example: 9.99 + proof: + type: string + example: https://pcomparator/files + currency: + type: string + enum: + - EUR + - USD + - GBP + - CHF + - AUD + - CAD + - CNY + - JPY + - AED + example: EUR + required: + - barcode + - storeName + - productName + - categoryName + - brandName + - location + - amount + - proof + - currency + diff --git a/documentation/README.md b/documentation/README.md index 446384e..5f708a4 100644 --- a/documentation/README.md +++ b/documentation/README.md @@ -1,69 +1,2 @@ -# Pcomparator API Docs Monorepo πŸš€ +# Prices -Welcome to the GitBook docs repository for the *Pcomparator* API! This is **the ultimate source** for all the information you’ll need to work with our API, which lets you compare prices for cosmetics, food items, and more. If you're working with the API, you’ve come to the right place! - -## πŸ“– Table of Contents - -- [πŸ“Œ About](#-about) -- [πŸ“‚ Project Structure](#-project-structure) -- [πŸš€ How to Contribute](#-how-to-contribute) -- [πŸ“’ Feedback](#-feedback) -- [πŸ“œ License](#-license) - ---- - -## πŸ“Œ About - -This documentation is your guide to using the *Pcomparator* API like a pro πŸ§‘β€πŸ’»! Whether you’re adding products, comparing prices, or finding the best deals, you’ll find everything you need for each endpoint here. If you want to contribute, check out the [contribution section](#-how-to-contribute) below to get started. - ---- - -## πŸ“‚ Project Structure - -Each `.md` file in this repo corresponds to a section or endpoint of the API and connects directly with our GitBook. The structure is simple and organized so you can quickly find what you’re looking for 🎯: - -``` -/docs -β”œβ”€β”€ introduction.md # Overview of the API -β”œβ”€β”€ authentication.md # Authentication and permissions -β”œβ”€β”€ v1/ -β”‚ β”œβ”€β”€ products.md # Product management -β”‚ β”œβ”€β”€ prices.md # Price comparison -β”‚ β”œβ”€β”€ users.md # User management -β”‚ └── more... # Other available endpoints -β”œβ”€β”€ faq.md # FAQ and common issues -└── ... # Other helpful resources -``` - ---- - -## πŸš€ How to Contribute - -We ❀️ contributions! If you want to improve the docs, fix issues, or add examples, here’s how: - -1. **Clone** this repo πŸ“₯ - ```bash - git clone https://github.com/yourusername/pcomparator-api-docs.git - ``` -2. **Branch** into contribution mode πŸš€ - ```bash - git checkout -b feature/your-feature-name - ``` -3. **Edit** the `.md` files ✏️ -4. **Push** your branch and open a PR! πŸŽ‰ - ---- - -## πŸ“’ Feedback - -Got feedback, ideas, or even a bug to report? Open an *Issue* or reach out to us directly. We’d love to improve this documentation with you! πŸ› οΈ - ---- - -## πŸ“œ License - -This project is under the MIT License, so feel free to use, share, and improve it with good vibes 🌈. - ---- - -Thanks for using and contributing to *Pcomparator*! 😊 \ No newline at end of file diff --git a/documentation/SUMMARY.md b/documentation/SUMMARY.md new file mode 100644 index 0000000..db28c8e --- /dev/null +++ b/documentation/SUMMARY.md @@ -0,0 +1,6 @@ +# Table of contents + +## v1 + +* [Prices](README.md) + * [Create a price](v1/prices/create-a-price.md) diff --git a/documentation/v1/prices/create-a-price.md b/documentation/v1/prices/create-a-price.md new file mode 100644 index 0000000..63a4ea2 --- /dev/null +++ b/documentation/v1/prices/create-a-price.md @@ -0,0 +1,6 @@ +# Create a price + +{% swagger src="../../.gitbook/assets/openapi (6).yaml" path="/prices" method="post" %} +[openapi (6).yaml](<../../.gitbook/assets/openapi (6).yaml>) +{% endswagger %} +