abmp-npm 1.8.24 → 1.8.25
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.
- package/backend/index.js +1 -0
- package/backend/utils.js +26 -0
- package/package.json +1 -1
package/backend/index.js
CHANGED
package/backend/utils.js
CHANGED
|
@@ -79,10 +79,36 @@ function getAddressDisplayOptions(member) {
|
|
|
79
79
|
return displayOptions;
|
|
80
80
|
}
|
|
81
81
|
|
|
82
|
+
/**
|
|
83
|
+
* Get all interests from the database
|
|
84
|
+
* @returns {Promise<Array<string>>} Array of interest titles sorted alphabetically
|
|
85
|
+
*/
|
|
86
|
+
async function getInterestAll() {
|
|
87
|
+
try {
|
|
88
|
+
let res = await wixData.query('interests').limit(1000).find();
|
|
89
|
+
|
|
90
|
+
let interests = res.items.map(x => x.title);
|
|
91
|
+
|
|
92
|
+
while (res.hasNext()) {
|
|
93
|
+
res = await res.next();
|
|
94
|
+
interests.push(...res.items.map(x => x.title));
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
// Sort the interests alphabetically (case-insensitive)
|
|
98
|
+
interests = interests.sort((a, b) => a.toLowerCase().localeCompare(b.toLowerCase()));
|
|
99
|
+
|
|
100
|
+
return interests;
|
|
101
|
+
} catch (e) {
|
|
102
|
+
console.error('Error in getInterestAll:', e);
|
|
103
|
+
throw e;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
82
107
|
module.exports = {
|
|
83
108
|
getSiteConfigs,
|
|
84
109
|
retrieveAllItems,
|
|
85
110
|
formatDateToMonthYear,
|
|
86
111
|
isStudent,
|
|
87
112
|
getAddressDisplayOptions,
|
|
113
|
+
getInterestAll,
|
|
88
114
|
};
|