@react-pakistan/util-functions 1.24.68 → 1.24.69
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.
|
@@ -15,11 +15,11 @@ interface PostPreferenceArgs {
|
|
|
15
15
|
* @param {GetPreferencesArgs} args - Object containing prisma client and ordering options
|
|
16
16
|
* @returns {Promise<Array<PreferenceBE>>} Array of preferences
|
|
17
17
|
*/
|
|
18
|
-
export declare const
|
|
18
|
+
export declare const listPreference: ({ orderByColumn, orderByDirection, prisma, }: GetPreferencesArgs) => Promise<Array<PreferenceBE>>;
|
|
19
19
|
/**
|
|
20
20
|
* Updates a preference using upsert
|
|
21
21
|
* @param {PostPreferenceArgs} args - Object containing prisma client, preference ID, and onboarding status
|
|
22
22
|
* @returns {Promise<PreferenceBE>} Updated preference
|
|
23
23
|
*/
|
|
24
|
-
export declare const
|
|
24
|
+
export declare const updatePreference: ({ id, onboarding, prisma, }: PostPreferenceArgs) => Promise<PreferenceBE>;
|
|
25
25
|
export {};
|
|
@@ -47,13 +47,13 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
47
47
|
}
|
|
48
48
|
};
|
|
49
49
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
50
|
-
exports.
|
|
50
|
+
exports.updatePreference = exports.listPreference = void 0;
|
|
51
51
|
/**
|
|
52
52
|
* Retrieves all preferences
|
|
53
53
|
* @param {GetPreferencesArgs} args - Object containing prisma client and ordering options
|
|
54
54
|
* @returns {Promise<Array<PreferenceBE>>} Array of preferences
|
|
55
55
|
*/
|
|
56
|
-
var
|
|
56
|
+
var listPreference = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
|
|
57
57
|
var include, orderBy, where, preferences;
|
|
58
58
|
var _c;
|
|
59
59
|
var _d = _b.orderByColumn, orderByColumn = _d === void 0 ? 'createdAt' : _d, _e = _b.orderByDirection, orderByDirection = _e === void 0 ? 'desc' : _e, prisma = _b.prisma;
|
|
@@ -76,14 +76,14 @@ var getPreferences = function (_a) { return __awaiter(void 0, [_a], void 0, func
|
|
|
76
76
|
}
|
|
77
77
|
});
|
|
78
78
|
}); };
|
|
79
|
-
exports.
|
|
79
|
+
exports.listPreference = listPreference;
|
|
80
80
|
/**
|
|
81
81
|
* Updates a preference using upsert
|
|
82
82
|
* @param {PostPreferenceArgs} args - Object containing prisma client, preference ID, and onboarding status
|
|
83
83
|
* @returns {Promise<PreferenceBE>} Updated preference
|
|
84
84
|
*/
|
|
85
|
-
var
|
|
86
|
-
var preferenceData, preference;
|
|
85
|
+
var updatePreference = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
|
|
86
|
+
var preferenceData, where, preference;
|
|
87
87
|
var id = _b.id, onboarding = _b.onboarding, prisma = _b.prisma;
|
|
88
88
|
return __generator(this, function (_c) {
|
|
89
89
|
switch (_c.label) {
|
|
@@ -97,10 +97,13 @@ var postPreference = function (_a) { return __awaiter(void 0, [_a], void 0, func
|
|
|
97
97
|
preferenceData = {
|
|
98
98
|
onboarding: onboarding,
|
|
99
99
|
};
|
|
100
|
+
where = {
|
|
101
|
+
id: id,
|
|
102
|
+
};
|
|
100
103
|
return [4 /*yield*/, prisma.preference.upsert({
|
|
101
104
|
create: __assign({ id: id }, preferenceData),
|
|
102
105
|
update: preferenceData,
|
|
103
|
-
where:
|
|
106
|
+
where: where,
|
|
104
107
|
})];
|
|
105
108
|
case 1:
|
|
106
109
|
preference = _c.sent();
|
|
@@ -108,4 +111,4 @@ var postPreference = function (_a) { return __awaiter(void 0, [_a], void 0, func
|
|
|
108
111
|
}
|
|
109
112
|
});
|
|
110
113
|
}); };
|
|
111
|
-
exports.
|
|
114
|
+
exports.updatePreference = updatePreference;
|