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 CHANGED
@@ -2,4 +2,5 @@ module.exports = {
2
2
  ...require('./forms-methods'),
3
3
  ...require('./search-filters-methods'),
4
4
  ...require('./members-data-methods'),
5
+ ...require('./utils'),
5
6
  };
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
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "abmp-npm",
3
- "version": "1.8.24",
3
+ "version": "1.8.25",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1",