@react-pakistan/util-functions 1.23.1 → 1.23.3

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.
@@ -15,18 +15,18 @@ interface PostPaymentsArgs {
15
15
  };
16
16
  }
17
17
  interface PostPaymentArgs {
18
- id: string;
19
18
  amount: string;
20
19
  attachment: string;
20
+ createdAt: string;
21
21
  currency: string;
22
22
  date: string;
23
23
  description: string;
24
+ id: string;
24
25
  mode: string;
25
26
  paymentType: string;
26
- ref: string;
27
- quoteInvoiceId: string;
28
27
  prisma: any;
29
- createdAt: string;
28
+ quoteInvoiceId: string;
29
+ ref: string;
30
30
  }
31
31
  interface DeletePaymentArgs {
32
32
  prisma: any;
@@ -35,6 +35,6 @@ interface DeletePaymentArgs {
35
35
  export declare const getPayments: ({ prisma, }: GetPaymentsArgs) => Promise<Array<PaymentBE>>;
36
36
  export declare const getPaymentById: ({ id, prisma, }: GetPaymentByIdArgs) => Promise<PaymentBE>;
37
37
  export declare const postPayments: ({ currentPage, pageLimit, prisma, queryWhere, }: PostPaymentsArgs) => Promise<Array<PaymentBE>>;
38
- export declare const postPayment: ({ id, amount, attachment, currency, date, description, mode, paymentType, ref, quoteInvoiceId, prisma, createdAt, }: PostPaymentArgs) => Promise<Array<PaymentBE>>;
38
+ export declare const postPayment: ({ amount, attachment, createdAt, currency, date, description, id, mode, paymentType, prisma, quoteInvoiceId, ref, }: PostPaymentArgs) => Promise<Array<PaymentBE>>;
39
39
  export declare const deletePayment: ({ id, prisma, }: DeletePaymentArgs) => Promise<PaymentBE>;
40
40
  export {};
@@ -49,7 +49,16 @@ const postPayments = (_c) => __awaiter(void 0, [_c], void 0, function* ({ curren
49
49
  return payments;
50
50
  });
51
51
  exports.postPayments = postPayments;
52
- const postPayment = (_d) => __awaiter(void 0, [_d], void 0, function* ({ id, amount, attachment, currency, date, description, mode, paymentType, ref, quoteInvoiceId, prisma, createdAt, }) {
52
+ const postPayment = (_d) => __awaiter(void 0, [_d], void 0, function* ({ amount, attachment, createdAt, currency, date, description, id, mode, paymentType, prisma, quoteInvoiceId, ref, }) {
53
+ const allPaymentsForInvoice = yield prisma.payments.findMany({
54
+ where: {
55
+ quoteInvoiceId,
56
+ },
57
+ include: {
58
+ quoteInvoice: true,
59
+ },
60
+ });
61
+ console.log('=>', allPaymentsForInvoice);
53
62
  const payment = yield prisma.payment.upsert({
54
63
  where: {
55
64
  id,
@@ -64,6 +73,7 @@ const postPayment = (_d) => __awaiter(void 0, [_d], void 0, function* ({ id, amo
64
73
  paymentType,
65
74
  quoteInvoiceId,
66
75
  ref,
76
+ balance: '0',
67
77
  },
68
78
  create: {
69
79
  amount,
@@ -76,6 +86,7 @@ const postPayment = (_d) => __awaiter(void 0, [_d], void 0, function* ({ id, amo
76
86
  quoteInvoiceId,
77
87
  ref,
78
88
  createdAt,
89
+ balance: '0',
79
90
  },
80
91
  });
81
92
  return payment;
@@ -15,36 +15,37 @@ interface PostQuotesInvoicesArgs {
15
15
  };
16
16
  }
17
17
  interface PostQuoteInvoiceArgs {
18
+ address: string;
18
19
  category: string;
20
+ city: string;
19
21
  companyId: string;
22
+ country: string;
23
+ createdAt: string;
20
24
  currency: string;
21
25
  customerId: string;
22
26
  date: string;
23
27
  discount: string;
24
28
  discountUnit: string;
29
+ email: string;
25
30
  expiryDate: string;
31
+ firstName: string;
26
32
  id: string;
33
+ invoiceStatus: string;
34
+ lastName: string;
27
35
  mode: string;
28
36
  note: string;
37
+ phone: string;
38
+ prisma: any;
39
+ products: [{
40
+ id: string;
41
+ productQuantity: string;
42
+ }] | undefined;
43
+ quoteStatus: string;
29
44
  ref: string;
30
45
  services: any[] | undefined;
31
- status: string;
32
46
  subTotal: string;
33
47
  taxValue: string;
34
48
  total: string;
35
- products: [{
36
- id: string;
37
- productQuantity: string;
38
- }] | undefined;
39
- createdAt: string;
40
- phone: string;
41
- lastName: string;
42
- firstName: string;
43
- email: string;
44
- country: string;
45
- city: string;
46
- address: string;
47
- prisma: any;
48
49
  }
49
50
  interface DeleteQuoteInvoiceArgs {
50
51
  prisma: any;
@@ -53,6 +54,6 @@ interface DeleteQuoteInvoiceArgs {
53
54
  export declare const getQuotesInvoices: ({ prisma, }: GetQuotesInvoicesArgs) => Promise<Array<QuoteInvoiceBE>>;
54
55
  export declare const getQuoteInvoiceById: ({ prisma, id, }: GetQuoteInvoiceByIdArgs) => Promise<QuoteInvoiceBE>;
55
56
  export declare const postQuotesInvoices: ({ currentPage, pageLimit, prisma, queryWhere, }: PostQuotesInvoicesArgs) => Promise<Array<QuoteInvoiceBE>>;
56
- export declare const postQuoteInvoice: ({ category, companyId, currency, customerId, date, discount, discountUnit, expiryDate, id, mode, note, ref, services, status, subTotal, taxValue, total, products, createdAt, phone, lastName, firstName, email, country, city, address, prisma, }: PostQuoteInvoiceArgs) => Promise<QuoteInvoiceBE>;
57
+ export declare const postQuoteInvoice: ({ address, category, city, companyId, country, createdAt, currency, customerId, date, discount, discountUnit, email, expiryDate, firstName, id, invoiceStatus, lastName, mode, note, phone, prisma, products, quoteStatus, ref, services, subTotal, taxValue, total, }: PostQuoteInvoiceArgs) => Promise<QuoteInvoiceBE>;
57
58
  export declare const deleteQuoteInvoice: ({ prisma, id, }: DeleteQuoteInvoiceArgs) => Promise<QuoteInvoiceBE>;
58
59
  export {};
@@ -67,7 +67,7 @@ const postQuotesInvoices = (_c) => __awaiter(void 0, [_c], void 0, function* ({
67
67
  return quotesInvoices;
68
68
  });
69
69
  exports.postQuotesInvoices = postQuotesInvoices;
70
- const postQuoteInvoice = (_d) => __awaiter(void 0, [_d], void 0, function* ({ category, companyId, currency, customerId, date, discount, discountUnit, expiryDate, id, mode, note, ref, services, status, subTotal, taxValue, total, products, createdAt, phone, lastName, firstName, email, country, city, address, prisma, }) {
70
+ const postQuoteInvoice = (_d) => __awaiter(void 0, [_d], void 0, function* ({ address, category, city, companyId, country, createdAt, currency, customerId, date, discount, discountUnit, email, expiryDate, firstName, id, invoiceStatus, lastName, mode, note, phone, prisma, products, quoteStatus, ref, services, subTotal, taxValue, total, }) {
71
71
  var _e;
72
72
  let quoteInvoice;
73
73
  if (mode === 'Create') {
@@ -81,7 +81,8 @@ const postQuoteInvoice = (_d) => __awaiter(void 0, [_d], void 0, function* ({ ca
81
81
  }
82
82
  if (customerId || companyId) {
83
83
  quoteInvoice = yield prisma.quoteInvoice.create({
84
- data: Object.assign({ category,
84
+ data: Object.assign({ id,
85
+ category,
85
86
  companyId,
86
87
  currency,
87
88
  customerId,
@@ -91,7 +92,8 @@ const postQuoteInvoice = (_d) => __awaiter(void 0, [_d], void 0, function* ({ ca
91
92
  expiryDate,
92
93
  note,
93
94
  ref,
94
- status,
95
+ quoteStatus,
96
+ invoiceStatus,
95
97
  subTotal,
96
98
  taxValue,
97
99
  total,
@@ -120,6 +122,7 @@ const postQuoteInvoice = (_d) => __awaiter(void 0, [_d], void 0, function* ({ ca
120
122
  else {
121
123
  quoteInvoice = yield prisma.quoteInvoice.create({
122
124
  data: {
125
+ id,
123
126
  category,
124
127
  companyId,
125
128
  currency,
@@ -130,10 +133,12 @@ const postQuoteInvoice = (_d) => __awaiter(void 0, [_d], void 0, function* ({ ca
130
133
  expiryDate,
131
134
  note,
132
135
  ref,
133
- status,
136
+ quoteStatus,
137
+ invoiceStatus,
134
138
  subTotal,
135
139
  taxValue,
136
140
  total,
141
+ createdAt,
137
142
  customer: {
138
143
  create: {
139
144
  address,
@@ -197,7 +202,8 @@ const postQuoteInvoice = (_d) => __awaiter(void 0, [_d], void 0, function* ({ ca
197
202
  expiryDate,
198
203
  note,
199
204
  ref,
200
- status,
205
+ quoteStatus,
206
+ invoiceStatus,
201
207
  subTotal,
202
208
  taxValue,
203
209
  total }),
@@ -1,9 +1,15 @@
1
1
  import { QuoteInvoiceBE } from '../type';
2
2
  interface PostQuotesInvoicesReportArgs {
3
+ include: {
4
+ [key: string]: any;
5
+ };
6
+ orderBy: {
7
+ [key: string]: any;
8
+ };
3
9
  prisma: any;
4
10
  queryWhere: {
5
11
  [key: string]: any;
6
12
  };
7
13
  }
8
- export declare const postQuotesInvoicesReport: ({ prisma, queryWhere, }: PostQuotesInvoicesReportArgs) => Promise<Array<QuoteInvoiceBE>>;
14
+ export declare const postQuotesInvoicesReport: ({ include, orderBy, prisma, queryWhere, }: PostQuotesInvoicesReportArgs) => Promise<Array<QuoteInvoiceBE>>;
9
15
  export {};
@@ -11,22 +11,14 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
11
11
  };
12
12
  Object.defineProperty(exports, "__esModule", { value: true });
13
13
  exports.postQuotesInvoicesReport = void 0;
14
- const postQuotesInvoicesReport = (_a) => __awaiter(void 0, [_a], void 0, function* ({ prisma, queryWhere, }) {
14
+ const postQuotesInvoicesReport = (_a) => __awaiter(void 0, [_a], void 0, function* ({ include, orderBy, prisma, queryWhere, }) {
15
15
  const quotesInvoices = yield prisma.$transaction([
16
16
  prisma.quoteInvoice.count({
17
17
  where: queryWhere,
18
18
  }),
19
19
  prisma.quoteInvoice.findMany({
20
- orderBy: {
21
- createdAt: 'desc',
22
- },
23
- include: {
24
- company: true,
25
- customer: true,
26
- payments: true,
27
- products: true,
28
- services: true,
29
- },
20
+ include,
21
+ orderBy,
30
22
  where: queryWhere,
31
23
  }),
32
24
  ]);
package/index.d.ts CHANGED
@@ -12,7 +12,6 @@ export * from './api/stellar-solutions/expense-category';
12
12
  export * from './api/stellar-solutions/lead';
13
13
  export * from './api/stellar-solutions/menu-order';
14
14
  export * from './api/stellar-solutions/payment';
15
- export * from './api/stellar-solutions/payment-report';
16
15
  export * from './api/stellar-solutions/payment-mode';
17
16
  export * from './api/stellar-solutions/preference';
18
17
  export * from './api/stellar-solutions/product';
package/index.js CHANGED
@@ -28,7 +28,6 @@ __exportStar(require("./api/stellar-solutions/expense-category"), exports);
28
28
  __exportStar(require("./api/stellar-solutions/lead"), exports);
29
29
  __exportStar(require("./api/stellar-solutions/menu-order"), exports);
30
30
  __exportStar(require("./api/stellar-solutions/payment"), exports);
31
- __exportStar(require("./api/stellar-solutions/payment-report"), exports);
32
31
  __exportStar(require("./api/stellar-solutions/payment-mode"), exports);
33
32
  __exportStar(require("./api/stellar-solutions/preference"), exports);
34
33
  __exportStar(require("./api/stellar-solutions/product"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-pakistan/util-functions",
3
- "version": "1.23.1",
3
+ "version": "1.23.3",
4
4
  "description": "A library of all util functions",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -1,9 +0,0 @@
1
- import { PaymentBE } from '../type';
2
- interface PostPaymentsReportArgs {
3
- prisma: any;
4
- queryWhere: {
5
- [key: string]: any;
6
- };
7
- }
8
- export declare const postPaymentsReport: ({ prisma, queryWhere, }: PostPaymentsReportArgs) => Promise<Array<PaymentBE>>;
9
- export {};
@@ -1,31 +0,0 @@
1
- "use strict";
2
- /* eslint-disable @typescript-eslint/no-explicit-any, no-restricted-globals */
3
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
4
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
5
- return new (P || (P = Promise))(function (resolve, reject) {
6
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
7
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
8
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
9
- step((generator = generator.apply(thisArg, _arguments || [])).next());
10
- });
11
- };
12
- Object.defineProperty(exports, "__esModule", { value: true });
13
- exports.postPaymentsReport = void 0;
14
- const postPaymentsReport = (_a) => __awaiter(void 0, [_a], void 0, function* ({ prisma, queryWhere, }) {
15
- const payments = yield prisma.$transaction([
16
- prisma.payment.count({
17
- where: queryWhere,
18
- }),
19
- prisma.payment.findMany({
20
- orderBy: {
21
- createdAt: 'desc',
22
- },
23
- include: {
24
- quoteInvoice: true,
25
- },
26
- where: queryWhere,
27
- }),
28
- ]);
29
- return payments;
30
- });
31
- exports.postPaymentsReport = postPaymentsReport;