https://github.com/pythonista7/express-prisma
https://github.com/pythonista7/express-prisma
Last synced: 10 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/pythonista7/express-prisma
- Owner: Pythonista7
- Created: 2022-11-21T19:32:49.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2022-11-21T19:33:22.000Z (about 3 years ago)
- Last Synced: 2025-02-07T11:52:08.486Z (12 months ago)
- Language: TypeScript
- Size: 40 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Building API's with Express and Prisma
## Entities
Following are the different entities in the system:
### Users
Two types: buyers and sellers
A user can sign up as a buyer or as a seller
### Catalogs
A catalog belongs to a seller
One seller can have one catalog
A catalog consists of Products
### Products
A product has a name and a price
### Orders
An order can be created by a buyer to purchase items from a seller's catalog
An order consists of a list of products
## APIs
Following are a few examples of the API endpoints you should expose.
### Auth APIs
`POST /api/auth/register`
Register a user (accept username, password, type of user - buyer/seller)
`POST /api/auth/login`
Let a previously registered user log in (e.g. retrieve authentication token)
### APIs for buyers
`GET /api/buyer/list-of-sellers`
Get a list of all sellers
`GET /api/buyer/seller-catalog/:seller_id`
Get the catalog of a seller by seller_id
`POST /api/buyer/create-order/:seller_id`
Send a list of items to create an order for seller with id = seller_id
### APIs for sellers
`POST /api/seller/create-catalog`
Send a list of items to create a catalog for a seller
`GET /api/seller/orders`
Retrieve the list of orders received by a seller