@react-pakistan/util-functions 1.22.39 → 1.22.40

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.
Files changed (38) hide show
  1. package/api/stellar-solutions/app-user/index.d.ts +1 -8
  2. package/api/stellar-solutions/banking-detail/index.d.ts +1 -12
  3. package/api/stellar-solutions/branch/index.d.ts +2 -13
  4. package/api/stellar-solutions/company/index.d.ts +1 -9
  5. package/api/stellar-solutions/company/index.js +1 -1
  6. package/api/stellar-solutions/contact/index.d.ts +1 -11
  7. package/api/stellar-solutions/currency/index.d.ts +1 -10
  8. package/api/stellar-solutions/customer/index.d.ts +10 -12
  9. package/api/stellar-solutions/customer/index.js +21 -4
  10. package/api/stellar-solutions/expense/index.d.ts +36 -0
  11. package/api/stellar-solutions/expense/index.js +91 -0
  12. package/api/stellar-solutions/expense-category/index.d.ts +33 -0
  13. package/api/stellar-solutions/expense-category/index.js +85 -0
  14. package/api/stellar-solutions/lead/index.d.ts +34 -0
  15. package/api/stellar-solutions/lead/index.js +87 -0
  16. package/api/stellar-solutions/menu-order/index.d.ts +24 -0
  17. package/api/stellar-solutions/menu-order/index.js +59 -0
  18. package/api/stellar-solutions/payment/index.d.ts +30 -0
  19. package/api/stellar-solutions/payment/index.js +71 -0
  20. package/api/stellar-solutions/payment-mode/index.d.ts +22 -0
  21. package/api/stellar-solutions/payment-mode/index.js +52 -0
  22. package/api/stellar-solutions/preference/index.d.ts +5 -0
  23. package/api/stellar-solutions/preference/index.js +30 -0
  24. package/api/stellar-solutions/product/index.d.ts +41 -0
  25. package/api/stellar-solutions/product/index.js +100 -0
  26. package/api/stellar-solutions/product-category/index.d.ts +32 -0
  27. package/api/stellar-solutions/product-category/index.js +80 -0
  28. package/api/stellar-solutions/profile/index.d.ts +46 -0
  29. package/api/stellar-solutions/profile/index.js +101 -0
  30. package/api/stellar-solutions/quote-invoice/index.d.ts +54 -0
  31. package/api/stellar-solutions/quote-invoice/index.js +214 -0
  32. package/api/stellar-solutions/tax/index.d.ts +27 -0
  33. package/api/stellar-solutions/tax/index.js +65 -0
  34. package/api/stellar-solutions/type.d.ts +226 -0
  35. package/api/stellar-solutions/type.js +3 -0
  36. package/index.d.ts +13 -1
  37. package/index.js +13 -1
  38. package/package.json +1 -1
@@ -1,11 +1,4 @@
1
- interface AppUserBE {
2
- createdAt: string;
3
- email: string;
4
- firstName: string;
5
- id: string;
6
- lastName: string;
7
- updatedAt: string;
8
- }
1
+ import { AppUserBE } from '../type';
9
2
  interface GetAppUsersArgs {
10
3
  prisma: any;
11
4
  }
@@ -1,15 +1,4 @@
1
- interface BankingDetailBE {
2
- accountNumber: string;
3
- accountTitle: string;
4
- bankAddress: string;
5
- bankName: string;
6
- createdAt: string;
7
- enabled: boolean;
8
- iban: string;
9
- id: string;
10
- swiftCode: string;
11
- updatedAt: string;
12
- }
1
+ import { BankingDetailBE } from '../type';
13
2
  interface GetBankingDetailsArgs {
14
3
  prisma: any;
15
4
  }
@@ -1,15 +1,4 @@
1
- interface BranchBE {
2
- branchAddress: string;
3
- branchName: string;
4
- createdAt: string;
5
- enabled: boolean;
6
- id: string;
7
- isDefault: boolean;
8
- personEmail: string;
9
- personName: string;
10
- personPhone: string;
11
- updatedAt: string;
12
- }
1
+ import { BranchBE } from '../type';
13
2
  interface GetBranchesArgs {
14
3
  prisma: any;
15
4
  }
@@ -18,7 +7,6 @@ interface GetBranchByIdArgs {
18
7
  prisma: any;
19
8
  }
20
9
  interface PostBranchArgs {
21
- prisma: any;
22
10
  branchAddress: string;
23
11
  branchName: string;
24
12
  enabled: boolean;
@@ -28,6 +16,7 @@ interface PostBranchArgs {
28
16
  personName: string;
29
17
  personPhone: string;
30
18
  preferenceId: string;
19
+ prisma: any;
31
20
  }
32
21
  interface DeleteBranchArgs {
33
22
  id: string;
@@ -1,12 +1,4 @@
1
- interface CompanyBE {
2
- country: string;
3
- email: string;
4
- id: string;
5
- name: string;
6
- phone: boolean;
7
- updatedAt: string;
8
- website: boolean;
9
- }
1
+ import { CompanyBE } from '../type';
10
2
  interface GetCompaniesArgs {
11
3
  prisma: any;
12
4
  }
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- /* eslint-disable @typescript-eslint/no-explicit-any, no-restricted-globals */
2
+ /* eslint-disable @typescript-eslint/no-explicit-any, no-restricted-globals, @typescript-eslint/array-type */
3
3
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
4
4
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
5
5
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -1,14 +1,4 @@
1
- interface ContactBE {
2
- companyId: string;
3
- country: string;
4
- createdAt: string;
5
- email: string;
6
- firstName: string;
7
- id: string;
8
- lastName: string;
9
- phone: string;
10
- updatedAt: string;
11
- }
1
+ import { ContactBE } from '../type';
12
2
  interface GetContactsArgs {
13
3
  prisma: any;
14
4
  }
@@ -1,13 +1,4 @@
1
- interface CurrencyBE {
2
- code: string;
3
- createdAt: string;
4
- enabled: boolean;
5
- id: string;
6
- isDefault: string;
7
- label: string;
8
- preferenceId: string;
9
- updatedAt: string;
10
- }
1
+ import { CurrencyBE } from '../type';
11
2
  interface GetCurrenciesArgs {
12
3
  prisma: any;
13
4
  }
@@ -1,15 +1,4 @@
1
- interface CustomerBE {
2
- address: string;
3
- city: string;
4
- country: string;
5
- createdAt: string;
6
- email: string;
7
- firstName: string;
8
- id: string;
9
- lastName: string;
10
- phone: string;
11
- updatedAt: string;
12
- }
1
+ import { CustomerBE } from '../type';
13
2
  interface GetCustomersArgs {
14
3
  prisma: any;
15
4
  }
@@ -21,6 +10,14 @@ interface GetCustomerByPhoneArgs {
21
10
  phone: string;
22
11
  prisma: any;
23
12
  }
13
+ interface PostCustomersArgs {
14
+ currentPage: number;
15
+ pageLimit: number;
16
+ prisma: any;
17
+ queryWhere: {
18
+ [key: string]: any;
19
+ };
20
+ }
24
21
  interface PostCustomerArgs {
25
22
  prisma: any;
26
23
  id: string;
@@ -39,6 +36,7 @@ interface DeleteCustomerArgs {
39
36
  export declare const getCustomers: ({ prisma }: GetCustomersArgs) => Promise<Array<CustomerBE>>;
40
37
  export declare const getCustomerById: ({ prisma, id }: GetCustomerByIdArgs) => Promise<CustomerBE>;
41
38
  export declare const getCustomerByPhone: ({ prisma, phone }: GetCustomerByPhoneArgs) => Promise<CustomerBE>;
39
+ export declare const postCustomers: ({ currentPage, pageLimit, prisma, queryWhere, }: PostCustomersArgs) => Promise<Array<CustomerBE>>;
42
40
  export declare const postCustomer: ({ prisma, id, address, city, country, email, firstName, lastName, phone, }: PostCustomerArgs) => Promise<Array<CustomerBE>>;
43
41
  export declare const deleteCustomer: ({ prisma, id }: DeleteCustomerArgs) => Promise<CustomerBE>;
44
42
  export {};
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- /* eslint-disable @typescript-eslint/no-explicit-any */
2
+ /* eslint-disable @typescript-eslint/no-explicit-any, @typescript-eslint/array-type */
3
3
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
4
4
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
5
5
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -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.deleteCustomer = exports.postCustomer = exports.getCustomerByPhone = exports.getCustomerById = exports.getCustomers = void 0;
13
+ exports.deleteCustomer = exports.postCustomer = exports.postCustomers = exports.getCustomerByPhone = exports.getCustomerById = exports.getCustomers = void 0;
14
14
  const getCustomers = (_a) => __awaiter(void 0, [_a], void 0, function* ({ prisma }) {
15
15
  const customers = yield prisma.stellarCustomer.findMany({
16
16
  orderBy: {
@@ -44,7 +44,24 @@ const getCustomerByPhone = (_c) => __awaiter(void 0, [_c], void 0, function* ({
44
44
  return customer;
45
45
  });
46
46
  exports.getCustomerByPhone = getCustomerByPhone;
47
- const postCustomer = (_d) => __awaiter(void 0, [_d], void 0, function* ({ prisma, id, address, city, country, email, firstName, lastName, phone, }) {
47
+ const postCustomers = (_d) => __awaiter(void 0, [_d], void 0, function* ({ currentPage, pageLimit, prisma, queryWhere, }) {
48
+ const customers = yield prisma.$transaction([
49
+ prisma.stellarCustomer.count({
50
+ where: queryWhere,
51
+ }),
52
+ prisma.stellarCustomer.findMany({
53
+ orderBy: {
54
+ createdAt: 'desc',
55
+ },
56
+ where: queryWhere,
57
+ take: pageLimit,
58
+ skip: currentPage === 1 ? 0 : currentPage - 1 * pageLimit,
59
+ }),
60
+ ]);
61
+ return customers;
62
+ });
63
+ exports.postCustomers = postCustomers;
64
+ const postCustomer = (_e) => __awaiter(void 0, [_e], void 0, function* ({ prisma, id, address, city, country, email, firstName, lastName, phone, }) {
48
65
  const customer = yield prisma.stellarCustomer.upsert({
49
66
  where: {
50
67
  id,
@@ -71,7 +88,7 @@ const postCustomer = (_d) => __awaiter(void 0, [_d], void 0, function* ({ prisma
71
88
  return customer;
72
89
  });
73
90
  exports.postCustomer = postCustomer;
74
- const deleteCustomer = (_e) => __awaiter(void 0, [_e], void 0, function* ({ prisma, id }) {
91
+ const deleteCustomer = (_f) => __awaiter(void 0, [_f], void 0, function* ({ prisma, id }) {
75
92
  const customer = yield prisma.stellarCustomer.delete({
76
93
  where: {
77
94
  id,
@@ -0,0 +1,36 @@
1
+ import { ExpenseBE } from '../type';
2
+ interface GetExpensesArgs {
3
+ prisma: any;
4
+ }
5
+ interface GetExpenseByIdArgs {
6
+ id: string;
7
+ prisma: any;
8
+ }
9
+ interface PostExpensesArgs {
10
+ currentPage: number;
11
+ pageLimit: number;
12
+ prisma: any;
13
+ queryWhere: {
14
+ [key: string]: any;
15
+ };
16
+ }
17
+ interface PostExpenseArgs {
18
+ currency: string;
19
+ description: string;
20
+ expenseCategoryId: string;
21
+ id: string;
22
+ name: string;
23
+ prisma: any;
24
+ ref: string;
25
+ total: string;
26
+ }
27
+ interface DeleteExpenseArgs {
28
+ prisma: any;
29
+ id: string;
30
+ }
31
+ export declare const getExpenses: ({ prisma, }: GetExpensesArgs) => Promise<Array<ExpenseBE>>;
32
+ export declare const getExpenseById: ({ id, prisma, }: GetExpenseByIdArgs) => Promise<ExpenseBE>;
33
+ export declare const postExpenses: ({ currentPage, pageLimit, prisma, queryWhere, }: PostExpensesArgs) => Promise<Array<ExpenseBE>>;
34
+ export declare const postExpense: ({ currency, description, expenseCategoryId, id, name, prisma, ref, total, }: PostExpenseArgs) => Promise<Array<ExpenseBE>>;
35
+ export declare const deleteExpense: ({ prisma, id, }: DeleteExpenseArgs) => Promise<ExpenseBE>;
36
+ export {};
@@ -0,0 +1,91 @@
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.deleteExpense = exports.postExpense = exports.postExpenses = exports.getExpenseById = exports.getExpenses = void 0;
14
+ const getExpenses = (_a) => __awaiter(void 0, [_a], void 0, function* ({ prisma, }) {
15
+ const expenses = yield prisma.stellarExpense.findMany({
16
+ orderBy: {
17
+ createdAt: 'desc',
18
+ },
19
+ include: {
20
+ expenseCategory: true,
21
+ },
22
+ });
23
+ return expenses;
24
+ });
25
+ exports.getExpenses = getExpenses;
26
+ const getExpenseById = (_b) => __awaiter(void 0, [_b], void 0, function* ({ id, prisma, }) {
27
+ const expense = yield prisma.stellarExpense.findUnique({
28
+ where: {
29
+ id,
30
+ },
31
+ include: {
32
+ expenseCategory: true,
33
+ },
34
+ });
35
+ return expense;
36
+ });
37
+ exports.getExpenseById = getExpenseById;
38
+ const postExpenses = (_c) => __awaiter(void 0, [_c], void 0, function* ({ currentPage, pageLimit, prisma, queryWhere, }) {
39
+ const expenses = yield prisma.$transaction([
40
+ prisma.stellarExpense.count({
41
+ where: queryWhere,
42
+ }),
43
+ prisma.stellarExpense.findMany({
44
+ orderBy: {
45
+ createdAt: 'desc',
46
+ },
47
+ include: {
48
+ expenseCategory: true,
49
+ },
50
+ where: queryWhere,
51
+ take: pageLimit,
52
+ skip: currentPage === 1 ? 0 : currentPage - 1 * pageLimit,
53
+ }),
54
+ ]);
55
+ return expenses;
56
+ });
57
+ exports.postExpenses = postExpenses;
58
+ const postExpense = (_d) => __awaiter(void 0, [_d], void 0, function* ({ currency, description, expenseCategoryId, id, name, prisma, ref, total, }) {
59
+ const expense = yield prisma.stellarExpense.upsert({
60
+ where: {
61
+ id,
62
+ },
63
+ update: {
64
+ currency,
65
+ description,
66
+ expenseCategoryId,
67
+ name,
68
+ ref,
69
+ total,
70
+ },
71
+ create: {
72
+ currency,
73
+ description,
74
+ expenseCategoryId,
75
+ name,
76
+ ref,
77
+ total,
78
+ },
79
+ });
80
+ return expense;
81
+ });
82
+ exports.postExpense = postExpense;
83
+ const deleteExpense = (_e) => __awaiter(void 0, [_e], void 0, function* ({ prisma, id, }) {
84
+ const expense = yield prisma.stellarExpense.delete({
85
+ where: {
86
+ id,
87
+ },
88
+ });
89
+ return expense;
90
+ });
91
+ exports.deleteExpense = deleteExpense;
@@ -0,0 +1,33 @@
1
+ import { ExpenseCategoryBE } from '../type';
2
+ interface GetExpenseCategoriesArgs {
3
+ prisma: any;
4
+ }
5
+ interface GetExpenseCategoryByIdArgs {
6
+ id: string;
7
+ prisma: any;
8
+ }
9
+ interface PostExpenseCategoriesArgs {
10
+ currentPage: number;
11
+ pageLimit: number;
12
+ prisma: any;
13
+ queryWhere: {
14
+ [key: string]: any;
15
+ };
16
+ }
17
+ interface PostExpenseCategoryArgs {
18
+ color: string;
19
+ description: string;
20
+ id: string;
21
+ name: string;
22
+ prisma: any;
23
+ }
24
+ interface DeleteExpenseCategoryArgs {
25
+ prisma: any;
26
+ id: string;
27
+ }
28
+ export declare const getExpenseCategories: ({ prisma, }: GetExpenseCategoriesArgs) => Promise<Array<ExpenseCategoryBE>>;
29
+ export declare const getExpenseCategoryById: ({ id, prisma, }: GetExpenseCategoryByIdArgs) => Promise<ExpenseCategoryBE>;
30
+ export declare const postExpenseCategories: ({ currentPage, pageLimit, prisma, queryWhere, }: PostExpenseCategoriesArgs) => Promise<Array<ExpenseCategoryBE>>;
31
+ export declare const postExpenseCategory: ({ color, description, id, name, prisma, }: PostExpenseCategoryArgs) => Promise<Array<ExpenseCategoryBE>>;
32
+ export declare const deleteExpenseCategory: ({ id, prisma, }: DeleteExpenseCategoryArgs) => Promise<ExpenseCategoryBE>;
33
+ export {};
@@ -0,0 +1,85 @@
1
+ "use strict";
2
+ /* eslint-disable @typescript-eslint/no-explicit-any, no-restricted-globals, @typescript-eslint/array-type */
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.deleteExpenseCategory = exports.postExpenseCategory = exports.postExpenseCategories = exports.getExpenseCategoryById = exports.getExpenseCategories = void 0;
14
+ const getExpenseCategories = (_a) => __awaiter(void 0, [_a], void 0, function* ({ prisma, }) {
15
+ const expenseCategories = yield prisma.stellarExpenseCategory.findMany({
16
+ orderBy: {
17
+ createdAt: 'desc',
18
+ },
19
+ include: {
20
+ expense: true,
21
+ },
22
+ });
23
+ return expenseCategories;
24
+ });
25
+ exports.getExpenseCategories = getExpenseCategories;
26
+ const getExpenseCategoryById = (_b) => __awaiter(void 0, [_b], void 0, function* ({ id, prisma, }) {
27
+ const expenseCategory = yield prisma.stellarExpenseCategory.findUnique({
28
+ where: {
29
+ id,
30
+ },
31
+ include: {
32
+ expense: true,
33
+ },
34
+ });
35
+ return expenseCategory;
36
+ });
37
+ exports.getExpenseCategoryById = getExpenseCategoryById;
38
+ const postExpenseCategories = (_c) => __awaiter(void 0, [_c], void 0, function* ({ currentPage, pageLimit, prisma, queryWhere, }) {
39
+ const expenseCategories = yield prisma.$transaction([
40
+ prisma.stellarExpenseCategory.count({
41
+ where: queryWhere,
42
+ }),
43
+ prisma.stellarExpenseCategory.findMany({
44
+ orderBy: {
45
+ createdAt: 'desc',
46
+ },
47
+ include: {
48
+ expense: true,
49
+ },
50
+ where: queryWhere,
51
+ take: pageLimit,
52
+ skip: currentPage === 1 ? 0 : currentPage - 1 * pageLimit,
53
+ }),
54
+ ]);
55
+ return expenseCategories;
56
+ });
57
+ exports.postExpenseCategories = postExpenseCategories;
58
+ const postExpenseCategory = (_d) => __awaiter(void 0, [_d], void 0, function* ({ color, description, id, name, prisma, }) {
59
+ const expenseCategory = yield prisma.stellarExpenseCategory.upsert({
60
+ where: {
61
+ id,
62
+ },
63
+ update: {
64
+ color,
65
+ description,
66
+ name,
67
+ },
68
+ create: {
69
+ color,
70
+ description,
71
+ name,
72
+ },
73
+ });
74
+ return expenseCategory;
75
+ });
76
+ exports.postExpenseCategory = postExpenseCategory;
77
+ const deleteExpenseCategory = (_e) => __awaiter(void 0, [_e], void 0, function* ({ id, prisma, }) {
78
+ const expenseCategory = yield prisma.stellarExpenseCategory.delete({
79
+ where: {
80
+ id,
81
+ },
82
+ });
83
+ return expenseCategory;
84
+ });
85
+ exports.deleteExpenseCategory = deleteExpenseCategory;
@@ -0,0 +1,34 @@
1
+ import { LeadBE } from '../type';
2
+ interface GetLeadsArgs {
3
+ prisma: any;
4
+ }
5
+ interface GetLeadByIdArgs {
6
+ id: string;
7
+ prisma: any;
8
+ }
9
+ interface PostLeadsArgs {
10
+ currentPage: number;
11
+ pageLimit: number;
12
+ prisma: any;
13
+ queryWhere: {
14
+ [key: string]: any;
15
+ };
16
+ }
17
+ interface PostLeadArgs {
18
+ id: string;
19
+ notes: string;
20
+ prisma: any;
21
+ source: string;
22
+ status: string;
23
+ type: string;
24
+ }
25
+ interface DeleteLeadArgs {
26
+ prisma: any;
27
+ id: string;
28
+ }
29
+ export declare const getLeads: ({ prisma, }: GetLeadsArgs) => Promise<Array<LeadBE>>;
30
+ export declare const getLeadById: ({ id, prisma, }: GetLeadByIdArgs) => Promise<LeadBE>;
31
+ export declare const postLeads: ({ currentPage, pageLimit, prisma, queryWhere, }: PostLeadsArgs) => Promise<Array<LeadBE>>;
32
+ export declare const postLead: ({ id, notes, prisma, source, status, type, }: PostLeadArgs) => Promise<Array<LeadBE>>;
33
+ export declare const deleteLead: ({ id, prisma, }: DeleteLeadArgs) => Promise<LeadBE>;
34
+ export {};
@@ -0,0 +1,87 @@
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.deleteLead = exports.postLead = exports.postLeads = exports.getLeadById = exports.getLeads = void 0;
14
+ const getLeads = (_a) => __awaiter(void 0, [_a], void 0, function* ({ prisma, }) {
15
+ const leads = yield prisma.stellarLead.findMany({
16
+ orderBy: {
17
+ createdAt: 'desc',
18
+ },
19
+ include: {
20
+ leadCategory: true,
21
+ },
22
+ });
23
+ return leads;
24
+ });
25
+ exports.getLeads = getLeads;
26
+ const getLeadById = (_b) => __awaiter(void 0, [_b], void 0, function* ({ id, prisma, }) {
27
+ const lead = yield prisma.stellarLead.findUnique({
28
+ where: {
29
+ id,
30
+ },
31
+ include: {
32
+ leadCategory: true,
33
+ },
34
+ });
35
+ return lead;
36
+ });
37
+ exports.getLeadById = getLeadById;
38
+ const postLeads = (_c) => __awaiter(void 0, [_c], void 0, function* ({ currentPage, pageLimit, prisma, queryWhere, }) {
39
+ const leads = yield prisma.$transaction([
40
+ prisma.stellarLead.count({
41
+ where: queryWhere,
42
+ }),
43
+ prisma.stellarLead.findMany({
44
+ orderBy: {
45
+ createdAt: 'desc',
46
+ },
47
+ include: {
48
+ leadCategory: true,
49
+ },
50
+ where: queryWhere,
51
+ take: pageLimit,
52
+ skip: currentPage === 1 ? 0 : currentPage - 1 * pageLimit,
53
+ }),
54
+ ]);
55
+ return leads;
56
+ });
57
+ exports.postLeads = postLeads;
58
+ const postLead = (_d) => __awaiter(void 0, [_d], void 0, function* ({ id, notes, prisma, source, status, type, }) {
59
+ const lead = yield prisma.stellarLead.upsert({
60
+ where: {
61
+ id,
62
+ },
63
+ update: {
64
+ notes,
65
+ source,
66
+ status,
67
+ type,
68
+ },
69
+ create: {
70
+ notes,
71
+ source,
72
+ status,
73
+ type,
74
+ },
75
+ });
76
+ return lead;
77
+ });
78
+ exports.postLead = postLead;
79
+ const deleteLead = (_e) => __awaiter(void 0, [_e], void 0, function* ({ id, prisma, }) {
80
+ const lead = yield prisma.stellarLead.delete({
81
+ where: {
82
+ id,
83
+ },
84
+ });
85
+ return lead;
86
+ });
87
+ exports.deleteLead = deleteLead;
@@ -0,0 +1,24 @@
1
+ import { MenuOrderBE } from '../type';
2
+ interface GetMenuOrdersArgs {
3
+ prisma: any;
4
+ }
5
+ interface GetMenuOrderByIdArgs {
6
+ id: string;
7
+ prisma: any;
8
+ }
9
+ interface PostMenuOrderArgs {
10
+ id: string;
11
+ label: string;
12
+ order: number;
13
+ preferenceId: string;
14
+ prisma: any;
15
+ }
16
+ interface DeleteMenuOrderArgs {
17
+ prisma: any;
18
+ id: string;
19
+ }
20
+ export declare const getMenuOrders: ({ prisma, }: GetMenuOrdersArgs) => Promise<Array<MenuOrderBE>>;
21
+ export declare const getMenuOrderById: ({ id, prisma, }: GetMenuOrderByIdArgs) => Promise<MenuOrderBE>;
22
+ export declare const postMenuOrder: ({ id, label, order, preferenceId, prisma, }: PostMenuOrderArgs) => Promise<Array<MenuOrderBE>>;
23
+ export declare const deleteMenOrder: ({ id, prisma, }: DeleteMenuOrderArgs) => Promise<MenuOrderBE>;
24
+ export {};
@@ -0,0 +1,59 @@
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.deleteMenOrder = exports.postMenuOrder = exports.getMenuOrderById = exports.getMenuOrders = void 0;
14
+ const getMenuOrders = (_a) => __awaiter(void 0, [_a], void 0, function* ({ prisma, }) {
15
+ const menuOrders = yield prisma.stellarMenuOrder.findMany({
16
+ orderBy: {
17
+ createdAt: 'desc',
18
+ },
19
+ });
20
+ return menuOrders;
21
+ });
22
+ exports.getMenuOrders = getMenuOrders;
23
+ const getMenuOrderById = (_b) => __awaiter(void 0, [_b], void 0, function* ({ id, prisma, }) {
24
+ const menuOrder = yield prisma.stellarMenuOrder.findUnique({
25
+ where: {
26
+ id,
27
+ },
28
+ });
29
+ return menuOrder;
30
+ });
31
+ exports.getMenuOrderById = getMenuOrderById;
32
+ const postMenuOrder = (_c) => __awaiter(void 0, [_c], void 0, function* ({ id, label, order, preferenceId, prisma, }) {
33
+ const menuOrder = yield prisma.stellarMenuOrder.upsert({
34
+ where: {
35
+ id,
36
+ },
37
+ update: {
38
+ label,
39
+ order,
40
+ preferenceId,
41
+ },
42
+ create: {
43
+ label,
44
+ order,
45
+ preferenceId,
46
+ },
47
+ });
48
+ return menuOrder;
49
+ });
50
+ exports.postMenuOrder = postMenuOrder;
51
+ const deleteMenOrder = (_d) => __awaiter(void 0, [_d], void 0, function* ({ id, prisma, }) {
52
+ const menuOrder = yield prisma.stellarMenuOrder.delete({
53
+ where: {
54
+ id,
55
+ },
56
+ });
57
+ return menuOrder;
58
+ });
59
+ exports.deleteMenOrder = deleteMenOrder;