Kasirku RESTful API
Kasirku is a mobile web-based application, and RESTful API designed to support transaction management and cashier operations, as part of the final project of the Web Service Technology course in Semester 5.
- Version : v1.0.0
- Developer : Thomas Alberto
- Released On : November 20 2024
- Status : Stable Release
- Contact : tomasalberto527@gmail.com
- Description
- System Requirements
- Tech Stack
- Security
- Installation
- Setup Environment Variable
- Running the App
- Features
- Authorization
- Linux, Windows or MacOS
- Node JS v18 or later
- MySQL
- npm (Node Package Manager)
- Nest JS
- Type ORM
- MySQL
- TypeScript
- Node JS
- Authentication
- Encryption and Hasing
- Authorization
- Cors
- Rate Limiting
# Clone project
$ git clone https://github.com/xRiot45/kasirku_api.git
# Navigate to project repository
$ cd kasirku_api
# Install all dependencies
$ npm install
# Create Uplaods Folder
$ mkdir uploads# Change name file
$ cp .env.example .env
# Application
APP_URL= # Application URL
APP_NAME= # Application Name
APP_PORT= # Application Port
APP_ENV= # Application Environment
# Database
MYSQL_HOST= # MySQL Host
MYSQL_PORT= # MySQL Port
MYSQL_USERNAME= # MySQL Username
MYSQL_PASSWORD= # MySQL Password
MYSQL_DATABASE= # MySQL Database
MYSQL_SYNCHRONIZE= # MySQL Synchronize
# Jwt
ACCESS_TOKEN_SECRET= # Your Access Token Secret for JWT
REFRESH_TOKEN_SECRET= # Your Refresh Token Secret for JWT# Watch mode
$ npm run start
# Development mode
$ npm run start:dev
# Production mode
$ npm run start:prod- Endpoint:
/api/auth/login - Method:
POST - Description: Authenticates the user and returns a token for accessing protected routes.
- Endpoint:
/api/auth/register - Method:
POST - Description: Registers a new user into the system.
- Endpoint:
/api/auth/refresh-token - Method:
POST - Description: Refreshes the authentication token.
- Endpoint:
/api/auth/logout - Method:
DELETE - Description: Logs the user out and invalidates the session.
- Endpoint:
/api/role - Methods:
POST /create: Create a new role.GET: Get all roles.GET /show/{roleId}: Get a specific role by ID.PUT /{roleId}: Update a role by ID.DELETE /{roleId}: Delete a role by ID.
- Endpoint:
/api/product-category - Methods:
POST /create: Create a new product category.GET: Get all product categories.GET /show/{productCategoryId}: Get a specific product category by ID.PUT /{productCategoryId}: Update a product category by ID.DELETE /{productCategoryId}: Delete a product category by ID.
- Endpoint:
/api/users/me - Method:
GET - Description: Retrieve data of a specific user by their access token.
- Endpoint:
/api/users - Method:
GET - Description: Get a list of all users in the system.
- Endpoint:
/api/users/show/{userId} - Method:
GET - Description: Get user details by their ID.
- Endpoint:
/api/users/reset-password/{userId} - Method:
PUT - Description: Allows an admin to reset a user's password.
- Endpoint:
/api/users/delete/{userId} - Method:
DELETE - Description: Delete a specific user by their ID.
- Endpoint:
/api/users/update-profile - Method:
PUT - Description: Update the logged-in user's profile.
- Endpoint:
/api/users/update-profile/{userId} - Method:
PUT - Description: Admin can update any user's profile.
- Endpoint:
/api/products - Methods:
POST /create: Create a new product.GET: Get all products.GET /show/{productId}: Get a specific product by ID.PUT /{productId}: Update a product by ID.DELETE /{productId}: Delete a product by ID.
- Endpoint:
/api/carts/add-product-to-cart - Method:
POST - Description: Add a product to cart.
- Endpoint:
/api/carts/all - Method:
GET - Description: Retrieve all cart data.
- Endpoint:
/api/carts/delete/{cartId} - Method:
DELETE - Description: Remove a product from the cart by ID.
- Endpoint:
/api/carts/delete/all - Method:
DELETE - Description: Remove all product from cart.
- Endpoint:
/api/orders/create - Method:
POST - Description: Create a new order.
- Endpoint:
/api/orders/all - Method:
GET - Description: Retrieve all orders.
- Endpoint:
/api/orders/show/{orderId} - Method:
GET - Description: Get order details by ID.
- Endpoint:
/api/orders/delete/{orderId} - Method:
DELETE - Description: Delete an order by its ID.
- Endpoint:
/api/ordersdelete/ - Method:
DELETE - Description: Delete all orders.
- Endpoint:
/api/checkout/create - Method:
POST - Description: Proceed to checkout for the order.
- Endpoint:
/api/checkout/all - Method:
GET - Description: Retrieve all checkout data.
- Endpoint:
/api/checkout/show/{checkoutId} - Method:
GET - Description: Get checkout details by ID.
- Endpoint:
/api/checkout/status/confirmed/{checkoutId} - Method:
PUT - Description: Update the order status to 'confirmed'.
- Endpoint:
/api/checkout/status/processed/{checkoutId} - Method:
PUT - Description: Update the order status to 'processed'.
- Endpoint:
/api/checkout/status/completed/{checkoutId} - Method:
PUT - Description: Update the order status to 'completed'.
- Endpoint:
/api/checkout/status/cancelled/{checkoutId} - Method:
PUT - Description: Update the order status to 'cancelled'.
- Endpoint:
/api/checkout/delete/{checkoutId} - Method:
DELETE - Description: Remove checkout record by ID.
- Endpoint:
/api/reports/create - Method:
POST - Description: Create a new report.
- Endpoint:
/api/reports/all - Method:
GET - Description: Get all reports data.
- Endpoint:
/api/reports/show/{reportsId} - Method:
GET - Description: Get a specific report by ID.
- Endpoint:
/api/charts/count-data - Method:
GET - Description: Get the count of data.
- Endpoint:
/api/charts/sale-by-year - Method:
GET - Description: Get the total sales count by year.
- Endpoint:
/api/charts/total-profit - Method:
GET - Description: Get the total profit.
- Endpoint:
/api/charts/count-order-status - Method:
GET - Description: Get the count of orders by status.
Use the following steps to get an authorization token:
- Log in using the /api/auth/login endpoints.
- Use the token received in the response to authorize further requests.
