Add address fields to sales invoices and implement related validations

- Introduced new columns `address`, `latitude`, and `longitude` in the `sales_invoices` table to store location details.
- Updated the `SalesInvoicesService` to handle the new fields, including validation for address format and geographical coordinates.
- Enhanced the `SalesInvoiceDto` and related data transfer objects to include the new fields for API requests and responses.
- Added unit and e2e tests to ensure proper handling of the new fields and validate their integration within the sales invoice workflow.
- Created a new migration script to apply the database schema changes for the sales invoices.
This commit is contained in:
shancheas
2026-09-01 09:50:19 +07:00
parent 23028abd48
commit 0e73d14381
23 changed files with 444 additions and 33 deletions
@@ -1,5 +1,5 @@
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
import { Type } from 'class-transformer';
import { Transform, Type } from 'class-transformer';
import {
ArrayNotEmpty,
IsArray,
@@ -19,6 +19,7 @@ import {
CodeRelationDto,
DefaultRelationDto,
PaginationQueryDto,
parseQueryIdList,
UserRelationDto,
} from '../../../../common/http/response';
import {
@@ -213,6 +214,13 @@ export class ListPackingSlipsQueryDto extends PaginationQueryDto {
@IsUUID('4')
customerId?: string;
@ApiPropertyOptional({ type: [String], format: 'uuid' })
@IsOptional()
@Transform(({ value }) => parseQueryIdList(value))
@IsArray()
@IsUUID('4', { each: true })
customerIds?: string[];
@ApiPropertyOptional({ format: 'uuid' })
@IsOptional()
@IsUUID('4')