itlab-internal-services 2.16.9 → 2.16.11

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 (24) hide show
  1. package/dist/classes/document/likeable-document.class.d.ts +2 -2
  2. package/dist/classes/document/likeable-document.class.js +6 -3
  3. package/dist/classes/document/viewable-document.class.d.ts +2 -2
  4. package/dist/classes/document/viewable-document.class.js +6 -3
  5. package/dist/classes/entity-map.class.d.ts +1 -1
  6. package/dist/classes/entity-map.class.js +2 -0
  7. package/dist/classes/fetch-options/liked-by-options.class.js +2 -1
  8. package/dist/classes/fetch-options/viewed-by-options.class.d.ts +2 -1
  9. package/dist/classes/fetch-options/viewed-by-options.class.js +14 -3
  10. package/dist/modules/comments/comments.service.js +6 -7
  11. package/dist/modules/services/providers/content/content-return-types.js +4 -4
  12. package/dist/modules/services/providers/content/content.service.js +6 -7
  13. package/dist/modules/services/providers/mail/dtos/auth-login-token-mail.dto.v1.d.ts +1 -1
  14. package/dist/modules/services/providers/mail/dtos/auth-password-reset-mail.dto.v1.d.ts +1 -1
  15. package/dist/modules/services/providers/mail/mail-types.d.ts +4 -4
  16. package/dist/modules/services/providers/mail/mail-types.js +16 -16
  17. package/dist/modules/services/providers/mail/mail.service.d.ts +5 -5
  18. package/dist/modules/services/providers/mail/mail.service.js +7 -7
  19. package/dist/modules/services/providers/notifications/notifications.service.d.ts +1 -1
  20. package/dist/modules/services/providers/notifications/notifications.service.js +1 -1
  21. package/dist/pipes/params/hub-id.pipe.js +6 -3
  22. package/dist/types/likeable.type.d.ts +2 -2
  23. package/dist/types/viewable.type.d.ts +2 -2
  24. package/package.json +1 -1
@@ -4,8 +4,8 @@ export declare function LikeableDocument<TBase extends new (...args: any[]) => D
4
4
  requiredPermissions?: string[];
5
5
  }): {
6
6
  new (...args: any[]): {
7
- _likedBy: string[];
8
- likes: number;
7
+ _likedBy?: string[];
8
+ likes?: number;
9
9
  likedBy?: User[];
10
10
  hasLiked(accountId: string): boolean;
11
11
  addLike(accountId: string): Promise<number>;
@@ -18,20 +18,23 @@ const pipes_1 = require("../../pipes");
18
18
  function LikeableDocument(Base, options) {
19
19
  class LikeableDocument extends Base {
20
20
  hasLiked(accountId) {
21
- return this._likedBy.includes(accountId);
21
+ var _a;
22
+ return ((_a = this._likedBy) !== null && _a !== void 0 ? _a : []).includes(accountId);
22
23
  }
23
24
  async addLike(accountId) {
25
+ var _a;
24
26
  if (!(0, class_validator_1.isMongoId)(accountId))
25
27
  return this.likes;
26
- this._likedBy = Array.from(new Set([...this._likedBy, accountId]));
28
+ this._likedBy = Array.from(new Set([...((_a = this._likedBy) !== null && _a !== void 0 ? _a : []), accountId]));
27
29
  this.likes = this._likedBy.length;
28
30
  await this.save({ timestamps: false });
29
31
  return this.likes;
30
32
  }
31
33
  async removeLike(accountId) {
34
+ var _a;
32
35
  if (!(0, class_validator_1.isMongoId)(accountId))
33
36
  return this.likes;
34
- this._likedBy = this._likedBy.filter((id) => id !== accountId);
37
+ this._likedBy = ((_a = this._likedBy) !== null && _a !== void 0 ? _a : []).filter((id) => id !== accountId);
35
38
  this.likes = this._likedBy.length;
36
39
  await this.save({ timestamps: false });
37
40
  return this.likes;
@@ -4,8 +4,8 @@ export declare function ViewableDocument<TBase extends new (...args: any[]) => D
4
4
  requiredPermissions?: string[];
5
5
  }): {
6
6
  new (...args: any[]): {
7
- _viewedBy: string[];
8
- views: number;
7
+ _viewedBy?: string[];
8
+ views?: number;
9
9
  viewedBy?: User[];
10
10
  hasViewed(accountId: string): boolean;
11
11
  addView(accountId: string): Promise<number>;
@@ -18,20 +18,23 @@ const pipes_1 = require("../../pipes");
18
18
  function ViewableDocument(Base, options) {
19
19
  class ViewableDocument extends Base {
20
20
  hasViewed(accountId) {
21
- return this._viewedBy.includes(accountId);
21
+ var _a;
22
+ return ((_a = this._viewedBy) !== null && _a !== void 0 ? _a : []).includes(accountId);
22
23
  }
23
24
  async addView(accountId) {
25
+ var _a;
24
26
  if (!(0, class_validator_1.isMongoId)(accountId))
25
27
  return this.views;
26
- this._viewedBy = Array.from(new Set([...this._viewedBy, accountId]));
28
+ this._viewedBy = Array.from(new Set([...((_a = this._viewedBy) !== null && _a !== void 0 ? _a : []), accountId]));
27
29
  this.views = this._viewedBy.length;
28
30
  await this.save({ timestamps: false });
29
31
  return this.views;
30
32
  }
31
33
  async removeView(accountId) {
34
+ var _a;
32
35
  if (!(0, class_validator_1.isMongoId)(accountId))
33
36
  return this.views;
34
- this._viewedBy = this._viewedBy.filter((id) => id !== accountId);
37
+ this._viewedBy = ((_a = this._viewedBy) !== null && _a !== void 0 ? _a : []).filter((id) => id !== accountId);
35
38
  this.views = this._viewedBy.length;
36
39
  await this.save({ timestamps: false });
37
40
  return this.views;
@@ -17,5 +17,5 @@ export declare class EntityMap<T extends {
17
17
  * @param map Map of id -> user/account object
18
18
  * @returns Array of user/account objects
19
19
  */
20
- getMultiple(ids: string[]): T[];
20
+ getMultiple(ids?: string[]): T[];
21
21
  }
@@ -22,6 +22,8 @@ class EntityMap {
22
22
  * @returns Array of user/account objects
23
23
  */
24
24
  getMultiple(ids) {
25
+ if (!ids || ids.length === 0)
26
+ return [];
25
27
  return ids.map((id) => this.map.get(id)).filter(Boolean);
26
28
  }
27
29
  }
@@ -39,7 +39,8 @@ async function populateLikedBy(options, items, accountsService) {
39
39
  });
40
40
  }
41
41
  items.forEach((item) => {
42
- item.likes = Math.max(item._likedBy.length, item.likes); // TODO: Tmp Fix
42
+ var _a, _b, _c;
43
+ item.likes = (_c = (_b = (_a = item._likedBy) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : item.likes) !== null && _c !== void 0 ? _c : 0;
43
44
  if (!options.includeLikedBy)
44
45
  item.likedBy = undefined;
45
46
  if (!(options.includeLikedBy || options.includeLikedByIds)) {
@@ -1,3 +1,4 @@
1
+ import { Document } from 'mongoose';
1
2
  import { AccountsService } from '../../modules';
2
3
  import { IsViewable } from '../../types';
3
4
  export type ViewedByFetchOptions = {
@@ -18,4 +19,4 @@ export declare function populateViewedBy(options: {
18
19
  includeViewedBy?: boolean;
19
20
  includeViewedByIds?: boolean;
20
21
  viewedBy?: string;
21
- }, items: IsViewable[], accountsService: AccountsService): Promise<void>;
22
+ }, items: (Document & IsViewable)[], accountsService: AccountsService): Promise<void>;
@@ -11,9 +11,9 @@ var __metadata = (this && this.__metadata) || function (k, v) {
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.ViewedByOptions = ViewedByOptions;
13
13
  exports.populateViewedBy = populateViewedBy;
14
+ const common_1 = require("@nestjs/common");
14
15
  const swagger_1 = require("@nestjs/swagger");
15
16
  const class_validator_1 = require("class-validator");
16
- const rxjs_1 = require("rxjs");
17
17
  const pipes_1 = require("../../pipes");
18
18
  const transform_1 = require("../../transform");
19
19
  function ViewedByOptions(Base, options) {
@@ -37,8 +37,18 @@ function ViewedByOptions(Base, options) {
37
37
  }
38
38
  async function populateViewedBy(options, items, accountsService) {
39
39
  if (options.viewedBy) {
40
+ const logger = new common_1.Logger('MongooseModule');
40
41
  items.forEach((item) => {
41
- item.addView(options.viewedBy).then(rxjs_1.noop);
42
+ var _a;
43
+ const viewedBy = Array.from(new Set([...((_a = item._viewedBy) !== null && _a !== void 0 ? _a : []), options.viewedBy]));
44
+ item
45
+ .updateOne({ $set: { _viewedBy: viewedBy, views: viewedBy.length } }, { timestamps: false })
46
+ .then(() => {
47
+ logger.log(`Added unique accountId '${options.viewedBy}' to '_viewedBy' for document ${item._id.toString()}`);
48
+ })
49
+ .catch((error) => {
50
+ logger.error(`Failed to add accountId '${options.viewedBy}' to attribute '_viewedBy' for document ${item._id.toString()}: ${error.stack}`);
51
+ });
42
52
  });
43
53
  }
44
54
  if (options.includeViewedBy) {
@@ -48,7 +58,8 @@ async function populateViewedBy(options, items, accountsService) {
48
58
  });
49
59
  }
50
60
  items.forEach((item) => {
51
- item.views = Math.max(item._viewedBy.length, item.views); // TODO: Tmp Fix
61
+ var _a, _b, _c;
62
+ item.views = (_c = (_b = (_a = item._viewedBy) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : item.views) !== null && _c !== void 0 ? _c : 0;
52
63
  if (!options.includeViewedBy)
53
64
  item.viewedBy = undefined;
54
65
  if (!(options.includeViewedBy || options.includeViewedByIds)) {
@@ -55,12 +55,11 @@ let CommentsService = class CommentsService extends base_http_service_1.BaseHttp
55
55
  }
56
56
  return this.connection.model(this.options.model.name, this.options.model.schema);
57
57
  }
58
- clearCache(resourceId) {
58
+ async clearCache(resourceId) {
59
59
  if (this.cacheService) {
60
60
  const cacheKey = this.cacheKey(resourceId);
61
- this.cacheService.remove(cacheKey).then(() => {
62
- this.logger.log(`Comments cache for ${this.options.resource} ${resourceId} cleared.`);
63
- });
61
+ await this.cacheService.remove(cacheKey);
62
+ this.logger.log(`Comments cache for ${this.options.resource} ${resourceId} cleared.`);
64
63
  }
65
64
  }
66
65
  /**
@@ -97,7 +96,7 @@ let CommentsService = class CommentsService extends base_http_service_1.BaseHttp
97
96
  params: { ownerId, ownerIds },
98
97
  });
99
98
  this.logger.log(`Account ${accountId} successfully posted a comment on ${resourceType} resource ${resourceId}`);
100
- this.clearCache(resourceId);
99
+ await this.clearCache(resourceId);
101
100
  return data;
102
101
  }
103
102
  catch (error) {
@@ -117,9 +116,9 @@ let CommentsService = class CommentsService extends base_http_service_1.BaseHttp
117
116
  this.logger.log(`Deleting all comments for ${this.options.resource} ${resourceId}...`);
118
117
  this.httpClient
119
118
  .delete(endpoint)
120
- .then(() => {
119
+ .then(async () => {
121
120
  this.logger.log(`All comments for ${this.options.resource} ${resourceId} deleted successfully.`);
122
- this.clearCache(resourceId);
121
+ await this.clearCache(resourceId);
123
122
  })
124
123
  .catch((error) => {
125
124
  const { message } = this.parseError(error);
@@ -6,8 +6,8 @@ exports.ContentReturnTypeEndpointMap = exports.supportedContentReturnTypes = voi
6
6
  */
7
7
  exports.supportedContentReturnTypes = ['json', 'text', 'html', 'htmlPopulated'];
8
8
  exports.ContentReturnTypeEndpointMap = {
9
- json: 'v1/content/%resource%/%resourceId%/json',
10
- text: 'v1/content/%resource%/%resourceId%/text',
11
- html: 'v1/content/%resource%/%resourceId%/html',
12
- htmlPopulated: 'v1/content/%resource%/%resourceId%/html/populated',
9
+ json: 'v1/internal/content/%resource%/%resourceId%/json',
10
+ text: 'v1/internal/content/%resource%/%resourceId%/text',
11
+ html: 'v1/internal/content/%resource%/%resourceId%/html',
12
+ htmlPopulated: 'v1/internal/content/%resource%/%resourceId%/html/populated',
13
13
  };
@@ -85,15 +85,14 @@ let ContentService = ContentService_1 = class ContentService extends base_http_s
85
85
  ],
86
86
  };
87
87
  }
88
- clearCache(resourceId) {
88
+ async clearCache(resourceId) {
89
89
  if (this.cacheService) {
90
90
  const promises = content_return_types_1.supportedContentReturnTypes.map((returnType) => {
91
91
  const cacheKey = this.cacheKey(resourceId, returnType);
92
92
  return this.cacheService.remove(cacheKey);
93
93
  });
94
- Promise.all(promises).then(() => {
95
- this.logger.log(`Content cache for ${this.options.resource} ${resourceId} cleared.`);
96
- });
94
+ await Promise.all(promises);
95
+ this.logger.log(`Content cache for ${this.options.resource} ${resourceId} cleared.`);
97
96
  }
98
97
  }
99
98
  // ─────────────────────────────────────────────────────────────
@@ -174,7 +173,7 @@ let ContentService = ContentService_1 = class ContentService extends base_http_s
174
173
  try {
175
174
  await this.httpClient.post(`v1/internal/content/${this.options.resource}/${resourceId}`, { content });
176
175
  this.logger.log(`Content successfully submitted for ${this.options.resource} ${resourceId}.`);
177
- this.clearCache(resourceId);
176
+ await this.clearCache(resourceId);
178
177
  }
179
178
  catch (error) {
180
179
  const { status, data, message } = this.parseError(error);
@@ -208,9 +207,9 @@ let ContentService = ContentService_1 = class ContentService extends base_http_s
208
207
  this.logger.log(`Removing content for ${this.options.resource} ${resourceId}...`);
209
208
  this.httpClient
210
209
  .delete(endpoint)
211
- .then(() => {
210
+ .then(async () => {
212
211
  this.logger.log(`Content removed successfully for ${this.options.resource} (${resourceId}).`);
213
- this.clearCache(resourceId);
212
+ await this.clearCache(resourceId);
214
213
  })
215
214
  .catch((error) => {
216
215
  const { message } = this.parseError(error);
@@ -2,7 +2,7 @@ import { MailRecipient } from '../models';
2
2
  /**
3
3
  * Payload for sending a login token email to a user.
4
4
  */
5
- export type AuthLoginTokenMailDtoV1 = {
5
+ export type AccountLoginTokenMailDtoV1 = {
6
6
  /**
7
7
  * Recipient information for the email.
8
8
  */
@@ -2,7 +2,7 @@ import { MailRecipient } from '../models';
2
2
  /**
3
3
  * Payload for sending a password reset email to a user.
4
4
  */
5
- export type AuthPasswordResetMailDtoV1 = {
5
+ export type AccountPasswordResetMailDtoV1 = {
6
6
  /**
7
7
  * Recipient information for the email.
8
8
  */
@@ -1,8 +1,8 @@
1
- import { AuthLoginTokenMailDtoV1, AuthPasswordResetMailDtoV1, EventCancelMailDtoV1, EventInviteMailDtoV1, IdeaStatusUpdateMailDtoV1, IdeaSubmittedMailDtoV1, LunchRouletteCancelMailDtoV1, LunchRouletteMatchedMailDtoV1, LunchRouletteSubmittedMailDtoV1, LunchRouletteUnmatchedMailDtoV1, NewsletterIssueMailDtoV1, NewsletterSubscribedMailDtoV1, NewsletterUnsubscribedMailDtoV1, NotificationMailDtoV1 } from './dtos';
1
+ import { AccountLoginTokenMailDtoV1, AccountPasswordResetMailDtoV1, EventCancelMailDtoV1, EventInviteMailDtoV1, IdeaStatusUpdateMailDtoV1, IdeaSubmittedMailDtoV1, LunchRouletteCancelMailDtoV1, LunchRouletteMatchedMailDtoV1, LunchRouletteSubmittedMailDtoV1, LunchRouletteUnmatchedMailDtoV1, NewsletterIssueMailDtoV1, NewsletterSubscribedMailDtoV1, NewsletterUnsubscribedMailDtoV1, NotificationMailDtoV1 } from './dtos';
2
2
  /**
3
3
  * Constant list of supported mail types.
4
4
  */
5
- declare const supportedMailTypes: readonly ["v1.auth.login-token", "v1.auth.password-reset", "v1.event.invite", "v1.event.cancel", "v1.idea.submitted", "v1.idea.status-update", "v1.lunch-roulette.submitted", "v1.lunch-roulette.cancel", "v1.lunch-roulette.matched", "v1.lunch-roulette.unmatched", "v1.newsletter.subscribed", "v1.newsletter.unsubscribed", "v1.newsletter.issue", "v1.notification.notification"];
5
+ declare const supportedMailTypes: readonly ["v1.account.login-token", "v1.account.password-reset", "v1.event.invite", "v1.event.cancel", "v1.idea.submitted", "v1.idea.status-update", "v1.lunch-roulette.submitted", "v1.lunch-roulette.cancel", "v1.lunch-roulette.matched", "v1.lunch-roulette.unmatched", "v1.newsletter.subscribed", "v1.newsletter.unsubscribed", "v1.newsletter.issue", "v1.notification.notification"];
6
6
  /**
7
7
  * Union type representing valid mail kinds.
8
8
  */
@@ -12,8 +12,8 @@ export type MailType = (typeof supportedMailTypes)[number];
12
12
  * This enables type-safe payload handling when creating passes.
13
13
  */
14
14
  export type MailTypeDtoMap = {
15
- 'v1.auth.login-token': AuthLoginTokenMailDtoV1;
16
- 'v1.auth.password-reset': AuthPasswordResetMailDtoV1;
15
+ 'v1.account.login-token': AccountLoginTokenMailDtoV1;
16
+ 'v1.account.password-reset': AccountPasswordResetMailDtoV1;
17
17
  'v1.event.invite': EventInviteMailDtoV1;
18
18
  'v1.event.cancel': EventCancelMailDtoV1;
19
19
  'v1.idea.submitted': IdeaSubmittedMailDtoV1;
@@ -6,8 +6,8 @@ exports.MailTypeEndpointMap = void 0;
6
6
  */
7
7
  // eslint-disable-next-line
8
8
  const supportedMailTypes = [
9
- 'v1.auth.login-token',
10
- 'v1.auth.password-reset',
9
+ 'v1.account.login-token',
10
+ 'v1.account.password-reset',
11
11
  'v1.event.invite',
12
12
  'v1.event.cancel',
13
13
  'v1.idea.submitted',
@@ -22,18 +22,18 @@ const supportedMailTypes = [
22
22
  'v1.notification.notification',
23
23
  ];
24
24
  exports.MailTypeEndpointMap = {
25
- 'v1.auth.login-token': 'v1/auth/login-token',
26
- 'v1.auth.password-reset': 'v1/auth/password-reset',
27
- 'v1.event.invite': 'v1/event/invite',
28
- 'v1.event.cancel': 'v1/event/cancel',
29
- 'v1.idea.submitted': 'v1/idea/submitted',
30
- 'v1.idea.status-update': 'v1/idea/status-update',
31
- 'v1.lunch-roulette.submitted': 'v1/lunch-roulette/submitted',
32
- 'v1.lunch-roulette.cancel': 'v1/lunch-roulette/cancel',
33
- 'v1.lunch-roulette.matched': 'v1/lunch-roulette/matched',
34
- 'v1.lunch-roulette.unmatched': 'v1/lunch-roulette/unmatched',
35
- 'v1.newsletter.subscribed': 'v1/newsletter/subscribed',
36
- 'v1.newsletter.unsubscribed': 'v1/newsletter/unsubscribed',
37
- 'v1.newsletter.issue': 'v1/newsletter/issue',
38
- 'v1.notification.notification': 'v1/notification/notification',
25
+ 'v1.account.login-token': 'v1/internal/account/login-token',
26
+ 'v1.account.password-reset': 'v1/internal/account/password-reset',
27
+ 'v1.event.invite': 'v1/internal/event/invite',
28
+ 'v1.event.cancel': 'v1/internal/event/cancel',
29
+ 'v1.idea.submitted': 'v1/internal/idea/submitted',
30
+ 'v1.idea.status-update': 'v1/internal/idea/status-update',
31
+ 'v1.lunch-roulette.submitted': 'v1/internal/lunch-roulette/submitted',
32
+ 'v1.lunch-roulette.cancel': 'v1/internal/lunch-roulette/cancel',
33
+ 'v1.lunch-roulette.matched': 'v1/internal/lunch-roulette/matched',
34
+ 'v1.lunch-roulette.unmatched': 'v1/internal/lunch-roulette/unmatched',
35
+ 'v1.newsletter.subscribed': 'v1/internal/newsletter/subscribed',
36
+ 'v1.newsletter.unsubscribed': 'v1/internal/newsletter/unsubscribed',
37
+ 'v1.newsletter.issue': 'v1/internal/newsletter/issue',
38
+ 'v1.notification.notification': 'v1/internal/notification/notification',
39
39
  };
@@ -1,7 +1,7 @@
1
1
  import { ConfigService } from '@nestjs/config';
2
2
  import { AuthenticationModuleOptions } from '../../../authentication';
3
3
  import { BaseHttpService } from '../../base-http.service';
4
- import { AuthLoginTokenMailDtoV1, AuthPasswordResetMailDtoV1, EventCancelMailDtoV1, EventInviteMailDtoV1, IdeaStatusUpdateMailDtoV1, IdeaSubmittedMailDtoV1, LunchRouletteCancelMailDtoV1, LunchRouletteMatchedMailDtoV1, LunchRouletteSubmittedMailDtoV1, LunchRouletteUnmatchedMailDtoV1, NewsletterIssueMailDtoV1, NewsletterSubscribedMailDtoV1, NewsletterUnsubscribedMailDtoV1, NotificationMailDtoV1 } from './dtos';
4
+ import { AccountLoginTokenMailDtoV1, AccountPasswordResetMailDtoV1, EventCancelMailDtoV1, EventInviteMailDtoV1, IdeaStatusUpdateMailDtoV1, IdeaSubmittedMailDtoV1, LunchRouletteCancelMailDtoV1, LunchRouletteMatchedMailDtoV1, LunchRouletteSubmittedMailDtoV1, LunchRouletteUnmatchedMailDtoV1, NewsletterIssueMailDtoV1, NewsletterSubscribedMailDtoV1, NewsletterUnsubscribedMailDtoV1, NotificationMailDtoV1 } from './dtos';
5
5
  /**
6
6
  * MailService
7
7
  *
@@ -27,14 +27,14 @@ export declare class MailService extends BaseHttpService {
27
27
  private sendMail;
28
28
  /**
29
29
  * Sends an email with a one-time login token.
30
- * @param {AuthLoginTokenMailDtoV1} payload - DTO containing recipient and token.
30
+ * @param {AccountLoginTokenMailDtoV1} payload - DTO containing recipient and token.
31
31
  */
32
- sendAuthLoginTokenMailV1(payload: AuthLoginTokenMailDtoV1): void;
32
+ sendAccountLoginTokenMailV1(payload: AccountLoginTokenMailDtoV1): void;
33
33
  /**
34
34
  * Sends a password reset email with a secure link.
35
- * @param {AuthPasswordResetMailDtoV1} payload - DTO containing recipient and reset URL.
35
+ * @param {AccountPasswordResetMailDtoV1} payload - DTO containing recipient and reset URL.
36
36
  */
37
- sendAuthPasswordResetMailV1(payload: AuthPasswordResetMailDtoV1): void;
37
+ sendAccountPasswordResetMailV1(payload: AccountPasswordResetMailDtoV1): void;
38
38
  /**
39
39
  * Sends an event invitation email.
40
40
  * @param {EventInviteMailDtoV1} payload - DTO containing event details and recipient.
@@ -56,21 +56,21 @@ let MailService = class MailService extends base_http_service_1.BaseHttpService
56
56
  });
57
57
  }
58
58
  // ─────────────────────────────────────────────
59
- // Authentication Emails
59
+ // Account Emails
60
60
  // ─────────────────────────────────────────────
61
61
  /**
62
62
  * Sends an email with a one-time login token.
63
- * @param {AuthLoginTokenMailDtoV1} payload - DTO containing recipient and token.
63
+ * @param {AccountLoginTokenMailDtoV1} payload - DTO containing recipient and token.
64
64
  */
65
- sendAuthLoginTokenMailV1(payload) {
66
- this.sendMail('v1.auth.login-token', payload);
65
+ sendAccountLoginTokenMailV1(payload) {
66
+ this.sendMail('v1.account.login-token', payload);
67
67
  }
68
68
  /**
69
69
  * Sends a password reset email with a secure link.
70
- * @param {AuthPasswordResetMailDtoV1} payload - DTO containing recipient and reset URL.
70
+ * @param {AccountPasswordResetMailDtoV1} payload - DTO containing recipient and reset URL.
71
71
  */
72
- sendAuthPasswordResetMailV1(payload) {
73
- this.sendMail('v1.auth.password-reset', payload);
72
+ sendAccountPasswordResetMailV1(payload) {
73
+ this.sendMail('v1.account.password-reset', payload);
74
74
  }
75
75
  // ─────────────────────────────────────────────
76
76
  // Event Emails
@@ -81,6 +81,6 @@ export declare class NotificationsService extends BaseHttpService {
81
81
  *
82
82
  * @param resourceId Unique identifier of the resource.
83
83
  */
84
- deleteNotifications(resourceId: string): void;
84
+ deleteNotificationsV1(resourceId: string): void;
85
85
  }
86
86
  export {};
@@ -130,7 +130,7 @@ let NotificationsService = NotificationsService_1 = class NotificationsService e
130
130
  *
131
131
  * @param resourceId Unique identifier of the resource.
132
132
  */
133
- deleteNotifications(resourceId) {
133
+ deleteNotificationsV1(resourceId) {
134
134
  if (!this.options.resource) {
135
135
  this.logger.error('Cannot delete notifications: Resource type not provided.');
136
136
  return;
@@ -8,6 +8,9 @@ const swagger_1 = require("@nestjs/swagger");
8
8
  const class_validator_1 = require("class-validator");
9
9
  const itlab_functions_1 = require("itlab-functions");
10
10
  const exceptions_1 = require("../../exceptions");
11
+ function isValidHubId(value) {
12
+ return (0, class_validator_1.isString)(value) && (0, itlab_functions_1.isHubId)(value.toLowerCase());
13
+ }
11
14
  /**
12
15
  * Pipe that validates and transforms a route parameter into a valid HubId string.
13
16
  * Throws a `BadParameterException` if the input does not match the expected format.
@@ -22,8 +25,8 @@ class ParseHubIdPipe {
22
25
  * @throws {BadParameterException} - If validation fails.
23
26
  */
24
27
  transform(inputValue) {
25
- if ((0, itlab_functions_1.isHubId)(inputValue))
26
- return String(inputValue);
28
+ if (isValidHubId(inputValue))
29
+ return inputValue.toLowerCase();
27
30
  throw new exceptions_1.BadParameterException(this.parameterName);
28
31
  }
29
32
  }
@@ -59,7 +62,7 @@ function IsHubId(options) {
59
62
  return (0, class_validator_1.ValidateBy)({
60
63
  name: 'isHubId',
61
64
  validator: {
62
- validate: (input) => (0, itlab_functions_1.isHubId)(input),
65
+ validate: (input) => isValidHubId(input),
63
66
  defaultMessage: (0, class_validator_1.buildMessage)((each) => `${each}$property must be a valid HubId`, options),
64
67
  },
65
68
  }, options);
@@ -7,8 +7,8 @@ import { User } from '../models';
7
7
  * - `likedBy`: optional populated list of User objects.
8
8
  */
9
9
  export type IsLikeable = {
10
- _likedBy: string[];
11
- likes: number;
10
+ _likedBy?: string[];
11
+ likes?: number;
12
12
  likedBy?: User[];
13
13
  addLike(accountId: string): Promise<number>;
14
14
  removeLike(accountId: string): Promise<number>;
@@ -7,8 +7,8 @@ import { User } from '../models';
7
7
  * - `viewedBy`: optional populated list of User objects.
8
8
  */
9
9
  export type IsViewable = {
10
- _viewedBy: string[];
11
- views: number;
10
+ _viewedBy?: string[];
11
+ views?: number;
12
12
  viewedBy?: User[];
13
13
  addView(accountId: string): Promise<number>;
14
14
  removeView(accountId: string): Promise<number>;
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "name": "Timo Scheuermann",
5
5
  "email": "timo.scheuermann@sv-informatik.de"
6
6
  },
7
- "version": "2.16.9",
7
+ "version": "2.16.11",
8
8
  "type": "commonjs",
9
9
  "files": [
10
10
  "dist"