@react-pakistan/util-functions 1.22.41 → 1.22.43

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -6,6 +6,14 @@ interface GetPaymentByIdArgs {
6
6
  id: string;
7
7
  prisma: any;
8
8
  }
9
+ interface PostPaymentsArgs {
10
+ currentPage: number;
11
+ pageLimit: number;
12
+ prisma: any;
13
+ queryWhere: {
14
+ [key: string]: any;
15
+ };
16
+ }
9
17
  interface PostPaymentArgs {
10
18
  id: string;
11
19
  amount: string;
@@ -25,6 +33,7 @@ interface DeletePaymentArgs {
25
33
  }
26
34
  export declare const getPayments: ({ prisma, }: GetPaymentsArgs) => Promise<Array<PaymentBE>>;
27
35
  export declare const getPaymentById: ({ id, prisma, }: GetPaymentByIdArgs) => Promise<PaymentBE>;
36
+ export declare const postPayments: ({ currentPage, pageLimit, prisma, queryWhere, }: PostPaymentsArgs) => Promise<Array<PaymentBE>>;
28
37
  export declare const postPayment: ({ id, amount, attachment, currency, date, description, mode, paymentType, ref, quoteInvoiceId, prisma, }: PostPaymentArgs) => Promise<Array<PaymentBE>>;
29
38
  export declare const deletePayment: ({ id, prisma, }: DeletePaymentArgs) => Promise<PaymentBE>;
30
39
  export {};
@@ -10,7 +10,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  });
11
11
  };
12
12
  Object.defineProperty(exports, "__esModule", { value: true });
13
- exports.deletePayment = exports.postPayment = exports.getPaymentById = exports.getPayments = void 0;
13
+ exports.deletePayment = exports.postPayment = exports.postPayments = exports.getPaymentById = exports.getPayments = void 0;
14
14
  const getPayments = (_a) => __awaiter(void 0, [_a], void 0, function* ({ prisma, }) {
15
15
  const payments = yield prisma.stellarPayment.findMany({
16
16
  orderBy: {
@@ -29,7 +29,24 @@ const getPaymentById = (_b) => __awaiter(void 0, [_b], void 0, function* ({ id,
29
29
  return payment;
30
30
  });
31
31
  exports.getPaymentById = getPaymentById;
32
- const postPayment = (_c) => __awaiter(void 0, [_c], void 0, function* ({ id, amount, attachment, currency, date, description, mode, paymentType, ref, quoteInvoiceId, prisma, }) {
32
+ const postPayments = (_c) => __awaiter(void 0, [_c], void 0, function* ({ currentPage, pageLimit, prisma, queryWhere, }) {
33
+ const payments = yield prisma.$transaction([
34
+ prisma.stellarPayment.count({
35
+ where: queryWhere,
36
+ }),
37
+ prisma.stellarPayment.findMany({
38
+ orderBy: {
39
+ createdAt: 'desc',
40
+ },
41
+ where: queryWhere,
42
+ take: pageLimit,
43
+ skip: currentPage === 1 ? 0 : currentPage - 1 * pageLimit,
44
+ }),
45
+ ]);
46
+ return payments;
47
+ });
48
+ exports.postPayments = postPayments;
49
+ const postPayment = (_d) => __awaiter(void 0, [_d], void 0, function* ({ id, amount, attachment, currency, date, description, mode, paymentType, ref, quoteInvoiceId, prisma, }) {
33
50
  const payment = yield prisma.stellarPayment.upsert({
34
51
  where: {
35
52
  id,
@@ -60,7 +77,7 @@ const postPayment = (_c) => __awaiter(void 0, [_c], void 0, function* ({ id, amo
60
77
  return payment;
61
78
  });
62
79
  exports.postPayment = postPayment;
63
- const deletePayment = (_d) => __awaiter(void 0, [_d], void 0, function* ({ id, prisma, }) {
80
+ const deletePayment = (_e) => __awaiter(void 0, [_e], void 0, function* ({ id, prisma, }) {
64
81
  const payment = yield prisma.stellarPayment.delete({
65
82
  where: {
66
83
  id,
@@ -50,5 +50,5 @@ export declare const getQuotesInvoices: ({ prisma, }: GetQuotesInvoicesArgs) =>
50
50
  export declare const getQuoteInvoiceById: ({ prisma, id, }: GetQuoteInvoiceByIdArgs) => Promise<QuoteInvoiceBE>;
51
51
  export declare const postQuotesInvoices: ({ currentPage, pageLimit, prisma, queryWhere, }: PostQuotesInvoicesArgs) => Promise<Array<QuoteInvoiceBE>>;
52
52
  export declare const postQuoteInvoice: ({ category, companyId, currency, customerId, date, discount, discountUnit, expiryDate, id, mode, note, ref, services, status, subTotal, taxValue, total, productIds, phone, lastName, firstName, email, country, city, address, prisma, }: PostQuoteInvoiceArgs) => Promise<Array<QuoteInvoiceBE>>;
53
- export declare const DeleteQuoteInvoice: ({ prisma, id, }: DeleteQuoteInvoiceArgs) => Promise<QuoteInvoiceBE>;
53
+ export declare const deleteQuoteInvoice: ({ prisma, id, }: DeleteQuoteInvoiceArgs) => Promise<QuoteInvoiceBE>;
54
54
  export {};
@@ -10,7 +10,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  });
11
11
  };
12
12
  Object.defineProperty(exports, "__esModule", { value: true });
13
- exports.DeleteQuoteInvoice = exports.postQuoteInvoice = exports.postQuotesInvoices = exports.getQuoteInvoiceById = exports.getQuotesInvoices = void 0;
13
+ exports.deleteQuoteInvoice = exports.postQuoteInvoice = exports.postQuotesInvoices = exports.getQuoteInvoiceById = exports.getQuotesInvoices = void 0;
14
14
  const getQuotesInvoices = (_a) => __awaiter(void 0, [_a], void 0, function* ({ prisma, }) {
15
15
  const quotesInvoices = yield prisma.stellarQuoteInvoice.findMany({
16
16
  orderBy: {
@@ -203,7 +203,7 @@ const postQuoteInvoice = (_d) => __awaiter(void 0, [_d], void 0, function* ({ ca
203
203
  return quoteInvoice;
204
204
  });
205
205
  exports.postQuoteInvoice = postQuoteInvoice;
206
- const DeleteQuoteInvoice = (_e) => __awaiter(void 0, [_e], void 0, function* ({ prisma, id, }) {
206
+ const deleteQuoteInvoice = (_e) => __awaiter(void 0, [_e], void 0, function* ({ prisma, id, }) {
207
207
  const quoteInvoice = yield prisma.stellarQuoteInvoice.delete({
208
208
  where: {
209
209
  id,
@@ -211,4 +211,4 @@ const DeleteQuoteInvoice = (_e) => __awaiter(void 0, [_e], void 0, function* ({
211
211
  });
212
212
  return quoteInvoice;
213
213
  });
214
- exports.DeleteQuoteInvoice = DeleteQuoteInvoice;
214
+ exports.deleteQuoteInvoice = deleteQuoteInvoice;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-pakistan/util-functions",
3
- "version": "1.22.41",
3
+ "version": "1.22.43",
4
4
  "description": "A library of all util functions",
5
5
  "main": "index.js",
6
6
  "scripts": {