update: add no paginate to the user get
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user