feat: update validation and exception handling, refactor controller routes, and enhance sales invoice item DTO

- Removed global validation pipe and added a new ValidationExceptionFilter for better error handling.
- Refactored controller routes to use underscores instead of hyphens for consistency.
- Updated CreateSalesInvoiceItemDto to include new fields: quantity, unit_type, and payload.
- Modified CreateSalesInvoiceDto to enforce items as an array with a minimum size.
- Added Enums module to provide gold karat values through a dedicated endpoint.
- Introduced new columns in the database schema for sales invoice items and goods.
This commit is contained in:
2026-02-16 20:51:34 +03:30
parent a073af76fe
commit 55b96d4f79
28 changed files with 572 additions and 122 deletions
+12
View File
@@ -0,0 +1,12 @@
import { Controller, Get } from '@nestjs/common'
import { EnumsService } from './enums.service'
@Controller('enums')
export class EnumsController {
constructor(private readonly enumsService: EnumsService) {}
@Get('gold_karat')
async getGoldKarat() {
return this.enumsService.getEnumValues('GoldKarat')
}
}
+10
View File
@@ -0,0 +1,10 @@
import { Module } from '@nestjs/common'
import { EnumsController } from './enums.controller'
import { EnumsService } from './enums.service'
@Module({
controllers: [EnumsController],
providers: [EnumsService],
exports: [EnumsService],
})
export class EnumsModule {}
+17
View File
@@ -0,0 +1,17 @@
import { Injectable } from '@nestjs/common'
import { GoldKarat } from '../../common/enums/enums'
import { ResponseMapper } from '../../common/response/response-mapper'
@Injectable()
export class EnumsService {
getAllEnums() {
return {
GoldKarat: Object.values(GoldKarat).filter(value => typeof value === 'string'),
}
}
getEnumValues(enumName: string) {
const enums = this.getAllEnums()
return ResponseMapper.list(enums[enumName] || [])
}
}