add : filter invoice by bill id
This commit is contained in:
@@ -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