add : filter invoice by bill id
This commit is contained in:
@@ -474,6 +474,7 @@ export const enum InvoiceMessage {
|
||||
DISCOUNT_MUST_BE_BETWEEN_0_AND_100 = "تخفیف باید بین ۰ تا ۱۰۰ باشد",
|
||||
TOTAL_PRICE_MUST_BE_POSITIVE = "قیمت کل باید مثبت باشد",
|
||||
DISCOUNT_NOT_FOR_THIS_USER = "این تخفیف برای شما معتبر نیست",
|
||||
BILL_ID_SHOULD_BE_A_UUID = "شناسه قبض باید یک UUID معتبر باشد",
|
||||
}
|
||||
|
||||
export const enum EmailMessage {
|
||||
|
||||
@@ -16,6 +16,11 @@ export class InvoicesSearchQueryDto extends PaginationDto {
|
||||
@ApiPropertyOptional({ description: "company id", example: "123e4567-e89b-12d3-a456-426614174000" })
|
||||
companyId?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsUUID("7", { message: InvoiceMessage.BILL_ID_SHOULD_BE_A_UUID })
|
||||
@ApiPropertyOptional({ description: "bill id", example: "" })
|
||||
billId?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsEnum(InvoiceStatus)
|
||||
@ApiPropertyOptional({ enum: InvoiceStatus, description: "invoice status", example: InvoiceStatus.PAID })
|
||||
|
||||
@@ -28,6 +28,10 @@ export class InvoicesRepository extends EntityRepository<Invoice> {
|
||||
where.company = { id: queryDto.companyId };
|
||||
}
|
||||
|
||||
if (queryDto.billId) {
|
||||
where.bill = { id: queryDto.billId };
|
||||
}
|
||||
|
||||
if (queryDto.since || queryDto.to) {
|
||||
const dateConditions = [];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user