feat: add product variant management functionality
- Implemented CreateProductVariantDto and UpdateProductVariantDto for product variant data transfer. - Developed ProductVariantsController to handle CRUD operations for product variants. - Created ProductVariantsService to interact with the database using Prisma. - Added ProductVariantsModule to encapsulate the product variant feature. - Included response mapping for consistent API responses.
This commit is contained in:
+8
-1
@@ -1,7 +1,8 @@
|
||||
import { VersioningType } from '@nestjs/common'
|
||||
import { ValidationPipe, VersioningType } from '@nestjs/common'
|
||||
import { NestFactory } from '@nestjs/core'
|
||||
import { DocumentBuilder, SwaggerModule } from '@nestjs/swagger'
|
||||
import { AppModule } from './app.module'
|
||||
import { PrismaExceptionFilter } from './common/filters/prisma-exception.filter'
|
||||
import { LoggingInterceptor } from './common/interceptors/logging.interceptor'
|
||||
import { ResponseMappingInterceptor } from './common/interceptors/response-mapping.interceptor'
|
||||
|
||||
@@ -43,6 +44,12 @@ async function bootstrap() {
|
||||
// Register global logging and response mapping interceptors
|
||||
app.useGlobalInterceptors(new LoggingInterceptor(), new ResponseMappingInterceptor())
|
||||
|
||||
// Enable request validation and transformation globally
|
||||
app.useGlobalPipes(new ValidationPipe({ whitelist: true, transform: true }))
|
||||
|
||||
// Register global exception filter to map Prisma and validation errors to proper HTTP codes
|
||||
app.useGlobalFilters(new PrismaExceptionFilter())
|
||||
|
||||
await app.listen(process.env.PORT ?? 3000)
|
||||
}
|
||||
bootstrap()
|
||||
|
||||
Reference in New Issue
Block a user