feat: implement inventory, product brand, product category, product info, product, role, store, user, and vendor modules with CRUD operations
- Added Create and Update DTOs for Inventory, Product Brand, Product Category, Product Info, Product, Role, Store, User, and Vendor. - Implemented InventoriesController, ProductBrandsController, ProductCategoriesController, ProductInfoController, ProductsController, RolesController, StoresController, UsersController, and VendorsController with respective CRUD endpoints. - Developed InventoriesService, ProductBrandsService, ProductCategoriesService, ProductInfoService, ProductsService, RolesService, StoresService, UsersService, and VendorsService to handle business logic. - Created PrismaModule and PrismaService for database interactions using Prisma with MariaDB adapter. - Configured application with Swagger for API documentation and added global interceptors for logging and response mapping. - Established e2e testing setup with Jest for the application.
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
import { Injectable, OnModuleDestroy, OnModuleInit } from '@nestjs/common'
|
||||
import { PrismaMariaDb } from '@prisma/adapter-mariadb'
|
||||
import 'dotenv/config'
|
||||
import { env } from 'prisma/config'
|
||||
import { PrismaClient } from '../generated/prisma/client'
|
||||
|
||||
@Injectable()
|
||||
export class PrismaService extends PrismaClient implements OnModuleInit, OnModuleDestroy {
|
||||
constructor() {
|
||||
const adapter = new PrismaMariaDb({
|
||||
host: env('DATABASE_HOST'),
|
||||
user: env('DATABASE_USER'),
|
||||
password: env('DATABASE_PASSWORD'),
|
||||
database: env('DATABASE_NAME'),
|
||||
connectionLimit: 5,
|
||||
})
|
||||
super({ adapter })
|
||||
}
|
||||
|
||||
async onModuleInit() {
|
||||
await this.$connect()
|
||||
}
|
||||
|
||||
async onModuleDestroy() {
|
||||
await this.$disconnect()
|
||||
}
|
||||
|
||||
// async enableShutdownHooks(app: any) {
|
||||
// this.$on('beforeExit', async () => {
|
||||
// await app.close()
|
||||
// })
|
||||
// }
|
||||
}
|
||||
Reference in New Issue
Block a user