@react-pakistan/util-functions 1.22.42 → 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
|
|
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 = (
|
|
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,
|