update: add no paginate to the user get

This commit is contained in:
Mahyargdz
2025-05-12 12:23:13 +03:30
parent e8402b673f
commit e3a75f16a0
6 changed files with 72 additions and 7 deletions
@@ -693,12 +693,17 @@ export class InvoicesService {
relations: { user: true },
});
if (discount?.user?.id && discount?.user?.id !== userId) throw new BadRequestException(InvoiceMessage.DISCOUNT_NOT_FOR_THIS_USER);
if (!discount) throw new BadRequestException(InvoiceMessage.INVALID_DISCOUNT_CODE);
if (discount?.user?.id && discount?.user?.id !== userId) throw new BadRequestException(InvoiceMessage.DISCOUNT_NOT_FOR_THIS_USER);
if (discount?.isActive) throw new BadRequestException(InvoiceMessage.DISCOUNT_IS_NOT_ACTIVE);
if (discount.endDate && dayjs(discount.endDate).isBefore(dayjs())) throw new BadRequestException(InvoiceMessage.DISCOUNT_EXPIRED);
if (discount.startDate && dayjs(discount.startDate).isAfter(dayjs()))
throw new BadRequestException(InvoiceMessage.DISCOUNT_NOT_STARTED);
if (!invoice.originalPrice) invoice.originalPrice = new Decimal(invoice.totalPrice);
let discountAmount: Decimal;