- Updated pagination-response and read-write-controllers documentation to include `orderBy` and `orderType` parameters for sorting results. - Introduced new `order-clause` module to handle ordering logic, including validation for order types and columns. - Enhanced `PaginationQueryDto` to support ordering fields in API requests. - Updated various repository and service classes to implement ordering in database queries. - Added unit tests for new ordering functionality and ensured existing tests cover the updated behavior. - Refactored related DTOs to include user and code relations for better data representation in responses.
73 lines
2.0 KiB
TypeScript
73 lines
2.0 KiB
TypeScript
import type { CodeRelation, 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 SalesPaymentAllocation = {
|
|
readonly id: string;
|
|
readonly invoiceId: string;
|
|
readonly invoice: CodeRelation | null;
|
|
readonly amount: Decimal;
|
|
};
|
|
|
|
export type SalesPaymentImage = {
|
|
readonly id: string;
|
|
readonly url: string;
|
|
readonly description: string | null;
|
|
};
|
|
|
|
export type SalesPayment = {
|
|
readonly id: string;
|
|
readonly code: string;
|
|
readonly date: DateTime;
|
|
readonly notes: string | null;
|
|
readonly invoices: readonly SalesPaymentAllocation[];
|
|
readonly images: readonly SalesPaymentImage[];
|
|
readonly status: Status;
|
|
readonly createdAt: DateTime;
|
|
readonly updatedAt: DateTime;
|
|
readonly createdBy: string;
|
|
readonly updatedBy: string;
|
|
readonly createdByUser: UserRelation;
|
|
readonly updatedByUser: UserRelation;
|
|
};
|
|
|
|
export type SalesPaymentAllocationInput = {
|
|
readonly invoiceId: string;
|
|
readonly amount: Decimal;
|
|
};
|
|
|
|
export type SalesPaymentImageInput = {
|
|
readonly url: string;
|
|
readonly description?: string | null;
|
|
};
|
|
|
|
export type CreateSalesPaymentInput = {
|
|
readonly code?: string;
|
|
readonly date: DateTime;
|
|
readonly notes?: string | null;
|
|
readonly invoices: readonly SalesPaymentAllocationInput[];
|
|
readonly images?: readonly SalesPaymentImageInput[];
|
|
readonly status?: Status;
|
|
readonly userId: string;
|
|
};
|
|
|
|
export type UpdateSalesPaymentInput = {
|
|
readonly code?: string;
|
|
readonly date?: DateTime;
|
|
readonly notes?: string | null;
|
|
readonly invoices?: readonly SalesPaymentAllocationInput[];
|
|
readonly images?: readonly SalesPaymentImageInput[];
|
|
readonly userId: string;
|
|
};
|
|
|
|
export type ListSalesPaymentsFilters = {
|
|
readonly code?: string;
|
|
readonly status?: string;
|
|
readonly search?: string;
|
|
readonly orderBy?: string;
|
|
readonly orderType?: string;
|
|
readonly limit: number;
|
|
readonly offset: number;
|
|
};
|