@react-pakistan/util-functions 1.22.47 → 1.22.48
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.
|
@@ -27,7 +27,10 @@ interface DeleteExpenseCategoryArgs {
|
|
|
27
27
|
}
|
|
28
28
|
export declare const getExpenseCategories: ({ prisma, }: GetExpenseCategoriesArgs) => Promise<Array<ExpenseCategoryBE>>;
|
|
29
29
|
export declare const getExpenseCategoryById: ({ id, prisma, }: GetExpenseCategoryByIdArgs) => Promise<ExpenseCategoryBE>;
|
|
30
|
-
export declare const postExpenseCategories: ({ currentPage, pageLimit, prisma, queryWhere, }: PostExpenseCategoriesArgs) => Promise<
|
|
30
|
+
export declare const postExpenseCategories: ({ currentPage, pageLimit, prisma, queryWhere, }: PostExpenseCategoriesArgs) => Promise<{
|
|
31
|
+
data: Array<ExpenseCategoryBE>;
|
|
32
|
+
error: Error | undefined;
|
|
33
|
+
}>;
|
|
31
34
|
export declare const postExpenseCategory: ({ color, description, id, name, prisma, }: PostExpenseCategoryArgs) => Promise<Array<ExpenseCategoryBE>>;
|
|
32
35
|
export declare const deleteExpenseCategory: ({ id, prisma, }: DeleteExpenseCategoryArgs) => Promise<ExpenseCategoryBE>;
|
|
33
36
|
export {};
|
|
@@ -36,23 +36,30 @@ const getExpenseCategoryById = (_b) => __awaiter(void 0, [_b], void 0, function*
|
|
|
36
36
|
});
|
|
37
37
|
exports.getExpenseCategoryById = getExpenseCategoryById;
|
|
38
38
|
const postExpenseCategories = (_c) => __awaiter(void 0, [_c], void 0, function* ({ currentPage, pageLimit, prisma, queryWhere, }) {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
39
|
+
let data;
|
|
40
|
+
let error;
|
|
41
|
+
try {
|
|
42
|
+
data = yield prisma.$transaction([
|
|
43
|
+
prisma.expenseCategory.count({
|
|
44
|
+
where: queryWhere,
|
|
45
|
+
}),
|
|
46
|
+
prisma.expenseCategory.findMany({
|
|
47
|
+
orderBy: {
|
|
48
|
+
createdAt: 'desc',
|
|
49
|
+
},
|
|
50
|
+
include: {
|
|
51
|
+
expense: true,
|
|
52
|
+
},
|
|
53
|
+
where: queryWhere,
|
|
54
|
+
take: pageLimit,
|
|
55
|
+
skip: currentPage === 1 ? 0 : currentPage - 1 * pageLimit,
|
|
56
|
+
}),
|
|
57
|
+
]);
|
|
58
|
+
}
|
|
59
|
+
catch (err) {
|
|
60
|
+
error = err;
|
|
61
|
+
}
|
|
62
|
+
return { data, error };
|
|
56
63
|
});
|
|
57
64
|
exports.postExpenseCategories = postExpenseCategories;
|
|
58
65
|
const postExpenseCategory = (_d) => __awaiter(void 0, [_d], void 0, function* ({ color, description, id, name, prisma, }) {
|