@react-pakistan/util-functions 1.22.31 → 1.22.32
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.
|
@@ -0,0 +1,34 @@
|
|
|
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
|
+
}
|
|
13
|
+
interface GetCustomerArgs {
|
|
14
|
+
prisma: any;
|
|
15
|
+
}
|
|
16
|
+
interface PostCustomerArgs {
|
|
17
|
+
prisma: any;
|
|
18
|
+
id: string;
|
|
19
|
+
address: string;
|
|
20
|
+
city: string;
|
|
21
|
+
country: string;
|
|
22
|
+
email: string;
|
|
23
|
+
firstName: string;
|
|
24
|
+
lastName: string;
|
|
25
|
+
phone: string;
|
|
26
|
+
}
|
|
27
|
+
interface DeleteCustomerArgs {
|
|
28
|
+
prisma: any;
|
|
29
|
+
id: string;
|
|
30
|
+
}
|
|
31
|
+
export declare const getCustomer: ({ prisma }: GetCustomerArgs) => Promise<Array<CustomerBE>>;
|
|
32
|
+
export declare const postCustomer: ({ prisma, id, address, city, country, email, firstName, lastName, phone, }: PostCustomerArgs) => Promise<Array<CustomerBE>>;
|
|
33
|
+
export declare const deleteCustomer: ({ prisma, id }: DeleteCustomerArgs) => Promise<CustomerBE>;
|
|
34
|
+
export {};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
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.deleteCustomer = exports.postCustomer = exports.getCustomer = void 0;
|
|
14
|
+
const getCustomer = (_a) => __awaiter(void 0, [_a], void 0, function* ({ prisma }) {
|
|
15
|
+
const customers = yield prisma.stellarCustomer.findMany({
|
|
16
|
+
orderBy: {
|
|
17
|
+
createdAt: 'desc',
|
|
18
|
+
},
|
|
19
|
+
});
|
|
20
|
+
return customers;
|
|
21
|
+
});
|
|
22
|
+
exports.getCustomer = getCustomer;
|
|
23
|
+
const postCustomer = (_b) => __awaiter(void 0, [_b], void 0, function* ({ prisma, id, address, city, country, email, firstName, lastName, phone, }) {
|
|
24
|
+
const customer = yield prisma.stellarCustomer.upsert({
|
|
25
|
+
where: {
|
|
26
|
+
id,
|
|
27
|
+
},
|
|
28
|
+
update: {
|
|
29
|
+
address,
|
|
30
|
+
city,
|
|
31
|
+
country,
|
|
32
|
+
email,
|
|
33
|
+
firstName,
|
|
34
|
+
lastName,
|
|
35
|
+
phone,
|
|
36
|
+
},
|
|
37
|
+
create: {
|
|
38
|
+
address,
|
|
39
|
+
city,
|
|
40
|
+
country,
|
|
41
|
+
email,
|
|
42
|
+
firstName,
|
|
43
|
+
lastName,
|
|
44
|
+
phone,
|
|
45
|
+
},
|
|
46
|
+
});
|
|
47
|
+
return customer;
|
|
48
|
+
});
|
|
49
|
+
exports.postCustomer = postCustomer;
|
|
50
|
+
const deleteCustomer = (_c) => __awaiter(void 0, [_c], void 0, function* ({ prisma, id }) {
|
|
51
|
+
const customer = yield prisma.stellarCustomer.delete({
|
|
52
|
+
where: {
|
|
53
|
+
id,
|
|
54
|
+
},
|
|
55
|
+
});
|
|
56
|
+
return customer;
|
|
57
|
+
});
|
|
58
|
+
exports.deleteCustomer = deleteCustomer;
|
package/index.d.ts
CHANGED
package/index.js
CHANGED
|
@@ -14,6 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./api/stellar-solutions/customer"), exports);
|
|
17
18
|
__exportStar(require("./constants"), exports);
|
|
18
19
|
__exportStar(require("./general"), exports);
|
|
19
20
|
__exportStar(require("./hooks"), exports);
|