A tiny server app based on Node.js (Nest.js). The app implements simple organization user structure management operations. The following user roles are supported: a. Administrator (top-most user, only he can change user roles); b. Boss (any user with at least 1 subordinate); c. Regular user (user without subordinates). Each user except the Administrator must have a boss (strictly one). The following REST API endpoints exposed:
- Register user.
- Authenticate as a user.
- Return list of users, taking into account the following:
- administrator can see everyone;
- boss can see herself and all subordinates (recursively);
- regular user can see only himself.
- Change user's boss (only boss can do that and only for his subordinates).
filrsrtName: "Admin"
lastName: "Admin"
enail: "admin@gmail.com"
password: "test"
$ npm install
or
$ yarn install
# development mode
1. Create inside server dir file .env
2. Copy content from .env.dist to .env
3. Change the data in the .env file to required
# generate migrations
$ npm run migration:generate src/db/migrations/migration_name
# run migrations
$ npm run migration:run
# seed table
$ npm run seed:run
# development
$ npm run start
# watch mode
$ npm run start:dev
# production mode
$ npm run start:prod
Change in the .env file variable
from
POSTGRES_HOST=localhost
to
POSTGRES_HOST=docker-host
# build the container
$ docker-compose build
# start the container
$ docker-compose up
# stop the container
$ docker-compose down