itlab-internal-services 2.15.4 → 2.15.6

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.
Files changed (52) hide show
  1. package/dist/classes/document-merger.class.js +27 -37
  2. package/dist/classes/document-updater.class.js +2 -2
  3. package/dist/factories/virtuals.factory.js +2 -2
  4. package/dist/functions/create-duplicate-checker.function.js +3 -12
  5. package/dist/functions/create-internal-axios-client.function.d.ts +0 -1
  6. package/dist/functions/create-schema-transformer.function.js +1 -1
  7. package/dist/models/thumbnail/thumbnail.model.js +1 -0
  8. package/dist/modules/cache/cache.service.js +50 -71
  9. package/dist/modules/comment/comment.controller.js +3 -13
  10. package/dist/modules/comment/comment.module.js +5 -1
  11. package/dist/modules/comment/comment.service.js +31 -41
  12. package/dist/modules/content/content.module.js +4 -1
  13. package/dist/modules/content/content.property.js +1 -0
  14. package/dist/modules/content/content.service.js +56 -68
  15. package/dist/modules/database/database.liveness-controller.js +19 -30
  16. package/dist/modules/database/database.module.js +4 -12
  17. package/dist/modules/database/lock-service/lock.service.js +22 -35
  18. package/dist/modules/database/model-service/dbs/hub-account.db.d.ts +2 -2
  19. package/dist/modules/database/model-service/dbs/hub-account.db.js +1 -1
  20. package/dist/modules/database/model-service/dbs/hub-books.db.d.ts +2 -2
  21. package/dist/modules/database/model-service/dbs/hub-comments.db.d.ts +2 -2
  22. package/dist/modules/database/model-service/dbs/hub-content.db.d.ts +2 -2
  23. package/dist/modules/database/model-service/dbs/hub-demo-hive.db.d.ts +2 -2
  24. package/dist/modules/database/model-service/dbs/hub-events.db.d.ts +2 -2
  25. package/dist/modules/database/model-service/dbs/hub-hackschool.db.d.ts +6 -6
  26. package/dist/modules/database/model-service/dbs/hub-newsroom.db.d.ts +2 -2
  27. package/dist/modules/database/model-service/dbs/hub-podcasts.db.d.ts +2 -2
  28. package/dist/modules/database/model-service/dbs/hub-team.db.d.ts +2 -2
  29. package/dist/modules/database/model-service/dbs/hub-tech-radar.db.d.ts +4 -4
  30. package/dist/modules/database/model-service/model.service.d.ts +392 -224
  31. package/dist/modules/database/model-service/model.service.js +4 -17
  32. package/dist/modules/fetch/fetch.module.js +4 -1
  33. package/dist/modules/fetch/fetch.service.js +56 -94
  34. package/dist/modules/like/like.controller.js +7 -21
  35. package/dist/modules/like/like.module.js +5 -1
  36. package/dist/modules/like/like.service.js +13 -28
  37. package/dist/modules/mail/mail.module.js +4 -1
  38. package/dist/modules/mail/mail.service.d.ts +5 -5
  39. package/dist/modules/mail/mail.service.js +10 -9
  40. package/dist/modules/notification/notification.module.js +4 -1
  41. package/dist/modules/notification/notification.service.js +2 -2
  42. package/dist/modules/pass/pass.module.js +4 -1
  43. package/dist/modules/pass/pass.service.js +41 -63
  44. package/dist/modules/search/search.module.js +4 -1
  45. package/dist/modules/search/search.service.js +13 -24
  46. package/dist/transform/boolean.transform.js +3 -2
  47. package/dist/transform/image-url.transform.js +1 -1
  48. package/dist/transform/number.transform.js +2 -1
  49. package/dist/transform/string-array.transform.js +1 -1
  50. package/dist/transform/string.transform.js +1 -1
  51. package/dist/transform/timestamp.transform.js +2 -1
  52. package/package.json +54 -24
@@ -11,15 +11,6 @@ var __metadata = (this && this.__metadata) || function (k, v) {
11
11
  var __param = (this && this.__param) || function (paramIndex, decorator) {
12
12
  return function (target, key) { decorator(target, key, paramIndex); }
13
13
  };
14
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
15
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
16
- return new (P || (P = Promise))(function (resolve, reject) {
17
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
18
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
19
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
20
- step((generator = generator.apply(thisArg, _arguments || [])).next());
21
- });
22
- };
23
14
  Object.defineProperty(exports, "__esModule", { value: true });
24
15
  exports.ModelService = void 0;
25
16
  const common_1 = require("@nestjs/common");
@@ -124,10 +115,8 @@ let ModelService = class ModelService {
124
115
  * @param accountId - The MongoDB ID of the account
125
116
  * @returns {Promise<AccountEntity>} A single account or null
126
117
  */
127
- findAccountById(accountId) {
128
- return __awaiter(this, void 0, void 0, function* () {
129
- return this.accountModel.findOne({ _id: accountId });
130
- });
118
+ async findAccountById(accountId) {
119
+ return this.accountModel.findOne({ _id: accountId });
131
120
  }
132
121
  /**
133
122
  * Fetches multiple Account documents by an array of IDs.
@@ -135,10 +124,8 @@ let ModelService = class ModelService {
135
124
  * @param accountIds - List of account IDs to fetch
136
125
  * @returns {Promise<AccountEntity[]>} Array of account documents
137
126
  */
138
- findAccountsByIds(accountIds) {
139
- return __awaiter(this, void 0, void 0, function* () {
140
- return this.accountModel.find({ _id: { $in: accountIds } });
141
- });
127
+ async findAccountsByIds(accountIds) {
128
+ return this.accountModel.find({ _id: { $in: accountIds } });
142
129
  }
143
130
  };
144
131
  exports.ModelService = ModelService;
@@ -53,5 +53,8 @@ let FetchModule = FetchModule_1 = class FetchModule {
53
53
  };
54
54
  exports.FetchModule = FetchModule;
55
55
  exports.FetchModule = FetchModule = FetchModule_1 = __decorate([
56
- (0, common_1.Module)({})
56
+ (0, common_1.Module)({
57
+ providers: [fetch_service_1.FetchService],
58
+ exports: [fetch_service_1.FetchService],
59
+ })
57
60
  ], FetchModule);
@@ -11,15 +11,6 @@ var __metadata = (this && this.__metadata) || function (k, v) {
11
11
  var __param = (this && this.__param) || function (paramIndex, decorator) {
12
12
  return function (target, key) { decorator(target, key, paramIndex); }
13
13
  };
14
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
15
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
16
- return new (P || (P = Promise))(function (resolve, reject) {
17
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
18
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
19
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
20
- step((generator = generator.apply(thisArg, _arguments || [])).next());
21
- });
22
- };
23
14
  var FetchService_1;
24
15
  Object.defineProperty(exports, "__esModule", { value: true });
25
16
  exports.FetchService = void 0;
@@ -118,21 +109,19 @@ let FetchService = FetchService_1 = class FetchService {
118
109
  * @param {string} resourceId - Unique ID for the resource.
119
110
  * @returns {Promise<ResourceInterfaceMap[Resource] | undefined>} - Fetched data or undefined on failure.
120
111
  */
121
- fetch(resource, resourceId) {
122
- return __awaiter(this, void 0, void 0, function* () {
123
- const endpointTemplate = resourceEndpoints[resource][this.isProduction ? 0 : 1];
124
- const resolvedUrl = endpointTemplate.replace('%id%', resourceId);
125
- this.logger.log(`Fetching ${resource} with ID ${resourceId}`);
126
- try {
127
- const response = yield this.axiosInstance.get(resolvedUrl);
128
- this.logger.log(`Successfully fetched ${resource} with ID ${resourceId}`);
129
- return response.data;
130
- }
131
- catch (error) {
132
- this.logger.error(`Failed to fetch ${resource} with ID ${resourceId}: ${error.message}`);
133
- return undefined;
134
- }
135
- });
112
+ async fetch(resource, resourceId) {
113
+ const endpointTemplate = resourceEndpoints[resource][this.isProduction ? 0 : 1];
114
+ const resolvedUrl = endpointTemplate.replace('%id%', resourceId);
115
+ this.logger.log(`Fetching ${resource} with ID ${resourceId}`);
116
+ try {
117
+ const response = await this.axiosInstance.get(resolvedUrl);
118
+ this.logger.log(`Successfully fetched ${resource} with ID ${resourceId}`);
119
+ return response.data;
120
+ }
121
+ catch (error) {
122
+ this.logger.error(`Failed to fetch ${resource} with ID ${resourceId}: ${error.message}`);
123
+ return undefined;
124
+ }
136
125
  }
137
126
  /**
138
127
  * Checks if a given resource ID exists on the server.
@@ -141,24 +130,23 @@ let FetchService = FetchService_1 = class FetchService {
141
130
  * @param {string} resourceId - The ID to check for existence.
142
131
  * @returns {Promise<boolean>} - Whether the resource exists.
143
132
  */
144
- exists(resource, resourceId) {
145
- return __awaiter(this, void 0, void 0, function* () {
146
- const endpoints = resourceEndpoints[resource];
147
- if (!endpoints)
148
- return false;
149
- const endpointTemplate = endpoints[this.isProduction ? 0 : 1];
150
- const resolvedUrl = endpointTemplate.replace('%id%', resourceId);
151
- this.logger.log(`Checking existence of ${resource} with ID ${resourceId}`);
152
- try {
153
- yield this.axiosInstance.get(resolvedUrl);
154
- this.logger.log(`Confirmed existence of ${resource} with ID ${resourceId}`);
155
- return true;
156
- }
157
- catch (error) {
158
- this.logger.error(`Resource ${resource} with ID ${resourceId} not found`);
159
- return false;
160
- }
161
- });
133
+ async exists(resource, resourceId) {
134
+ const endpoints = resourceEndpoints[resource];
135
+ if (!endpoints)
136
+ return false;
137
+ const endpointTemplate = endpoints[this.isProduction ? 0 : 1];
138
+ const resolvedUrl = endpointTemplate.replace('%id%', resourceId);
139
+ this.logger.log(`Checking existence of ${resource} with ID ${resourceId}`);
140
+ try {
141
+ await this.axiosInstance.get(resolvedUrl);
142
+ this.logger.log(`Confirmed existence of ${resource} with ID ${resourceId}`);
143
+ return true;
144
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
145
+ }
146
+ catch (error) {
147
+ this.logger.error(`Resource ${resource} with ID ${resourceId} not found`);
148
+ return false;
149
+ }
162
150
  }
163
151
  /**
164
152
  * Fetches a news item by ID.
@@ -166,10 +154,8 @@ let FetchService = FetchService_1 = class FetchService {
166
154
  * @param {string} newsId - The ID of the news resource to fetch.
167
155
  * @returns {Promise<LabNews | undefined>} - The fetched news item or undefined if not found.
168
156
  */
169
- fetchNews(newsId) {
170
- return __awaiter(this, void 0, void 0, function* () {
171
- return this.fetch(hub_resource_enum_1.FetchableHubResource.NEWSROOM_NEWS, newsId);
172
- });
157
+ async fetchNews(newsId) {
158
+ return this.fetch(hub_resource_enum_1.FetchableHubResource.NEWSROOM_NEWS, newsId);
173
159
  }
174
160
  /**
175
161
  * Fetches an event by ID.
@@ -177,10 +163,8 @@ let FetchService = FetchService_1 = class FetchService {
177
163
  * @param {string} eventId - The ID of the event resource to fetch.
178
164
  * @returns {Promise<LabEvent | undefined>} - The fetched event or undefined if not found.
179
165
  */
180
- fetchEvent(eventId) {
181
- return __awaiter(this, void 0, void 0, function* () {
182
- return this.fetch(hub_resource_enum_1.FetchableHubResource.EVENTS_EVENT, eventId);
183
- });
166
+ async fetchEvent(eventId) {
167
+ return this.fetch(hub_resource_enum_1.FetchableHubResource.EVENTS_EVENT, eventId);
184
168
  }
185
169
  /**
186
170
  * Fetches a demo by ID.
@@ -188,10 +172,8 @@ let FetchService = FetchService_1 = class FetchService {
188
172
  * @param {string} demoId - The ID of the demo resource to fetch.
189
173
  * @returns {Promise<LabDemo | undefined>} - The fetched demo or undefined if not found.
190
174
  */
191
- fetchDemo(demoId) {
192
- return __awaiter(this, void 0, void 0, function* () {
193
- return this.fetch(hub_resource_enum_1.FetchableHubResource.DEMO_HIVE_DEMO, demoId);
194
- });
175
+ async fetchDemo(demoId) {
176
+ return this.fetch(hub_resource_enum_1.FetchableHubResource.DEMO_HIVE_DEMO, demoId);
195
177
  }
196
178
  /**
197
179
  * Fetches a technology radar blip by ID.
@@ -199,10 +181,8 @@ let FetchService = FetchService_1 = class FetchService {
199
181
  * @param {string} blipId - The ID of the blip to fetch.
200
182
  * @returns {Promise<LabTechRadarBlip | undefined>} - The fetched blip or undefined if not found.
201
183
  */
202
- fetchTechRadarBlip(blipId) {
203
- return __awaiter(this, void 0, void 0, function* () {
204
- return this.fetch(hub_resource_enum_1.FetchableHubResource.TECH_RADAR_BLIP, blipId);
205
- });
184
+ async fetchTechRadarBlip(blipId) {
185
+ return this.fetch(hub_resource_enum_1.FetchableHubResource.TECH_RADAR_BLIP, blipId);
206
186
  }
207
187
  /**
208
188
  * Fetches a technology radar edition by ID.
@@ -210,10 +190,8 @@ let FetchService = FetchService_1 = class FetchService {
210
190
  * @param {string} editionId - The ID of the edition to fetch.
211
191
  * @returns {Promise<LabTechRadarEdition | undefined>} - The fetched edition or undefined if not found.
212
192
  */
213
- fetchTechRadarEdition(editionId) {
214
- return __awaiter(this, void 0, void 0, function* () {
215
- return this.fetch(hub_resource_enum_1.FetchableHubResource.TECH_RADAR_EDITION, editionId);
216
- });
193
+ async fetchTechRadarEdition(editionId) {
194
+ return this.fetch(hub_resource_enum_1.FetchableHubResource.TECH_RADAR_EDITION, editionId);
217
195
  }
218
196
  /**
219
197
  * Fetches a podcast by ID.
@@ -221,10 +199,8 @@ let FetchService = FetchService_1 = class FetchService {
221
199
  * @param {string} podcastId - The ID of the podcast resource to fetch.
222
200
  * @returns {Promise<LabPodcast | undefined>} - The fetched podcast or undefined if not found.
223
201
  */
224
- fetchPodcast(podcastId) {
225
- return __awaiter(this, void 0, void 0, function* () {
226
- return this.fetch(hub_resource_enum_1.FetchableHubResource.PODCASTS_PODCAST, podcastId);
227
- });
202
+ async fetchPodcast(podcastId) {
203
+ return this.fetch(hub_resource_enum_1.FetchableHubResource.PODCASTS_PODCAST, podcastId);
228
204
  }
229
205
  /**
230
206
  * Fetches a book by ID.
@@ -232,10 +208,8 @@ let FetchService = FetchService_1 = class FetchService {
232
208
  * @param {string} bookId - The ID of the book resource to fetch.
233
209
  * @returns {Promise<LabBook | undefined>} - The fetched book or undefined if not found.
234
210
  */
235
- fetchBook(bookId) {
236
- return __awaiter(this, void 0, void 0, function* () {
237
- return this.fetch(hub_resource_enum_1.FetchableHubResource.BOOKS_BOOK, bookId);
238
- });
211
+ async fetchBook(bookId) {
212
+ return this.fetch(hub_resource_enum_1.FetchableHubResource.BOOKS_BOOK, bookId);
239
213
  }
240
214
  /**
241
215
  * Fetches a Hackschool course by ID.
@@ -243,10 +217,8 @@ let FetchService = FetchService_1 = class FetchService {
243
217
  * @param {string} courseId - The ID of the course to fetch.
244
218
  * @returns {Promise<LabHackschoolCourse | undefined>} - The fetched course or undefined if not found.
245
219
  */
246
- fetchHackschoolCourse(courseId) {
247
- return __awaiter(this, void 0, void 0, function* () {
248
- return this.fetch(hub_resource_enum_1.FetchableHubResource.HACKSCHOOL_COURSE, courseId);
249
- });
220
+ async fetchHackschoolCourse(courseId) {
221
+ return this.fetch(hub_resource_enum_1.FetchableHubResource.HACKSCHOOL_COURSE, courseId);
250
222
  }
251
223
  /**
252
224
  * Fetches a Hackschool thread by ID.
@@ -254,10 +226,8 @@ let FetchService = FetchService_1 = class FetchService {
254
226
  * @param {string} threadId - The ID of the thread to fetch.
255
227
  * @returns {Promise<LabHackschoolThread | undefined>} - The fetched thread or undefined if not found.
256
228
  */
257
- fetchHackschoolThread(threadId) {
258
- return __awaiter(this, void 0, void 0, function* () {
259
- return this.fetch(hub_resource_enum_1.FetchableHubResource.HACKSCHOOL_THREAD, threadId);
260
- });
229
+ async fetchHackschoolThread(threadId) {
230
+ return this.fetch(hub_resource_enum_1.FetchableHubResource.HACKSCHOOL_THREAD, threadId);
261
231
  }
262
232
  /**
263
233
  * Fetches a Hackschool document by ID.
@@ -265,10 +235,8 @@ let FetchService = FetchService_1 = class FetchService {
265
235
  * @param {string} docId - The ID of the document to fetch.
266
236
  * @returns {Promise<LabHackschoolDoc | undefined>} - The fetched document or undefined if not found.
267
237
  */
268
- fetchHackschoolDoc(docId) {
269
- return __awaiter(this, void 0, void 0, function* () {
270
- return this.fetch(hub_resource_enum_1.FetchableHubResource.HACKSCHOOL_DOC, docId);
271
- });
238
+ async fetchHackschoolDoc(docId) {
239
+ return this.fetch(hub_resource_enum_1.FetchableHubResource.HACKSCHOOL_DOC, docId);
272
240
  }
273
241
  /**
274
242
  * Fetches a team member by ID.
@@ -276,10 +244,8 @@ let FetchService = FetchService_1 = class FetchService {
276
244
  * @param {string} memberId - The ID of the member to fetch.
277
245
  * @returns {Promise<LabTeamMember | undefined>} - The fetched member or undefined if not found.
278
246
  */
279
- fetchTeamMember(memberId) {
280
- return __awaiter(this, void 0, void 0, function* () {
281
- return this.fetch(hub_resource_enum_1.FetchableHubResource.TEAM_MEMBER, memberId);
282
- });
247
+ async fetchTeamMember(memberId) {
248
+ return this.fetch(hub_resource_enum_1.FetchableHubResource.TEAM_MEMBER, memberId);
283
249
  }
284
250
  /**
285
251
  * Fetches a newsletter issue by ID.
@@ -287,10 +253,8 @@ let FetchService = FetchService_1 = class FetchService {
287
253
  * @param {string} newsletterId - The ID of the newsletter issue to fetch.
288
254
  * @returns {Promise<LabNewsletter | undefined>} - The fetched newsletter or undefined if not found.
289
255
  */
290
- fetchNewsletter(newsletterId) {
291
- return __awaiter(this, void 0, void 0, function* () {
292
- return this.fetch(hub_resource_enum_1.FetchableHubResource.NEWSLETTER_ISSUE, newsletterId);
293
- });
256
+ async fetchNewsletter(newsletterId) {
257
+ return this.fetch(hub_resource_enum_1.FetchableHubResource.NEWSLETTER_ISSUE, newsletterId);
294
258
  }
295
259
  /**
296
260
  * Fetches a user account by ID.
@@ -298,10 +262,8 @@ let FetchService = FetchService_1 = class FetchService {
298
262
  * @param {string} userId - The ID of the user account to fetch.
299
263
  * @returns {Promise<AccountEntity | undefined>} - The fetched user or undefined if not found.
300
264
  */
301
- fetchUser(userId) {
302
- return __awaiter(this, void 0, void 0, function* () {
303
- return this.fetch(hub_resource_enum_1.FetchableHubResource.HUB_USER, userId);
304
- });
265
+ async fetchUser(userId) {
266
+ return this.fetch(hub_resource_enum_1.FetchableHubResource.HUB_USER, userId);
305
267
  }
306
268
  };
307
269
  exports.FetchService = FetchService;
@@ -11,15 +11,6 @@ var __metadata = (this && this.__metadata) || function (k, v) {
11
11
  var __param = (this && this.__param) || function (paramIndex, decorator) {
12
12
  return function (target, key) { decorator(target, key, paramIndex); }
13
13
  };
14
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
15
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
16
- return new (P || (P = Promise))(function (resolve, reject) {
17
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
18
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
19
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
20
- step((generator = generator.apply(thisArg, _arguments || [])).next());
21
- });
22
- };
23
14
  Object.defineProperty(exports, "__esModule", { value: true });
24
15
  exports.LikeController = void 0;
25
16
  const common_1 = require("@nestjs/common");
@@ -51,10 +42,8 @@ let LikeController = class LikeController {
51
42
  * @param {string} accountId - The ID of the authenticated account performing the like.
52
43
  * @returns {Promise<number>} The updated total number of likes after addition.
53
44
  */
54
- addLikeToResource(resourceId, accountId) {
55
- return __awaiter(this, void 0, void 0, function* () {
56
- return this.likeService.addLike(resourceId, accountId);
57
- });
45
+ async addLikeToResource(resourceId, accountId) {
46
+ return this.likeService.addLike(resourceId, accountId);
58
47
  }
59
48
  /**
60
49
  * Removes the authenticated user's like from the specified resource.
@@ -63,10 +52,8 @@ let LikeController = class LikeController {
63
52
  * @param {string} accountId - The ID of the authenticated account removing the like.
64
53
  * @returns {Promise<number>} The updated total number of likes after removal.
65
54
  */
66
- removeLikeFromResource(resourceId, accountId) {
67
- return __awaiter(this, void 0, void 0, function* () {
68
- return this.likeService.removeLike(resourceId, accountId);
69
- });
55
+ async removeLikeFromResource(resourceId, accountId) {
56
+ return this.likeService.removeLike(resourceId, accountId);
70
57
  }
71
58
  /**
72
59
  * Checks if the authenticated user has liked the given resource.
@@ -75,10 +62,8 @@ let LikeController = class LikeController {
75
62
  * @param {string} accountId - The ID of the authenticated account to check.
76
63
  * @returns {Promise<boolean>} True if the user has liked the resource, false otherwise.
77
64
  */
78
- isResourceLikedByUser(resourceId, accountId) {
79
- return __awaiter(this, void 0, void 0, function* () {
80
- return this.likeService.hasLiked(resourceId, accountId);
81
- });
65
+ async isResourceLikedByUser(resourceId, accountId) {
66
+ return this.likeService.hasLiked(resourceId, accountId);
82
67
  }
83
68
  };
84
69
  exports.LikeController = LikeController;
@@ -135,5 +120,6 @@ __decorate([
135
120
  ], LikeController.prototype, "isResourceLikedByUser", null);
136
121
  exports.LikeController = LikeController = __decorate([
137
122
  (0, authentication_1.RequireJwtAuth)(),
123
+ (0, common_1.Controller)(),
138
124
  __metadata("design:paramtypes", [like_service_1.LikeService])
139
125
  ], LikeController);
@@ -59,5 +59,9 @@ let LikeModule = LikeModule_1 = class LikeModule {
59
59
  };
60
60
  exports.LikeModule = LikeModule;
61
61
  exports.LikeModule = LikeModule = LikeModule_1 = __decorate([
62
- (0, common_1.Module)({})
62
+ (0, common_1.Module)({
63
+ controllers: [like_controller_1.LikeController],
64
+ providers: [like_service_1.LikeService],
65
+ exports: [like_service_1.LikeService],
66
+ })
63
67
  ], LikeModule);
@@ -11,15 +11,6 @@ var __metadata = (this && this.__metadata) || function (k, v) {
11
11
  var __param = (this && this.__param) || function (paramIndex, decorator) {
12
12
  return function (target, key) { decorator(target, key, paramIndex); }
13
13
  };
14
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
15
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
16
- return new (P || (P = Promise))(function (resolve, reject) {
17
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
18
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
19
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
20
- step((generator = generator.apply(thisArg, _arguments || [])).next());
21
- });
22
- };
23
14
  var LikeService_1;
24
15
  Object.defineProperty(exports, "__esModule", { value: true });
25
16
  exports.LikeService = void 0;
@@ -66,12 +57,10 @@ let LikeService = LikeService_1 = class LikeService {
66
57
  * @param {string} accountId - The account identifier that likes the resource.
67
58
  * @returns {Promise<number>} The updated like count.
68
59
  */
69
- addLike(resourceId, accountId) {
70
- return __awaiter(this, void 0, void 0, function* () {
71
- this.logger.log(`Adding like to resource ${resourceId} by account ${accountId}`);
72
- const updatedResource = yield this.likeModel.findOneAndUpdate({ _id: resourceId }, { $addToSet: { _likedBy: accountId } }, { new: true, upsert: false, timestamps: false });
73
- return this.getLikeCount(updatedResource);
74
- });
60
+ async addLike(resourceId, accountId) {
61
+ this.logger.log(`Adding like to resource ${resourceId} by account ${accountId}`);
62
+ const updatedResource = await this.likeModel.findOneAndUpdate({ _id: resourceId }, { $addToSet: { _likedBy: accountId } }, { new: true, upsert: false, timestamps: false });
63
+ return this.getLikeCount(updatedResource);
75
64
  }
76
65
  /**
77
66
  * Removes a like from the specified resource by the given account.
@@ -83,12 +72,10 @@ let LikeService = LikeService_1 = class LikeService {
83
72
  * @param {string} accountId - The account identifier that removes the like.
84
73
  * @returns {Promise<number>} The updated like count.
85
74
  */
86
- removeLike(resourceId, accountId) {
87
- return __awaiter(this, void 0, void 0, function* () {
88
- this.logger.log(`Removing like from resource ${resourceId} by account ${accountId}`);
89
- const updatedResource = yield this.likeModel.findOneAndUpdate({ _id: resourceId }, { $pull: { _likedBy: accountId } }, { new: true, upsert: false, timestamps: false });
90
- return this.getLikeCount(updatedResource);
91
- });
75
+ async removeLike(resourceId, accountId) {
76
+ this.logger.log(`Removing like from resource ${resourceId} by account ${accountId}`);
77
+ const updatedResource = await this.likeModel.findOneAndUpdate({ _id: resourceId }, { $pull: { _likedBy: accountId } }, { new: true, upsert: false, timestamps: false });
78
+ return this.getLikeCount(updatedResource);
92
79
  }
93
80
  /**
94
81
  * Checks whether the specified account has liked the resource.
@@ -100,13 +87,11 @@ let LikeService = LikeService_1 = class LikeService {
100
87
  * @param {string} accountId - The account to verify.
101
88
  * @returns {Promise<boolean>} True if the account has liked the resource; false otherwise.
102
89
  */
103
- hasLiked(resourceId, accountId) {
104
- return __awaiter(this, void 0, void 0, function* () {
105
- var _a;
106
- this.logger.log(`Checking if account ${accountId} has liked resource ${resourceId}`);
107
- const resource = yield this.likeModel.findOne({ _id: resourceId });
108
- return !!((_a = resource === null || resource === void 0 ? void 0 : resource._likedBy) === null || _a === void 0 ? void 0 : _a.includes(accountId));
109
- });
90
+ async hasLiked(resourceId, accountId) {
91
+ var _a;
92
+ this.logger.log(`Checking if account ${accountId} has liked resource ${resourceId}`);
93
+ const resource = await this.likeModel.findOne({ _id: resourceId });
94
+ return !!((_a = resource === null || resource === void 0 ? void 0 : resource._likedBy) === null || _a === void 0 ? void 0 : _a.includes(accountId));
110
95
  }
111
96
  };
112
97
  exports.LikeService = LikeService;
@@ -53,5 +53,8 @@ let MailModule = MailModule_1 = class MailModule {
53
53
  };
54
54
  exports.MailModule = MailModule;
55
55
  exports.MailModule = MailModule = MailModule_1 = __decorate([
56
- (0, common_1.Module)({})
56
+ (0, common_1.Module)({
57
+ providers: [mail_service_1.MailService],
58
+ exports: [mail_service_1.MailService],
59
+ })
57
60
  ], MailModule);
@@ -4,7 +4,7 @@ import { AuthLoginTokenMailDto, AuthPasswordResetMailDto, EventCancelMailDto, Ev
4
4
  /**
5
5
  * Constant list of supported mail types.
6
6
  */
7
- declare const supportedMailTypes: readonly ["auth.login-token", "auth.password-reset", "event.invite", "event.cancel", "idea.submitted", "idea.status-update", "lunch-roullete.submitted", "lunch-roullete.cancel", "lunch-roullete.matched", "lunch-roullete.unmatched", "newsletter.subscribed", "newsletter.unsubscribed", "newsletter.issue", "notification.notification"];
7
+ declare const supportedMailTypes: readonly ["auth.login-token", "auth.password-reset", "event.invite", "event.cancel", "idea.submitted", "idea.status-update", "lunch-roulette.submitted", "lunch-roulette.cancel", "lunch-roulette.matched", "lunch-roulette.unmatched", "newsletter.subscribed", "newsletter.unsubscribed", "newsletter.issue", "notification.notification"];
8
8
  /**
9
9
  * Union type representing valid mail kinds.
10
10
  */
@@ -20,10 +20,10 @@ type MailTypeDtoMap = {
20
20
  'event.cancel': EventCancelMailDto;
21
21
  'idea.submitted': IdeaSubmittedMailDto;
22
22
  'idea.status-update': IdeaStatusUpdateMailDto;
23
- 'lunch-roullete.submitted': LunchRouletteSubmittedMailDto;
24
- 'lunch-roullete.cancel': LunchRouletteCancelMailDto;
25
- 'lunch-roullete.matched': LunchRouletteMatchedMailDto;
26
- 'lunch-roullete.unmatched': LunchRouletteUnmatchedMailDto;
23
+ 'lunch-roulette.submitted': LunchRouletteSubmittedMailDto;
24
+ 'lunch-roulette.cancel': LunchRouletteCancelMailDto;
25
+ 'lunch-roulette.matched': LunchRouletteMatchedMailDto;
26
+ 'lunch-roulette.unmatched': LunchRouletteUnmatchedMailDto;
27
27
  'newsletter.subscribed': NewsletterSubscribedMailDto;
28
28
  'newsletter.unsubscribed': NewsletterUnsubscribedMailDto;
29
29
  'newsletter.issue': NewsletterIssueMailDto;
@@ -21,6 +21,7 @@ const authentication_1 = require("../authentication");
21
21
  /**
22
22
  * Constant list of supported mail types.
23
23
  */
24
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
24
25
  const supportedMailTypes = [
25
26
  'auth.login-token',
26
27
  'auth.password-reset',
@@ -28,10 +29,10 @@ const supportedMailTypes = [
28
29
  'event.cancel',
29
30
  'idea.submitted',
30
31
  'idea.status-update',
31
- 'lunch-roullete.submitted',
32
- 'lunch-roullete.cancel',
33
- 'lunch-roullete.matched',
34
- 'lunch-roullete.unmatched',
32
+ 'lunch-roulette.submitted',
33
+ 'lunch-roulette.cancel',
34
+ 'lunch-roulette.matched',
35
+ 'lunch-roulette.unmatched',
35
36
  'newsletter.subscribed',
36
37
  'newsletter.unsubscribed',
37
38
  'newsletter.issue',
@@ -89,7 +90,7 @@ let MailService = MailService_1 = class MailService {
89
90
  this.logger.log(`Email sent successfully: ${type}`);
90
91
  })
91
92
  .catch(({ response }) => {
92
- this.logger.error(`Failed to send email: ${type}: ${response.data}`);
93
+ this.logger.error(`Failed to send email: ${type}: ${JSON.stringify(response === null || response === void 0 ? void 0 : response.data)}`);
93
94
  });
94
95
  }
95
96
  // ─────────────────────────────────────────────
@@ -151,28 +152,28 @@ let MailService = MailService_1 = class MailService {
151
152
  * @param {LunchRouletteSubmittedMailDto} payload - DTO with recipient, location, and type.
152
153
  */
153
154
  sendLunchRouletteSubmitted(payload) {
154
- this.send('lunch-roullete.submitted', payload);
155
+ this.send('lunch-roulette.submitted', payload);
155
156
  }
156
157
  /**
157
158
  * Sends a cancellation email for lunch roulette.
158
159
  * @param {LunchRouletteCancelMailDto} payload - DTO containing the recipient.
159
160
  */
160
161
  sendLunchRouletteCancel(payload) {
161
- this.send('lunch-roullete.cancel', payload);
162
+ this.send('lunch-roulette.cancel', payload);
162
163
  }
163
164
  /**
164
165
  * Sends a match notification to lunch roulette participants.
165
166
  * @param {LunchRouletteMatchedMailDto} payload - DTO with recipients, message, and details URL.
166
167
  */
167
168
  sendLunchRouletteMatched(payload) {
168
- this.send('lunch-roullete.matched', payload);
169
+ this.send('lunch-roulette.matched', payload);
169
170
  }
170
171
  /**
171
172
  * Notifies a user that they were unmatched in lunch roulette.
172
173
  * @param {LunchRouletteUnmatchedMailDto} payload - DTO with the unmatched recipient.
173
174
  */
174
175
  sendLunchRouletteUnmatched(payload) {
175
- this.send('lunch-roullete.unmatched', payload);
176
+ this.send('lunch-roulette.unmatched', payload);
176
177
  }
177
178
  // ─────────────────────────────────────────────
178
179
  // Newsletter Emails
@@ -56,5 +56,8 @@ let NotificationModule = NotificationModule_1 = class NotificationModule {
56
56
  };
57
57
  exports.NotificationModule = NotificationModule;
58
58
  exports.NotificationModule = NotificationModule = NotificationModule_1 = __decorate([
59
- (0, common_1.Module)({})
59
+ (0, common_1.Module)({
60
+ providers: [notification_service_1.NotificationService],
61
+ exports: [notification_service_1.NotificationService],
62
+ })
60
63
  ], NotificationModule);
@@ -69,7 +69,7 @@ let NotificationService = NotificationService_1 = class NotificationService {
69
69
  this.logger.log(`Successfully scheduled ${this.resource} (${resourceId})`);
70
70
  })
71
71
  .catch(({ response }) => {
72
- this.logger.error(`Failed to schedule ${this.resource} (${resourceId})`, response === null || response === void 0 ? void 0 : response.data);
72
+ this.logger.error(`Failed to schedule ${this.resource} (${resourceId}): ${JSON.stringify(response === null || response === void 0 ? void 0 : response.data)}`);
73
73
  });
74
74
  }
75
75
  /**
@@ -87,7 +87,7 @@ let NotificationService = NotificationService_1 = class NotificationService {
87
87
  this.logger.log(`Successfully unscheduled ${this.resource} (${resourceId})`);
88
88
  })
89
89
  .catch(({ response }) => {
90
- this.logger.error(`Failed to unschedule ${this.resource} (${resourceId})`, response === null || response === void 0 ? void 0 : response.data);
90
+ this.logger.error(`Failed to unschedule ${this.resource} (${resourceId}): ${JSON.stringify(response === null || response === void 0 ? void 0 : response.data)}`);
91
91
  });
92
92
  }
93
93
  };
@@ -54,5 +54,8 @@ let PassModule = PassModule_1 = class PassModule {
54
54
  };
55
55
  exports.PassModule = PassModule;
56
56
  exports.PassModule = PassModule = PassModule_1 = __decorate([
57
- (0, common_1.Module)({})
57
+ (0, common_1.Module)({
58
+ providers: [pass_service_1.PassService],
59
+ exports: [pass_service_1.PassService],
60
+ })
58
61
  ], PassModule);