Skip to content

alyssonbarrera/top-one

Repository files navigation

Nest Logo

A progressive Node.js framework for building efficient and scalable server-side applications.

NPM Version Package License NPM Downloads CircleCI Coverage Discord Backers on Open Collective Sponsors on Open Collective Support us

Description

API for store inventory and sales management

Installation

$ pnpm install

Create database

$ docker compose up -d

Generate Prisma Client

$ pnpm run db:generate

Run Database Migrations

# development
$ pnpm run db:migrate

# production
$ pnpm run db:deploy

Run Prisma Seed

$ pnpm run db:seed

Running the app

# development
$ pnpm run start

# watch mode
$ pnpm run start:dev

# production mode
$ pnpm run start:prod

Test

# unit tests
$ pnpm run test

# e2e tests
$ pnpm run test:e2e

# test coverage
$ pnpm run test:cov

Features

Authentication

  • It should be able to authenticate using e-mail & password;
  • It should be able to change the password;

Products

  • It should be able to create a new product;
  • It should be able to list all products;
  • It should be able to show the product;
  • It should be able to update the product;
  • It should be able to delete the product;
  • It should be able to apply discounts to the product;

Clients

  • It should be able to create a new client;
  • It should be able to list all clients;
  • It should be able to show the client;
  • It should be able to update the client;
  • It should be able to delete the client;

Orders

  • It should be able to create a new order;
  • It should be able to list all orders;
  • It should be able to show the order;
  • It should be able to update the order;
  • It should be able to delete the order;
  • It should be able to set the order status like processing, sent, delivered;
  • It should be able to list all orders by status;
  • It should be able to list all orders with the status for the client;
  • It should be able to notificate the client about the order status;

Cart

  • It should be able to add a product to the cart;
  • It should be able to finish the cart and create an order;

ABAC

Roles & permissions.

Roles

  • Admin
  • Vendor

Permissions table

Administrator Vendor
Create product
Get product
Update a product
Delete a product
Apply discounts
Create client
Get client
Update a client
Delete a client
Create order
Get order
Update a order
Delete a order
Update order status ⚠️
Update user password

✅ = allowed ❌ = not allowed ⚠️ = allowed w/ conditions

Conditions

  • Only author of the order can update the status.

Documentation

https://documenter.getpostman.com/view/20700565/2sAY4siitw