Welcome to the Haru-Fashion API, a RESTful API for Haru-Fashion e-commerce web application.
This API can be used to access Haru-Fashion API endpoints, which can get information on various products, categories in our database. Certain information and actions, for example, retrieving customers, creating products, can only be done when authenticated and authorized.
This API is developed with NodeJS, Express, TypeScript, Prisma and PostgreSQL.
Login as an admin.
Update current logged-in admin’s password. User must type current password correctly in order to perform this action.
Add a new admin to the database. To perform this action, user must be authenticated and authorized as a superadmin.
Retrieve all admins from the database. This action can only be performed by superadmin role.
Retrieve current logged-in admin’s details.
Retrieve specific admin by their ID from the database. This action can only be performed by superadmin role.
Seed data to the database when deployed. To perform this action, seeding password must be correct.
Update specific admin by their ID. This action can only be performed by superadmin role.
Update current logged-in admin’s details.
Forgot password can be reset by providing email in the body. Reset password token is sent via email.
Retrieve current logged-in customer’s details.
Login as a customer when the customer is already registered.
Register a new customer by passing required fields in the body.
To reset password, this route can be requested (which is sent via email)
Update current logged-in customer’s details.
Update current logged-in customer’s password. Customer must type current password correctly in order to perform this action.
Add new category to the database. To perform this action, user must be authenticated and authorized.
Remove a category by its ID from the database. To perform this action, user must be authenticated and authorized.
Fetch all categories from the database. Includes select and ordering.
Key | Value | Description |
---|---|---|
select | name,description | |
order_by | createdAt.desc,name |
Fetch specific category by ID from the database. Includes select and ordering.
Update specific category by its ID from the database. To perform this action, user must be authenticated and authorized.
Delete a customer by their ID from the database. To perform this action, user must be authenticated and authorized.
Fetch all customers from the database. To perform this action, user must be authenticated and authorized.
Fetch specific customer by their ID from the database. To perform this action, user must be authenticated and authorized.
Add new product to the database. To perform this action, user must be authenticated and authorized.
Remove a product by its ID from the database. To perform this action, user must be authenticated and authorized.
Fetch all products from the database. Includes select and ordering.
Key | Value | Description |
---|---|---|
order_by | price.desc,name | |
skip | 50 | |
limit | 10 | |
price | gte:50 | |
price | lt:100 | |
stock | gt:50 | |
stock | lt:70 | |
select | name,price,stock |
Fetch specific product by ID from the database. Includes select and ordering.
Key | Value | Description |
---|---|---|
include | category |
Perform full-text search for all products.
Key | Value | Description |
---|---|---|
q | condimentum |
Update specific product by its ID from the database. To perform this action, user must be authenticated and authorized.