A progressive Node.js framework for building efficient and scalable server-side applications.
Nest framework TypeScript starter repository.
This is a project that implements the Prisma ORM to query a simple database (the database is described in the DB section).
- Clone the repository:
git clone https://github.com/Johan-FF/Enterprise-Project-Rest-API---Nest-js.git
cd Enterprise-Project-Rest-API---Nest-js
- Install the required dependencies:
npm install
For the database script see prisma/migrations/20240213152623_init/migration.sql or prisma/schema.prisma.
In general the tables have this structure:
type Enterprise = {
enterpriseId: number;
name: string;
createdAt: Date;
updateAt: Date;
}
type Project = {
projectId: number;
description: string;
name: string;
startDate: Date;
endDate: Date;
createdAt: Date;
updateAt: Date;
state: string;
enterpriseId: number;
}
type User = {
userId: number;
username: string;
password: string;
profesionalHeadline: string;
createdAt: Date;
updateAt: Date;
projectId: number;
enterpriseId: number;
}
type UserProject = {
userProjectId: number;
projectId: number;
userId: number;
}
The UserProject table has a zero or many relationship with the Project and User tables; the User and Project tables have a zero or many relationship with the Enterprise table.
METHOD | URI | BODY | DESCRIPTION |
---|---|---|---|
GET | /enterprise | Returns a list of type Enterprise. | |
GET | /enterprise/:id | Returns a data of type Enterprise. | |
POST | /enterprise | { name: string; } | Creates and returns the complete Enterprise type structure. |
PUT | /enterprise/:id | { name: string; } | Updates and returns the complete Enterprise type structure. |
DELETE | /enterprise/:id | Removes and returns the complete Enterprise type structure. | |
GET | /project | Returns a list of type Project. | |
GET | /project/:id | Returns a data of type Project. | |
POST | /project | { description: string; name: string; state: string; enterpriseId: number; } | Creates and returns the complete Project type structure. |
PUT | /project/:id | { description: string; name: string; state: string; enterpriseId: number; } | Updates and returns the complete Project type structure. |
PUT | /project/start/:id | {} | Updates the value of the Project startDate field. |
PUT | /project/end/:id | {} | Updates the value of the Project endDate field. |
DELETE | /project/:id | Removes and returns the complete Project type structure. | |
GET | /user | Returns a list of type User. | |
GET | /user/:id | Returns a data of type User. | |
POST | /user | { username: string; password: string; profesionalHeadline: string; projectId: number; enterpriseId: number;} | Creates and returns the complete User type structure. |
PUT | /user/:id | { username: string; password: string; profesionalHeadline: string; projectId: number; enterpriseId: number;} | Updates and returns the complete User type structure. |
DELETE | /user/:id | Removes and returns the complete User type structure. | |
GET | /user-project | Returns a list of type UserProject. | |
GET | /user-project/:id | Returns a data of type UserProject. | |
GET | /user-project/projects/:id | Returns a list of records that have the User ID. | |
GET | /user-project/users/:id | Returns a list of records that have the Project ID. | |
DELETE | /user-project/:id | Removes and returns the complete UserProject type structure. |
# development
$ npm run start
# watch mode
$ npm run start:dev
# production mode
$ npm run start:prod
# unit tests
$ npm run test
# e2e tests
$ npm run test:e2e
# test coverage
$ npm run test:cov
Nest is an MIT-licensed open source project. It can grow thanks to the sponsors and support by the amazing backers. If you'd like to join them, please read more here.
- Author - Kamil Myśliwiec
- Website - https://nestjs.com
- Twitter - @nestframework
Nest is MIT licensed.