{"id":22111215,"url":"https://github.com/binhnhu1409/-teamwork--ecommerce_database_design","last_synced_at":"2025-03-24T04:28:53.329Z","repository":{"id":147129415,"uuid":"602603060","full_name":"binhnhu1409/-TEAMWORK--Ecommerce_database_design","owner":"binhnhu1409","description":null,"archived":false,"fork":false,"pushed_at":"2023-02-22T21:12:51.000Z","size":324,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-29T10:29:44.894Z","etag":null,"topics":["database","erdiagram","rest-api"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/binhnhu1409.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-02-16T15:02:28.000Z","updated_at":"2023-03-03T09:11:54.000Z","dependencies_parsed_at":"2023-05-14T13:31:01.419Z","dependency_job_id":null,"html_url":"https://github.com/binhnhu1409/-TEAMWORK--Ecommerce_database_design","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/binhnhu1409%2F-TEAMWORK--Ecommerce_database_design","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/binhnhu1409%2F-TEAMWORK--Ecommerce_database_design/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/binhnhu1409%2F-TEAMWORK--Ecommerce_database_design/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/binhnhu1409%2F-TEAMWORK--Ecommerce_database_design/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/binhnhu1409","download_url":"https://codeload.github.com/binhnhu1409/-TEAMWORK--Ecommerce_database_design/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245209344,"owners_count":20578020,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["database","erdiagram","rest-api"],"created_at":"2024-12-01T10:36:34.899Z","updated_at":"2025-03-24T04:28:53.308Z","avatar_url":"https://github.com/binhnhu1409.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# :memo: E-commerce database design\n\n# Group member:\n- Anup Nepal: Make queries for the database.\n- Quan Nguyen: Make API endpoints.\n- Maksim Pasnitsenko: Make mock data and design individual data structure\n- Nhu Nguyen: Make diagram and table relationship.\n\n# Tasks have been done\n1. Create ERD diagram for database \n2. Design the API endpoints, following REST API architecture.\n3. Database queries using to create database, and CRUD operations.\n\n# ERD diagram for E-commerce database\n![ERD diagram](assets/images/ERD.PNG)\n\n# Design REST API endpoints\n\u003cdetails\u003e\n\t\u003cli\u003e\u003ca href=\"https://github.com/mq003at/fs13-Teamwork/tree/main#products\"\u003eProduct\u003c/a\u003e\u003c/li\u003e\n\t\u003cli\u003e\u003ca href=\"https://github.com/mq003at/fs13-Teamwork/tree/main#users\"\u003eUsers\u003c/a\u003e\u003c/li\u003e\n\t\u003cli\u003e\u003ca href=\"https://github.com/mq003at/fs13-Teamwork/tree/main#categories\"\u003eCategories\u003c/a\u003e\u003c/li\u003e\n\t\u003cli\u003e\u003ca href=\"https://github.com/mq003at/fs13-Teamwork/tree/main#images\"\u003eImages\u003c/a\u003e\u003c/li\u003e\n\u003c/details\u003e\n\n## Products \n### Get a single product\n**[GET]** /api/products/{id}\n- **id**: The id of the product.\n\n### Get all products\n**[GET]** /api/products\n\n#### Parameters and Queries\n\n| Name | Type | Description | Required |\n| --- | --- | --- | --- |\n| **offset** | Number | The index number of the starting item to be returned. | No |\n| **limit** | Number | Maximum entries to be returned | No |\n| **sortBy** | String | Filtering products by attributes. Can be \"name\", \"quantity\", \"price\", \"createdDate\", \"modifiedDate\". | No |\n| **sortOrder** | String | How the products are filtered. \"asc\" or \"desc\" | No. Can only be used when sortBy is included. |\n| **fromRange** | String | Filtering products from range | No. Can only be used when sortBy is included. Not available for \"name\". |\n| **toRange** | String | Filtering products from range | No. Can only be used when sortBy is included. Not available for \"name\". |\n\n#### Response\n```json\n[\n\t{\n\t\t\"id\": 1,\n\t\t\"product_name\": \"TShirt\",\n\t\t\"quantity\": 23,\n\t\t\"price\": 50,\n\t\t\"category\": \"Shirt\",\n\t\t\"images\": [\"https://www.youtube.com/watch?v=-E_O2PwZpCc\"],\n\t\t\"description\": \"The book covers the process of development of distributed Systems with Node.js for Enterprise-Ready Backend Services\" ,\n\t\t\"created_at\": \"21-02-2023\",\n\t\t\"modified_at\": \"21-02-2023\"\n\t}\n    ...,\n]\n```\n\n#### Example:\nThe following request will send a GET request to get the first 100 products sorted by price, ascending, from 10 EUR to 100 EUR.\n\n**[URL]** https://www.ecommerce.com/api/v1/products?limit=100\u0026sortBy=price\u0026sortOrder=asc\u0026fromRange=10\u0026toRange=100\n\n### Create a product\n**[POST]** /api/products\n#### Response\nReturn the newly created product with the same response from [GET].\n\n### Update a single product\n**[PUT]** /api/products/{id}\n#### Response\nReturn the updated product with the same response from [GET].\n\n### Delete a single product\n**[DELETE]** /api/products/{id}\n#### Response\nReturn the updated product with the same response from [GET].\n\n\n## Users\n### Get a single user\n**[GET]** /api/users/{id}\n- **id**: The id of the user.\n\n### Get all users' names\n**[GET]** /api/users\n\n#### Response \n```json\n[\n\t{\n\t    \"first_name\": \"James\",\n\t    \"last_name\": \"Bond\",\n\t    \"avatar\": [\"https://www.youtube.com/watch?v=-E_O2PwZpCc\"]\n\t },\n\t ...,\n]\n```\n\n### Get all users\n**[GET]** /api/users\n\n#### Queries\n| Name | Type | Description | Required |\n| --- | --- | --- | --- |\n| **offset** | Number | The index number of the starting item to be returned. | No |\n| **limit** | Number | Maximum entries to be returned | No |\n| **sortBy** | String | Filtering products by attributes. Can be \"firstName\", \"lastName\", \"role\", \"createdDate\", \"modifiedDate\" | No |\n| **sortOrder** | String | How the products are filtered. \"asc\" or \"desc\" | No. Can only be used when sortBy is included. |\n| **fromRange** | String | Filtering products from range | No. Can only be used when sortBy is included. Not available for \"firstName\" or \"lastName\" or \"role\".|\n| **toRange** | String | Filtering products from range | No. Can only be used when sortBy is included. Not available for \"firstName\" or \"lastName\" or \"role\". |\n\n#### Response\n```json\n[\n\t{\n\t\t\"id\": \"1\",\n\t\t\"first_name\": \"James\",\n\t\t\"last_name\": Bonds,\n\t\t\"email\": \"james.bonds@gmail.com\",\n\t\t\"avatar\": [\"https://www.youtube.com/watch?v=-E_O2PwZpCc\"],\n\t\t\"role\": \"Admin\",\n\t\t\"address\": \"Suksisepantie 19, Kokkola, Finland\" ,\n\t\t\"created_at\": \"2023-02-21\",\n\t\t\"modified_at\": \"2023-02-21\"\n\t},\n\t...,\n]\n```\n\n### Create a user\n**[POST]** /api/users\n#### Response\nReturn the newly created users with the same response from [GET].\n\n### Update a user\n**[PUT]** /api/users/{id}\n#### Response\nReturn the updated users with the same response from [GET].\n\n### Delete a user\n**[DELETE]** /api/users\n#### Response\nReturn the deleted users with the same response from [GET].\n\n## Categories\n### Get all categories\n**[GET]** /api/categories\n#### Queries\n| Name | Type | Description | Required |\n| --- | --- | --- | --- |\n| **sortBy** | String | Filtering products by attributes. Can be \"createdDate\", \"modifiedDate\" | No |\n| **sortOrder** | String | How the products are filtered. \"asc\" or \"desc\" | No. Can only be used when sortBy is included. |\n| **fromRange** | String | Filtering products from range | No. Can only be used when sortBy is included. |\n| **toRange** | String | Filtering products from range | No. Can only be used when sortBy is included. |\n#### Response\n```json\n[\n\t{\n\t\t\"id\": \"1\",\n\t\t\"category_name\": \"Shirt\",\n\t\t\"images\": [\"https://www.youtube.com/watch?v=-E_O2PwZpCc\"],\n\t\t\"created_at\": \"2023-02-21\",\n\t\t\"modified_at\": \"2023-02-21\"\n\t},\n\t...,\n]\n```\n\n### Get all products from a single category\n[GET] /api/categories/{id}\n#### Queries\n| Name | Type | Description | Required |\n| --- | --- | --- | --- |\n| **offset** | Number | The index number of the starting item to be returned. | No |\n| **limit** | Number | Maximum entries to be returned | No |\n| **sortBy** | String | Filtering products by attributes. Can be \"name\", \"quantity\", \"price\", \"createdDate\", \"modifiedDate\". | No |\n| **sortOrder** | String | How the products are filtered. \"asc\" or \"desc\" | No. Can only be used when sortBy is included. |\n| **fromRange** | String | Filtering products from range | No. Can only be used when sortBy is included. Not available for \"name\". |\n| **toRange** | String | Filtering products from range | No. Can only be used when sortBy is included. Not available for \"name\". |\n#### Response\n```json\n[\n\t{\n\t\t\"id\": 1,\n\t\t\"product_name\": \"TShirt\",\n\t\t\"quantity\": 23,\n\t\t\"price\": 50,\n\t\t\"category\": \"Shirt\",\n\t\t\"images\": [\"https://www.youtube.com/watch?v=-E_O2PwZpCc\"],\n\t\t\"description\": \"The book covers the process of development of distributed Systems with Node.js for Enterprise-Ready Backend Services\" ,\n\t\t\"created_at\": \"21-02-2023\",\n\t\t\"modified_at\": \"21-02-2023\"\n\t}\n    ...,\n]\n```\n\n### Create a category\n**[POST]** /api/categories\n#### Response\nReturn the created category with the same response from [GET].\n\n### Update a category\n**[PUT]** /api/categories/{id}\n#### Response\nReturn the updated category with the same response from [GET].\n\n### Delete a category\n**[DELETE]** /api/categories/{id}\n#### Response\nReturn the deleted category with the same response from [GET].\n\n## Images\n### Get all images\n**[GET]** /api/images\n#### Queries\n| Name | Type | Description | Required |\n| --- | --- | --- | --- |\n| **group** | String | Which group the images belong to. Can be \"user\", \"category\", and \"product\" | No |\n#### Response\n```json\n[\n\t{\n\t\t\"id\": \"1\",\n\t\t\"product_id\": \"\",\n\t\t\"category_id\": \"\",\n\t\t\"user_id\": \"1\",\n\t\t\"location\": \"https://www.youtube.com/watch?v=-E_O2PwZpCc\",\n\t\t\"created_at\": \"21-02-2023\",\n\t\t\"modified_at\": \"21-02-2023\"\n\t}\n    ...,\n]\n```\n\n### Get a single image\n**[GET]** /api/images/{id}\n- **id**: The id of the user.\n\n#### Response\nSame response from [GET] all images.\n\n### Upload an image\n**[POST]** /api/images\nReturn the created image with the same response from [GET].\n\n### Update a single image\n**[PUT]** /api/images/{id}\nReturn the updated image with the same response from [GET].\n\n### Delete a single image\n**[DELETE]** /api/images/{id}\nReturn the deleted image with the same response from [GET].\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbinhnhu1409%2F-teamwork--ecommerce_database_design","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbinhnhu1409%2F-teamwork--ecommerce_database_design","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbinhnhu1409%2F-teamwork--ecommerce_database_design/lists"}