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
@@ -27,6 +27,9 @@ export type SalesInvoice = {
readonly branchId: string;
readonly divisionId: string;
readonly customerId: string;
readonly address: string;
readonly latitude: number | null;
readonly longitude: number | null;
readonly notes: string | null;
readonly balance: Decimal;
readonly products: readonly SalesInvoiceLine[];
@@ -62,6 +65,9 @@ export type CreateSalesInvoiceInput = {
readonly branchId: string;
readonly divisionId: string;
readonly customerId: string;
readonly address: string;
readonly latitude?: number | null;
readonly longitude?: number | null;
readonly notes?: string | null;
readonly products: readonly SalesInvoiceLineInput[];
readonly status?: Status;
@@ -79,6 +85,9 @@ export type UpdateSalesInvoiceInput = {
readonly branchId?: string;
readonly divisionId?: string;
readonly customerId?: string;
readonly address?: string;
readonly latitude?: number | null;
readonly longitude?: number | null;
readonly notes?: string | null;
readonly products?: readonly SalesInvoiceLineInput[];
readonly userId: string;
@@ -88,6 +97,7 @@ export type ListSalesInvoicesFilters = {
readonly code?: string;
readonly status?: string;
readonly customerId?: string;
readonly customerIds?: readonly string[];
readonly salesPersonId?: string;
readonly branchId?: string;
readonly divisionId?: string;