@react-pakistan/util-functions 1.22.34 → 1.22.35
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.
|
@@ -10,7 +10,15 @@ interface CustomerBE {
|
|
|
10
10
|
phone: string;
|
|
11
11
|
updatedAt: string;
|
|
12
12
|
}
|
|
13
|
-
interface
|
|
13
|
+
interface GetCustomersArgs {
|
|
14
|
+
prisma: any;
|
|
15
|
+
}
|
|
16
|
+
interface GetCustomerByIdArgs {
|
|
17
|
+
id: string;
|
|
18
|
+
prisma: any;
|
|
19
|
+
}
|
|
20
|
+
interface GetCustomerByPhoneArgs {
|
|
21
|
+
phone: string;
|
|
14
22
|
prisma: any;
|
|
15
23
|
}
|
|
16
24
|
interface PostCustomerArgs {
|
|
@@ -28,7 +36,9 @@ interface DeleteCustomerArgs {
|
|
|
28
36
|
prisma: any;
|
|
29
37
|
id: string;
|
|
30
38
|
}
|
|
31
|
-
export declare const
|
|
39
|
+
export declare const getCustomers: ({ prisma }: GetCustomersArgs) => Promise<Array<CustomerBE>>;
|
|
40
|
+
export declare const getCustomerById: ({ prisma, id }: GetCustomerByIdArgs) => Promise<CustomerBE>;
|
|
41
|
+
export declare const getCustomerByPhone: ({ prisma, phone }: GetCustomerByPhoneArgs) => Promise<CustomerBE>;
|
|
32
42
|
export declare const postCustomer: ({ prisma, id, address, city, country, email, firstName, lastName, phone, }: PostCustomerArgs) => Promise<Array<CustomerBE>>;
|
|
33
43
|
export declare const deleteCustomer: ({ prisma, id }: DeleteCustomerArgs) => Promise<CustomerBE>;
|
|
34
44
|
export {};
|
|
@@ -10,8 +10,8 @@ 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.
|
|
14
|
-
const
|
|
13
|
+
exports.deleteCustomer = exports.postCustomer = exports.getCustomerByPhone = exports.getCustomerById = exports.getCustomers = void 0;
|
|
14
|
+
const getCustomers = (_a) => __awaiter(void 0, [_a], void 0, function* ({ prisma }) {
|
|
15
15
|
const customers = yield prisma.stellarCustomer.findMany({
|
|
16
16
|
orderBy: {
|
|
17
17
|
createdAt: 'desc',
|
|
@@ -19,8 +19,26 @@ const getCustomer = (_a) => __awaiter(void 0, [_a], void 0, function* ({ prisma
|
|
|
19
19
|
});
|
|
20
20
|
return customers;
|
|
21
21
|
});
|
|
22
|
-
exports.
|
|
23
|
-
const
|
|
22
|
+
exports.getCustomers = getCustomers;
|
|
23
|
+
const getCustomerById = (_b) => __awaiter(void 0, [_b], void 0, function* ({ prisma, id }) {
|
|
24
|
+
const customer = yield prisma.stellarCustomer.findUnique({
|
|
25
|
+
where: {
|
|
26
|
+
id,
|
|
27
|
+
},
|
|
28
|
+
});
|
|
29
|
+
return customer;
|
|
30
|
+
});
|
|
31
|
+
exports.getCustomerById = getCustomerById;
|
|
32
|
+
const getCustomerByPhone = (_c) => __awaiter(void 0, [_c], void 0, function* ({ prisma, phone }) {
|
|
33
|
+
const customer = yield prisma.stellarCustomer.findUnique({
|
|
34
|
+
where: {
|
|
35
|
+
phone,
|
|
36
|
+
},
|
|
37
|
+
});
|
|
38
|
+
return customer;
|
|
39
|
+
});
|
|
40
|
+
exports.getCustomerByPhone = getCustomerByPhone;
|
|
41
|
+
const postCustomer = (_d) => __awaiter(void 0, [_d], void 0, function* ({ prisma, id, address, city, country, email, firstName, lastName, phone, }) {
|
|
24
42
|
const customer = yield prisma.stellarCustomer.upsert({
|
|
25
43
|
where: {
|
|
26
44
|
id,
|
|
@@ -47,7 +65,7 @@ const postCustomer = (_b) => __awaiter(void 0, [_b], void 0, function* ({ prisma
|
|
|
47
65
|
return customer;
|
|
48
66
|
});
|
|
49
67
|
exports.postCustomer = postCustomer;
|
|
50
|
-
const deleteCustomer = (
|
|
68
|
+
const deleteCustomer = (_e) => __awaiter(void 0, [_e], void 0, function* ({ prisma, id }) {
|
|
51
69
|
const customer = yield prisma.stellarCustomer.delete({
|
|
52
70
|
where: {
|
|
53
71
|
id,
|
|
File without changes
|
|
File without changes
|