A progressive Node.js framework for building efficient and scalable server-side applications
Carboard Vehicles Rental specializes in providing a wide range of rental vehicles, from compact cars to luxury SUVs, catering to diverse transportation needs. Our fleet includes environmentally friendly options, ensuring both comfort and sustainability. Discover seamless rental experiences with flexible terms and exceptional customer service, tailored to meet every travel requirement.
Before running the application, ensure you have the following installed:
- Node.js
- npm or yarn
- PostgreSQL
- Clone this repository
git clone <repository-url>
cd <repository-name>
- Install dependencies:
$ npm install
# or
$ yarn install
- Set up environment variables: Create a .env file in the root directory and configure the DATABASE_URL for your PostgreSQL database.
PORT=
DATABASE_URL=
API_PREFIX=
JWT_SECRET=
JWT_EXPIRES_IN=
CLOUDINARY_API_KEY=
CLOUDINARY_API_SECRET=
CLOUDINARY_CLOUD_NAME=
- Run migrations:
npx prisma migrate dev
This will apply migrations defined in your Prisma schema to your database.
- Start the application:
$ npm run start
# or
$ yarn start
The application will be accessible at http://localhost:{port}.
Below is a summary of the Prisma schema used in this application:
generator client {
provider = "prisma-client-js"
}
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}
model users {
id Int @id @default(autoincrement())
name String
email String @unique
password String
address String?
avatar String?
phone_number String?
role String
created_at DateTime? @default(now())
updated_at DateTime? @updatedAt
deleted_at DateTime?
}
model products {
id Int @id @default(autoincrement())
name String
description String
id_type Int
id_mark Int
price Float
seat Int
id_transmission Int
id_fuel Int
image String?
created_at DateTime? @default(now())
updated_at DateTime? @updatedAt
deleted_at DateTime?
type types @relation(fields: [id_type], references: [id])
mark marks @relation(fields: [id_mark], references: [id])
transmission transmissions @relation(fields: [id_transmission], references: [id])
fuels fuels @relation(fields: [id_fuel], references: [id])
}
model types {
id Int @id @default(autoincrement())
name String
description String?
products products[]
created_at DateTime? @default(now())
updated_at DateTime? @updatedAt
deleted_at DateTime?
}
model marks {
id Int @id @default(autoincrement())
name String
description String?
products products[]
created_at DateTime? @default(now())
updated_at DateTime? @updatedAt
deleted_at DateTime?
}
model transmissions {
id Int @id @default(autoincrement())
name String
description String?
products products[]
created_at DateTime? @default(now())
updated_at DateTime? @updatedAt
deleted_at DateTime?
}
model fuels {
id Int @id @default(autoincrement())
name String
description String?
products products[]
created_at DateTime? @default(now())
updated_at DateTime? @updatedAt
deleted_at DateTime?
}
- Register : POST /register
{
"name": "John Doe",
"email": "john.doe@example.com",
"password": "password",
"role": "user"
}
- Login : POST /login
{
"email": "john.doe@example.com",
"password": "password",
}
- Create a Product: POST /products
{
"name": "Product Name",
"description": "Product Description",
"id_type": 1, // unit of measurment relation
"id_mark": 1, // unit of measurment relation
"price": 99.99, // unit of measurment relation
"seat": 5,
"id_transmission": 1, // unit of measurment relation
"id_fuel": 1, // unit of measurment relation
"image": "http://example.com/image.jpg" //integrated with cloudinary
}
- Get All Products: GET /products
- Get Product by ID: GET /products/:id
- Update Product: PATCH /products/:id
- Delete Product: DELETE /products/:id
Another endpoint service you can check in /src folder and response data from /dto
# unit tests
$ yarn run test
# e2e tests
$ yarn run test:e2e
# test coverage
$ yarn 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.
Hi, this is only product management cardboard vehicles, next version build with relation transaction and payment, cheers up!