- 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.
88 lines
2.6 KiB
TypeScript
88 lines
2.6 KiB
TypeScript
import type {
|
|
CodeRelation,
|
|
DefaultRelation,
|
|
UserRelation,
|
|
} from '../../../common/http/response';
|
|
import { DateTime } from '../../../common/value-objects/date-time/date-time';
|
|
import { Decimal } from '../../../common/value-objects/decimal/decimal';
|
|
import { Status } from '../../../common/value-objects/status/status';
|
|
|
|
export type PackingSlipLine = {
|
|
readonly id: string;
|
|
readonly productId: string;
|
|
readonly product: DefaultRelation | null;
|
|
readonly quantity: Decimal;
|
|
readonly price: Decimal;
|
|
};
|
|
|
|
export type PackingSlip = {
|
|
readonly id: string;
|
|
readonly code: string;
|
|
readonly salesOrderId: string | null;
|
|
readonly salesOrderNumber: string | null;
|
|
readonly date: DateTime;
|
|
readonly customerId: string;
|
|
readonly address: string;
|
|
readonly latitude: number | null;
|
|
readonly longitude: number | null;
|
|
readonly notes: string | null;
|
|
readonly products: readonly PackingSlipLine[];
|
|
readonly status: Status;
|
|
readonly createdAt: DateTime;
|
|
readonly updatedAt: DateTime;
|
|
readonly createdBy: string;
|
|
readonly updatedBy: string;
|
|
readonly salesOrder: CodeRelation | null;
|
|
readonly customer: DefaultRelation | null;
|
|
readonly createdByUser: UserRelation;
|
|
readonly updatedByUser: UserRelation;
|
|
};
|
|
|
|
export type PackingSlipLineInput = {
|
|
readonly productId: string;
|
|
readonly quantity: Decimal;
|
|
readonly price: Decimal;
|
|
};
|
|
|
|
export type CreatePackingSlipInput = {
|
|
readonly code?: string;
|
|
readonly salesOrderId?: string | null;
|
|
readonly salesOrderNumber?: string | null;
|
|
readonly date: DateTime;
|
|
readonly customerId: string;
|
|
readonly address: string;
|
|
readonly latitude?: number | null;
|
|
readonly longitude?: number | null;
|
|
readonly notes?: string | null;
|
|
readonly products: readonly PackingSlipLineInput[];
|
|
readonly status?: Status;
|
|
readonly userId: string;
|
|
};
|
|
|
|
export type UpdatePackingSlipInput = {
|
|
readonly code?: string;
|
|
readonly salesOrderId?: string | null;
|
|
readonly salesOrderNumber?: string | null;
|
|
readonly date?: DateTime;
|
|
readonly customerId?: string;
|
|
readonly address?: string;
|
|
readonly latitude?: number | null;
|
|
readonly longitude?: number | null;
|
|
readonly notes?: string | null;
|
|
readonly products?: readonly PackingSlipLineInput[];
|
|
readonly userId: string;
|
|
};
|
|
|
|
export type ListPackingSlipsFilters = {
|
|
readonly code?: string;
|
|
readonly status?: string;
|
|
readonly customerId?: string;
|
|
readonly customerIds?: readonly string[];
|
|
readonly salesOrderId?: string;
|
|
readonly search?: string;
|
|
readonly orderBy?: string;
|
|
readonly orderType?: string;
|
|
readonly limit: number;
|
|
readonly offset: number;
|
|
};
|