itlab-internal-services 2.16.12 → 2.16.13

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 (126) hide show
  1. package/dist/classes/document/content-document.class.d.ts +2 -2
  2. package/dist/classes/fetch-options/content-options.class.d.ts +2 -2
  3. package/dist/hub-resource.enum.d.ts +0 -23
  4. package/dist/hub-resource.enum.js +1 -25
  5. package/dist/index.d.ts +0 -6
  6. package/dist/index.js +0 -10
  7. package/dist/modules/comments/comments.controller.d.ts +3 -3
  8. package/dist/modules/comments/comments.controller.js +1 -1
  9. package/dist/modules/comments/comments.service.d.ts +3 -3
  10. package/dist/modules/comments/comments.service.js +1 -1
  11. package/dist/modules/services/providers/books/books.service.d.ts +5 -5
  12. package/dist/modules/services/providers/books/books.service.js +2 -2
  13. package/dist/modules/services/providers/changelog/changelog.service.d.ts +1 -14
  14. package/dist/modules/services/providers/conflicts/conflicts.service.d.ts +5 -15
  15. package/dist/modules/services/providers/conflicts/conflicts.service.js +2 -2
  16. package/dist/modules/services/providers/content/content-return-types.d.ts +5 -5
  17. package/dist/modules/services/providers/content/content.service.d.ts +7 -6
  18. package/dist/modules/services/providers/demo-hive/demo-hive.service.d.ts +5 -5
  19. package/dist/modules/services/providers/demo-hive/demo-hive.service.js +2 -2
  20. package/dist/modules/services/providers/events/events.service.d.ts +5 -5
  21. package/dist/modules/services/providers/events/events.service.js +2 -2
  22. package/dist/modules/services/providers/files/files.service.d.ts +9 -30
  23. package/dist/modules/services/providers/files/files.service.js +4 -4
  24. package/dist/modules/services/providers/mail/dtos/newsletter-issue-mail.dto.v1.d.ts +2 -2
  25. package/dist/modules/services/providers/newsletter/newsletter.service.d.ts +5 -5
  26. package/dist/modules/services/providers/newsletter/newsletter.service.js +2 -2
  27. package/dist/modules/services/providers/newsroom/newsroom.service.d.ts +5 -5
  28. package/dist/modules/services/providers/newsroom/newsroom.service.js +2 -2
  29. package/dist/modules/services/providers/notifications/notifications.service.d.ts +5 -18
  30. package/dist/modules/services/providers/notifications/notifications.service.js +5 -3
  31. package/dist/modules/services/providers/podcasts/podcasts.service.d.ts +5 -5
  32. package/dist/modules/services/providers/podcasts/podcasts.service.js +2 -2
  33. package/dist/modules/services/providers/quick-links/quick-links.service.d.ts +5 -17
  34. package/dist/modules/services/providers/quick-links/quick-links.service.js +2 -2
  35. package/dist/pipes/restricted-fields.pipe.js +3 -1
  36. package/package.json +23 -23
  37. package/dist/classes/document-updater.class.d.ts +0 -40
  38. package/dist/classes/document-updater.class.js +0 -58
  39. package/dist/factories/index.d.ts +0 -1
  40. package/dist/factories/index.js +0 -5
  41. package/dist/factories/virtuals.factory.d.ts +0 -80
  42. package/dist/factories/virtuals.factory.js +0 -172
  43. package/dist/functions/create-duplicate-checker.function.d.ts +0 -29
  44. package/dist/functions/create-duplicate-checker.function.js +0 -52
  45. package/dist/likeable.interface.d.ts +0 -42
  46. package/dist/likeable.interface.js +0 -48
  47. package/dist/modules/_old/comment/comment.controller.d.ts +0 -35
  48. package/dist/modules/_old/comment/comment.controller.js +0 -86
  49. package/dist/modules/_old/comment/comment.model.d.ts +0 -29
  50. package/dist/modules/_old/comment/comment.model.js +0 -43
  51. package/dist/modules/_old/comment/comment.module-definition.d.ts +0 -45
  52. package/dist/modules/_old/comment/comment.module-definition.js +0 -8
  53. package/dist/modules/_old/comment/comment.module.d.ts +0 -22
  54. package/dist/modules/_old/comment/comment.module.js +0 -71
  55. package/dist/modules/_old/comment/comment.service.d.ts +0 -54
  56. package/dist/modules/_old/comment/comment.service.js +0 -133
  57. package/dist/modules/_old/comment/index.d.ts +0 -3
  58. package/dist/modules/_old/comment/index.js +0 -9
  59. package/dist/modules/_old/content/content.module-definition.d.ts +0 -5
  60. package/dist/modules/_old/content/content.module-definition.js +0 -8
  61. package/dist/modules/_old/content/content.module.d.ts +0 -31
  62. package/dist/modules/_old/content/content.module.js +0 -60
  63. package/dist/modules/_old/content/content.service.d.ts +0 -50
  64. package/dist/modules/_old/content/content.service.js +0 -145
  65. package/dist/modules/_old/content/index.d.ts +0 -2
  66. package/dist/modules/_old/content/index.js +0 -7
  67. package/dist/modules/_old/database/database-module-options.interface.d.ts +0 -41
  68. package/dist/modules/_old/database/database-module-options.interface.js +0 -2
  69. package/dist/modules/_old/database/database.liveness-controller.d.ts +0 -27
  70. package/dist/modules/_old/database/database.liveness-controller.js +0 -80
  71. package/dist/modules/_old/database/database.module.d.ts +0 -41
  72. package/dist/modules/_old/database/database.module.js +0 -97
  73. package/dist/modules/_old/database/index.d.ts +0 -6
  74. package/dist/modules/_old/database/index.js +0 -13
  75. package/dist/modules/_old/database/lock-service/lock.schema.d.ts +0 -38
  76. package/dist/modules/_old/database/lock-service/lock.schema.js +0 -51
  77. package/dist/modules/_old/database/lock-service/lock.service.d.ts +0 -53
  78. package/dist/modules/_old/database/lock-service/lock.service.js +0 -103
  79. package/dist/modules/_old/database/model-service/dbs/hub-account.db.d.ts +0 -28
  80. package/dist/modules/_old/database/model-service/dbs/hub-account.db.js +0 -44
  81. package/dist/modules/_old/database/model-service/dbs/hub-books.db.d.ts +0 -23
  82. package/dist/modules/_old/database/model-service/dbs/hub-books.db.js +0 -45
  83. package/dist/modules/_old/database/model-service/dbs/hub-comments.db.d.ts +0 -29
  84. package/dist/modules/_old/database/model-service/dbs/hub-comments.db.js +0 -68
  85. package/dist/modules/_old/database/model-service/dbs/hub-content.db.d.ts +0 -24
  86. package/dist/modules/_old/database/model-service/dbs/hub-content.db.js +0 -49
  87. package/dist/modules/_old/database/model-service/dbs/hub-demo-hive.db.d.ts +0 -23
  88. package/dist/modules/_old/database/model-service/dbs/hub-demo-hive.db.js +0 -45
  89. package/dist/modules/_old/database/model-service/dbs/hub-events.db.d.ts +0 -24
  90. package/dist/modules/_old/database/model-service/dbs/hub-events.db.js +0 -49
  91. package/dist/modules/_old/database/model-service/dbs/hub-hackschool.db.d.ts +0 -60
  92. package/dist/modules/_old/database/model-service/dbs/hub-hackschool.db.js +0 -106
  93. package/dist/modules/_old/database/model-service/dbs/hub-newsroom.db.d.ts +0 -25
  94. package/dist/modules/_old/database/model-service/dbs/hub-newsroom.db.js +0 -53
  95. package/dist/modules/_old/database/model-service/dbs/hub-podcasts.db.d.ts +0 -23
  96. package/dist/modules/_old/database/model-service/dbs/hub-podcasts.db.js +0 -45
  97. package/dist/modules/_old/database/model-service/dbs/hub-team.db.d.ts +0 -22
  98. package/dist/modules/_old/database/model-service/dbs/hub-team.db.js +0 -41
  99. package/dist/modules/_old/database/model-service/dbs/hub-tech-radar.db.d.ts +0 -42
  100. package/dist/modules/_old/database/model-service/dbs/hub-tech-radar.db.js +0 -81
  101. package/dist/modules/_old/database/model-service/model.service.d.ts +0 -8465
  102. package/dist/modules/_old/database/model-service/model.service.js +0 -136
  103. package/dist/modules/_old/database/populate-service/populate.service.d.ts +0 -73
  104. package/dist/modules/_old/database/populate-service/populate.service.js +0 -163
  105. package/dist/modules/_old/database/service-mapper-service/service-mapper.service.d.ts +0 -32
  106. package/dist/modules/_old/database/service-mapper-service/service-mapper.service.js +0 -73
  107. package/dist/modules/_old/fetch/fetch.module.d.ts +0 -31
  108. package/dist/modules/_old/fetch/fetch.module.js +0 -60
  109. package/dist/modules/_old/fetch/fetch.service.d.ts +0 -153
  110. package/dist/modules/_old/fetch/fetch.service.js +0 -274
  111. package/dist/modules/_old/fetch/index.d.ts +0 -2
  112. package/dist/modules/_old/fetch/index.js +0 -7
  113. package/dist/modules/_old/index.d.ts +0 -5
  114. package/dist/modules/_old/index.js +0 -21
  115. package/dist/modules/_old/like/index.d.ts +0 -1
  116. package/dist/modules/_old/like/index.js +0 -5
  117. package/dist/modules/_old/like/like.controller.d.ts +0 -41
  118. package/dist/modules/_old/like/like.controller.js +0 -125
  119. package/dist/modules/_old/like/like.module-definition.d.ts +0 -20
  120. package/dist/modules/_old/like/like.module-definition.js +0 -8
  121. package/dist/modules/_old/like/like.module.d.ts +0 -21
  122. package/dist/modules/_old/like/like.module.js +0 -67
  123. package/dist/modules/_old/like/like.service.d.ts +0 -61
  124. package/dist/modules/_old/like/like.service.js +0 -103
  125. package/dist/viewable.interface.d.ts +0 -42
  126. package/dist/viewable.interface.js +0 -48
@@ -1,153 +0,0 @@
1
- import { ConfigService } from '@nestjs/config';
2
- import { LabBook, LabDemo, LabEvent, LabHackschoolCourse, LabHackschoolDoc, LabHackschoolThread, LabNews, LabNewsletter, LabPodcast, LabTeamMember, LabTechRadarBlip, LabTechRadarEdition } from 'itlab-functions';
3
- import { FetchableHubResource } from '../../../hub-resource.enum';
4
- import { Account } from '../../../models';
5
- import { AuthenticationModuleOptions } from '../../authentication';
6
- /**
7
- * Maps each fetchable resource type to its corresponding interface, and endpoint.
8
- * This enables type-safe payload handling when fetching resources.
9
- */
10
- type ResourceInterfaceMap = {
11
- [FetchableHubResource.NEWSROOM_NEWS]: LabNews;
12
- [FetchableHubResource.EVENTS_EVENT]: LabEvent;
13
- [FetchableHubResource.DEMO_HIVE_DEMO]: LabDemo;
14
- [FetchableHubResource.TECH_RADAR_BLIP]: LabTechRadarBlip;
15
- [FetchableHubResource.TECH_RADAR_EDITION]: LabTechRadarEdition;
16
- [FetchableHubResource.PODCASTS_PODCAST]: LabPodcast;
17
- [FetchableHubResource.BOOKS_BOOK]: LabBook;
18
- [FetchableHubResource.HACKSCHOOL_COURSE]: LabHackschoolCourse;
19
- [FetchableHubResource.HACKSCHOOL_THREAD]: LabHackschoolThread;
20
- [FetchableHubResource.HACKSCHOOL_DOC]: LabHackschoolDoc;
21
- [FetchableHubResource.TEAM_MEMBER]: LabTeamMember;
22
- [FetchableHubResource.NEWSLETTER_ISSUE]: LabNewsletter;
23
- [FetchableHubResource.HUB_USER]: Account;
24
- };
25
- /**
26
- * FetchService
27
- *
28
- * Provides a unified API for retrieving internal hub resources using a configured
29
- * Axios instance. Responses are strongly typed and logged for observability.
30
- */
31
- export declare class OldFetchService {
32
- private readonly authOptions;
33
- private readonly configService;
34
- private readonly logger;
35
- private readonly axiosInstance;
36
- private readonly isProduction;
37
- /**
38
- * Initializes the FetchService with appropriate API client and settings.
39
- *
40
- * @param {AuthenticationModuleOptions} authOptions - Contains Kubernetes service account token
41
- * @param {ConfigService} configService - Configuration service for environment checks
42
- */
43
- constructor(authOptions: AuthenticationModuleOptions, configService: ConfigService);
44
- /**
45
- * Generic resource fetcher based on resource type and ID.
46
- *
47
- * @template Resource
48
- * @param {Resource} resource - Resource identifier enum.
49
- * @param {string} resourceId - Unique ID for the resource.
50
- * @returns {Promise<ResourceInterfaceMap[Resource] | undefined>} - Fetched data or undefined on failure.
51
- */
52
- fetch<Resource extends FetchableHubResource>(resource: Resource, resourceId: string): Promise<ResourceInterfaceMap[Resource]>;
53
- /**
54
- * Checks if a given resource ID exists on the server.
55
- *
56
- * @param {string} resource - The resource type (enum key).
57
- * @param {string} resourceId - The ID to check for existence.
58
- * @returns {Promise<boolean>} - Whether the resource exists.
59
- */
60
- exists(resource: string, resourceId: string): Promise<boolean>;
61
- /**
62
- * Fetches a news item by ID.
63
- *
64
- * @param {string} newsId - The ID of the news resource to fetch.
65
- * @returns {Promise<LabNews | undefined>} - The fetched news item or undefined if not found.
66
- */
67
- fetchNews(newsId: string): Promise<LabNews | undefined>;
68
- /**
69
- * Fetches an event by ID.
70
- *
71
- * @param {string} eventId - The ID of the event resource to fetch.
72
- * @returns {Promise<LabEvent | undefined>} - The fetched event or undefined if not found.
73
- */
74
- fetchEvent(eventId: string): Promise<LabEvent | undefined>;
75
- /**
76
- * Fetches a demo by ID.
77
- *
78
- * @param {string} demoId - The ID of the demo resource to fetch.
79
- * @returns {Promise<LabDemo | undefined>} - The fetched demo or undefined if not found.
80
- */
81
- fetchDemo(demoId: string): Promise<LabDemo | undefined>;
82
- /**
83
- * Fetches a technology radar blip by ID.
84
- *
85
- * @param {string} blipId - The ID of the blip to fetch.
86
- * @returns {Promise<LabTechRadarBlip | undefined>} - The fetched blip or undefined if not found.
87
- */
88
- fetchTechRadarBlip(blipId: string): Promise<LabTechRadarBlip | undefined>;
89
- /**
90
- * Fetches a technology radar edition by ID.
91
- *
92
- * @param {string} editionId - The ID of the edition to fetch.
93
- * @returns {Promise<LabTechRadarEdition | undefined>} - The fetched edition or undefined if not found.
94
- */
95
- fetchTechRadarEdition(editionId: string): Promise<LabTechRadarEdition | undefined>;
96
- /**
97
- * Fetches a podcast by ID.
98
- *
99
- * @param {string} podcastId - The ID of the podcast resource to fetch.
100
- * @returns {Promise<LabPodcast | undefined>} - The fetched podcast or undefined if not found.
101
- */
102
- fetchPodcast(podcastId: string): Promise<LabPodcast | undefined>;
103
- /**
104
- * Fetches a book by ID.
105
- *
106
- * @param {string} bookId - The ID of the book resource to fetch.
107
- * @returns {Promise<LabBook | undefined>} - The fetched book or undefined if not found.
108
- */
109
- fetchBook(bookId: string): Promise<LabBook | undefined>;
110
- /**
111
- * Fetches a Hackschool course by ID.
112
- *
113
- * @param {string} courseId - The ID of the course to fetch.
114
- * @returns {Promise<LabHackschoolCourse | undefined>} - The fetched course or undefined if not found.
115
- */
116
- fetchHackschoolCourse(courseId: string): Promise<LabHackschoolCourse | undefined>;
117
- /**
118
- * Fetches a Hackschool thread by ID.
119
- *
120
- * @param {string} threadId - The ID of the thread to fetch.
121
- * @returns {Promise<LabHackschoolThread | undefined>} - The fetched thread or undefined if not found.
122
- */
123
- fetchHackschoolThread(threadId: string): Promise<LabHackschoolThread | undefined>;
124
- /**
125
- * Fetches a Hackschool document by ID.
126
- *
127
- * @param {string} docId - The ID of the document to fetch.
128
- * @returns {Promise<LabHackschoolDoc | undefined>} - The fetched document or undefined if not found.
129
- */
130
- fetchHackschoolDoc(docId: string): Promise<LabHackschoolDoc | undefined>;
131
- /**
132
- * Fetches a team member by ID.
133
- *
134
- * @param {string} memberId - The ID of the member to fetch.
135
- * @returns {Promise<LabTeamMember | undefined>} - The fetched member or undefined if not found.
136
- */
137
- fetchTeamMember(memberId: string): Promise<LabTeamMember | undefined>;
138
- /**
139
- * Fetches a newsletter issue by ID.
140
- *
141
- * @param {string} newsletterId - The ID of the newsletter issue to fetch.
142
- * @returns {Promise<LabNewsletter | undefined>} - The fetched newsletter or undefined if not found.
143
- */
144
- fetchNewsletter(newsletterId: string): Promise<LabNewsletter | undefined>;
145
- /**
146
- * Fetches a user account by ID.
147
- *
148
- * @param {string} userId - The ID of the user account to fetch.
149
- * @returns {Promise<Account | undefined>} - The fetched user or undefined if not found.
150
- */
151
- fetchUser(userId: string): Promise<Account | undefined>;
152
- }
153
- export {};
@@ -1,274 +0,0 @@
1
- "use strict";
2
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
- return c > 3 && r && Object.defineProperty(target, key, r), r;
7
- };
8
- var __metadata = (this && this.__metadata) || function (k, v) {
9
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
- };
11
- var __param = (this && this.__param) || function (paramIndex, decorator) {
12
- return function (target, key) { decorator(target, key, paramIndex); }
13
- };
14
- var OldFetchService_1;
15
- Object.defineProperty(exports, "__esModule", { value: true });
16
- exports.OldFetchService = void 0;
17
- const common_1 = require("@nestjs/common");
18
- const config_1 = require("@nestjs/config");
19
- const create_internal_axios_client_function_1 = require("../../../functions/create-internal-axios-client.function");
20
- const hub_resource_enum_1 = require("../../../hub-resource.enum");
21
- const authentication_1 = require("../../authentication");
22
- /**
23
- * A centralized routing table mapping resources to their respective
24
- * internal backend endpoints (production and non-production).
25
- */
26
- const resourceEndpoints = {
27
- [hub_resource_enum_1.FetchableHubResource.NEWSROOM_NEWS]: [
28
- 'http://organisation-hub-newsroom-backend.organisation-hub-services.svc.cluster.local:3000/internal/news/%id%',
29
- 'newsroom/internal/news/%id%',
30
- ],
31
- [hub_resource_enum_1.FetchableHubResource.EVENTS_EVENT]: [
32
- 'http://organisation-hub-events-backend.organisation-hub-services.svc.cluster.local:3000/internal/event/%id%',
33
- 'events/internal/event/%id%',
34
- ],
35
- [hub_resource_enum_1.FetchableHubResource.DEMO_HIVE_DEMO]: [
36
- 'http://organisation-hub-demo-hive-backend.organisation-hub-services.svc.cluster.local:3000/internal/demo/%id%',
37
- 'demo-hive/internal/demo/%id%',
38
- ],
39
- [hub_resource_enum_1.FetchableHubResource.TECH_RADAR_BLIP]: [
40
- 'http://organisation-hub-tech-radar-backend.organisation-hub-services.svc.cluster.local:3000/internal/blip/%id%',
41
- 'tech-radar/internal/blip/%id%',
42
- ],
43
- [hub_resource_enum_1.FetchableHubResource.TECH_RADAR_EDITION]: [
44
- 'http://organisation-hub-tech-radar-backend.organisation-hub-services.svc.cluster.local:3000/internal/edition/%id%',
45
- 'tech-radar/internal/edition/%id%',
46
- ],
47
- [hub_resource_enum_1.FetchableHubResource.PODCASTS_PODCAST]: [
48
- 'http://organisation-hub-podcasts-backend.organisation-hub-services.svc.cluster.local:3000/internal/podcast/%id%',
49
- 'podcasts/internal/podcast/%id%',
50
- ],
51
- [hub_resource_enum_1.FetchableHubResource.BOOKS_BOOK]: [
52
- 'http://organisation-hub-books-backend.organisation-hub-services.svc.cluster.local:3000/internal/book/%id%',
53
- 'books/internal/book/%id%',
54
- ],
55
- [hub_resource_enum_1.FetchableHubResource.HACKSCHOOL_COURSE]: [
56
- 'http://organisation-hub-hackschool-backend.organisation-hub-services.svc.cluster.local:3000/internal/course/%id%',
57
- 'hackschool/internal/course/%id%',
58
- ],
59
- [hub_resource_enum_1.FetchableHubResource.HACKSCHOOL_THREAD]: [
60
- 'http://organisation-hub-hackschool-backend.organisation-hub-services.svc.cluster.local:3000/internal/thread/%id%',
61
- 'hackschool/internal/thread/%id%',
62
- ],
63
- [hub_resource_enum_1.FetchableHubResource.HACKSCHOOL_DOC]: [
64
- 'http://organisation-hub-hackschool-backend.organisation-hub-services.svc.cluster.local:3000/internal/doc/%id%',
65
- 'hackschool/internal/doc/%id%',
66
- ],
67
- [hub_resource_enum_1.FetchableHubResource.TEAM_MEMBER]: [
68
- 'http://organisation-hub-team-backend.organisation-hub-services.svc.cluster.local:3000/internal/member/%id%',
69
- 'team/internal/member/%id%',
70
- ],
71
- [hub_resource_enum_1.FetchableHubResource.NEWSLETTER_ISSUE]: [
72
- 'http://organisation-hub-newsletter-backend.organisation-hub-services.svc.cluster.local:3000/internal/issue/%id%',
73
- 'newsletter/internal/issue/%id%',
74
- ],
75
- [hub_resource_enum_1.FetchableHubResource.HUB_USER]: [
76
- 'http://organisation-hub-accounts-service.organisation-hub-services.svc.cluster.local:3000/internal/account/%id%',
77
- 'accounts/internal/account/%id%',
78
- ],
79
- };
80
- /**
81
- * FetchService
82
- *
83
- * Provides a unified API for retrieving internal hub resources using a configured
84
- * Axios instance. Responses are strongly typed and logged for observability.
85
- */
86
- let OldFetchService = OldFetchService_1 = class OldFetchService {
87
- /**
88
- * Initializes the FetchService with appropriate API client and settings.
89
- *
90
- * @param {AuthenticationModuleOptions} authOptions - Contains Kubernetes service account token
91
- * @param {ConfigService} configService - Configuration service for environment checks
92
- */
93
- constructor(authOptions, configService) {
94
- this.authOptions = authOptions;
95
- this.configService = configService;
96
- this.logger = new common_1.Logger(OldFetchService_1.name);
97
- this.isProduction = this.configService.get('NODE_ENV') === 'production';
98
- // Initialize axios instance with k8s token.
99
- this.axiosInstance = (0, create_internal_axios_client_function_1.createInternalAxiosClient)({
100
- baseUrl: 'https://services.svi-itlab.com/',
101
- k8sToken: this.authOptions.k8sToken,
102
- });
103
- }
104
- /**
105
- * Generic resource fetcher based on resource type and ID.
106
- *
107
- * @template Resource
108
- * @param {Resource} resource - Resource identifier enum.
109
- * @param {string} resourceId - Unique ID for the resource.
110
- * @returns {Promise<ResourceInterfaceMap[Resource] | undefined>} - Fetched data or undefined on failure.
111
- */
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
- }
125
- }
126
- /**
127
- * Checks if a given resource ID exists on the server.
128
- *
129
- * @param {string} resource - The resource type (enum key).
130
- * @param {string} resourceId - The ID to check for existence.
131
- * @returns {Promise<boolean>} - Whether the resource exists.
132
- */
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
- }
150
- }
151
- /**
152
- * Fetches a news item by ID.
153
- *
154
- * @param {string} newsId - The ID of the news resource to fetch.
155
- * @returns {Promise<LabNews | undefined>} - The fetched news item or undefined if not found.
156
- */
157
- async fetchNews(newsId) {
158
- return this.fetch(hub_resource_enum_1.FetchableHubResource.NEWSROOM_NEWS, newsId);
159
- }
160
- /**
161
- * Fetches an event by ID.
162
- *
163
- * @param {string} eventId - The ID of the event resource to fetch.
164
- * @returns {Promise<LabEvent | undefined>} - The fetched event or undefined if not found.
165
- */
166
- async fetchEvent(eventId) {
167
- return this.fetch(hub_resource_enum_1.FetchableHubResource.EVENTS_EVENT, eventId);
168
- }
169
- /**
170
- * Fetches a demo by ID.
171
- *
172
- * @param {string} demoId - The ID of the demo resource to fetch.
173
- * @returns {Promise<LabDemo | undefined>} - The fetched demo or undefined if not found.
174
- */
175
- async fetchDemo(demoId) {
176
- return this.fetch(hub_resource_enum_1.FetchableHubResource.DEMO_HIVE_DEMO, demoId);
177
- }
178
- /**
179
- * Fetches a technology radar blip by ID.
180
- *
181
- * @param {string} blipId - The ID of the blip to fetch.
182
- * @returns {Promise<LabTechRadarBlip | undefined>} - The fetched blip or undefined if not found.
183
- */
184
- async fetchTechRadarBlip(blipId) {
185
- return this.fetch(hub_resource_enum_1.FetchableHubResource.TECH_RADAR_BLIP, blipId);
186
- }
187
- /**
188
- * Fetches a technology radar edition by ID.
189
- *
190
- * @param {string} editionId - The ID of the edition to fetch.
191
- * @returns {Promise<LabTechRadarEdition | undefined>} - The fetched edition or undefined if not found.
192
- */
193
- async fetchTechRadarEdition(editionId) {
194
- return this.fetch(hub_resource_enum_1.FetchableHubResource.TECH_RADAR_EDITION, editionId);
195
- }
196
- /**
197
- * Fetches a podcast by ID.
198
- *
199
- * @param {string} podcastId - The ID of the podcast resource to fetch.
200
- * @returns {Promise<LabPodcast | undefined>} - The fetched podcast or undefined if not found.
201
- */
202
- async fetchPodcast(podcastId) {
203
- return this.fetch(hub_resource_enum_1.FetchableHubResource.PODCASTS_PODCAST, podcastId);
204
- }
205
- /**
206
- * Fetches a book by ID.
207
- *
208
- * @param {string} bookId - The ID of the book resource to fetch.
209
- * @returns {Promise<LabBook | undefined>} - The fetched book or undefined if not found.
210
- */
211
- async fetchBook(bookId) {
212
- return this.fetch(hub_resource_enum_1.FetchableHubResource.BOOKS_BOOK, bookId);
213
- }
214
- /**
215
- * Fetches a Hackschool course by ID.
216
- *
217
- * @param {string} courseId - The ID of the course to fetch.
218
- * @returns {Promise<LabHackschoolCourse | undefined>} - The fetched course or undefined if not found.
219
- */
220
- async fetchHackschoolCourse(courseId) {
221
- return this.fetch(hub_resource_enum_1.FetchableHubResource.HACKSCHOOL_COURSE, courseId);
222
- }
223
- /**
224
- * Fetches a Hackschool thread by ID.
225
- *
226
- * @param {string} threadId - The ID of the thread to fetch.
227
- * @returns {Promise<LabHackschoolThread | undefined>} - The fetched thread or undefined if not found.
228
- */
229
- async fetchHackschoolThread(threadId) {
230
- return this.fetch(hub_resource_enum_1.FetchableHubResource.HACKSCHOOL_THREAD, threadId);
231
- }
232
- /**
233
- * Fetches a Hackschool document by ID.
234
- *
235
- * @param {string} docId - The ID of the document to fetch.
236
- * @returns {Promise<LabHackschoolDoc | undefined>} - The fetched document or undefined if not found.
237
- */
238
- async fetchHackschoolDoc(docId) {
239
- return this.fetch(hub_resource_enum_1.FetchableHubResource.HACKSCHOOL_DOC, docId);
240
- }
241
- /**
242
- * Fetches a team member by ID.
243
- *
244
- * @param {string} memberId - The ID of the member to fetch.
245
- * @returns {Promise<LabTeamMember | undefined>} - The fetched member or undefined if not found.
246
- */
247
- async fetchTeamMember(memberId) {
248
- return this.fetch(hub_resource_enum_1.FetchableHubResource.TEAM_MEMBER, memberId);
249
- }
250
- /**
251
- * Fetches a newsletter issue by ID.
252
- *
253
- * @param {string} newsletterId - The ID of the newsletter issue to fetch.
254
- * @returns {Promise<LabNewsletter | undefined>} - The fetched newsletter or undefined if not found.
255
- */
256
- async fetchNewsletter(newsletterId) {
257
- return this.fetch(hub_resource_enum_1.FetchableHubResource.NEWSLETTER_ISSUE, newsletterId);
258
- }
259
- /**
260
- * Fetches a user account by ID.
261
- *
262
- * @param {string} userId - The ID of the user account to fetch.
263
- * @returns {Promise<Account | undefined>} - The fetched user or undefined if not found.
264
- */
265
- async fetchUser(userId) {
266
- return this.fetch(hub_resource_enum_1.FetchableHubResource.HUB_USER, userId);
267
- }
268
- };
269
- exports.OldFetchService = OldFetchService;
270
- exports.OldFetchService = OldFetchService = OldFetchService_1 = __decorate([
271
- (0, common_1.Injectable)(),
272
- __param(0, (0, authentication_1.InjectAuthenticationOptions)()),
273
- __metadata("design:paramtypes", [Object, config_1.ConfigService])
274
- ], OldFetchService);
@@ -1,2 +0,0 @@
1
- export { OldFetchModule } from './fetch.module';
2
- export { OldFetchService } from './fetch.service';
@@ -1,7 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.OldFetchService = exports.OldFetchModule = void 0;
4
- var fetch_module_1 = require("./fetch.module");
5
- Object.defineProperty(exports, "OldFetchModule", { enumerable: true, get: function () { return fetch_module_1.OldFetchModule; } });
6
- var fetch_service_1 = require("./fetch.service");
7
- Object.defineProperty(exports, "OldFetchService", { enumerable: true, get: function () { return fetch_service_1.OldFetchService; } });
@@ -1,5 +0,0 @@
1
- export * from './comment';
2
- export * from './content';
3
- export * from './database';
4
- export * from './fetch';
5
- export * from './like';
@@ -1,21 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./comment"), exports);
18
- __exportStar(require("./content"), exports);
19
- __exportStar(require("./database"), exports);
20
- __exportStar(require("./fetch"), exports);
21
- __exportStar(require("./like"), exports);
@@ -1 +0,0 @@
1
- export { LikeModule as OldLikeModule } from './like.module';
@@ -1,5 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.OldLikeModule = void 0;
4
- var like_module_1 = require("./like.module");
5
- Object.defineProperty(exports, "OldLikeModule", { enumerable: true, get: function () { return like_module_1.LikeModule; } });
@@ -1,41 +0,0 @@
1
- import { LikeService } from './like.service';
2
- /**
3
- * LikeController handles all HTTP requests related to "like" interactions on resources.
4
- *
5
- * It provides endpoints for users to add a like, remove a like, and check if they have liked a resource.
6
- * Authentication is enforced via JWT to ensure only authorized users can interact with these endpoints.
7
- * Resource IDs are validated as MongoDB ObjectIds to maintain data integrity.
8
- */
9
- export declare class LikeController {
10
- private readonly likeService;
11
- /**
12
- * Initializes LikeController with LikeService dependency.
13
- *
14
- * @param {LikeService} likeService - Service handling like operations.
15
- */
16
- constructor(likeService: LikeService);
17
- /**
18
- * Adds the authenticated user's like to the specified resource.
19
- *
20
- * @param {string} resourceId - MongoDB ObjectId of the resource to be liked.
21
- * @param {string} accountId - The ID of the authenticated account performing the like.
22
- * @returns {Promise<number>} The updated total number of likes after addition.
23
- */
24
- addLikeToResource(resourceId: string, accountId: string): Promise<number>;
25
- /**
26
- * Removes the authenticated user's like from the specified resource.
27
- *
28
- * @param {string} resourceId - MongoDB ObjectId of the resource to unlike.
29
- * @param {string} accountId - The ID of the authenticated account removing the like.
30
- * @returns {Promise<number>} The updated total number of likes after removal.
31
- */
32
- removeLikeFromResource(resourceId: string, accountId: string): Promise<number>;
33
- /**
34
- * Checks if the authenticated user has liked the given resource.
35
- *
36
- * @param {string} resourceId - MongoDB ObjectId of the resource.
37
- * @param {string} accountId - The ID of the authenticated account to check.
38
- * @returns {Promise<boolean>} True if the user has liked the resource, false otherwise.
39
- */
40
- isResourceLikedByUser(resourceId: string, accountId: string): Promise<boolean>;
41
- }
@@ -1,125 +0,0 @@
1
- "use strict";
2
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
- return c > 3 && r && Object.defineProperty(target, key, r), r;
7
- };
8
- var __metadata = (this && this.__metadata) || function (k, v) {
9
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
- };
11
- var __param = (this && this.__param) || function (paramIndex, decorator) {
12
- return function (target, key) { decorator(target, key, paramIndex); }
13
- };
14
- Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.LikeController = void 0;
16
- const common_1 = require("@nestjs/common");
17
- const swagger_1 = require("@nestjs/swagger");
18
- const decorators_1 = require("../../../decorators");
19
- const pipes_1 = require("../../../pipes");
20
- const authentication_1 = require("../../authentication");
21
- const like_service_1 = require("./like.service");
22
- /**
23
- * LikeController handles all HTTP requests related to "like" interactions on resources.
24
- *
25
- * It provides endpoints for users to add a like, remove a like, and check if they have liked a resource.
26
- * Authentication is enforced via JWT to ensure only authorized users can interact with these endpoints.
27
- * Resource IDs are validated as MongoDB ObjectIds to maintain data integrity.
28
- */
29
- let LikeController = class LikeController {
30
- /**
31
- * Initializes LikeController with LikeService dependency.
32
- *
33
- * @param {LikeService} likeService - Service handling like operations.
34
- */
35
- constructor(likeService) {
36
- this.likeService = likeService;
37
- }
38
- /**
39
- * Adds the authenticated user's like to the specified resource.
40
- *
41
- * @param {string} resourceId - MongoDB ObjectId of the resource to be liked.
42
- * @param {string} accountId - The ID of the authenticated account performing the like.
43
- * @returns {Promise<number>} The updated total number of likes after addition.
44
- */
45
- async addLikeToResource(resourceId, accountId) {
46
- return this.likeService.addLike(resourceId, accountId);
47
- }
48
- /**
49
- * Removes the authenticated user's like from the specified resource.
50
- *
51
- * @param {string} resourceId - MongoDB ObjectId of the resource to unlike.
52
- * @param {string} accountId - The ID of the authenticated account removing the like.
53
- * @returns {Promise<number>} The updated total number of likes after removal.
54
- */
55
- async removeLikeFromResource(resourceId, accountId) {
56
- return this.likeService.removeLike(resourceId, accountId);
57
- }
58
- /**
59
- * Checks if the authenticated user has liked the given resource.
60
- *
61
- * @param {string} resourceId - MongoDB ObjectId of the resource.
62
- * @param {string} accountId - The ID of the authenticated account to check.
63
- * @returns {Promise<boolean>} True if the user has liked the resource, false otherwise.
64
- */
65
- async isResourceLikedByUser(resourceId, accountId) {
66
- return this.likeService.hasLiked(resourceId, accountId);
67
- }
68
- };
69
- exports.LikeController = LikeController;
70
- __decorate([
71
- (0, swagger_1.ApiOperation)({
72
- summary: 'Add a like to a resource',
73
- description: 'Adds a like from the authenticated user to the specified resource.',
74
- }),
75
- (0, swagger_1.ApiOkResponse)({
76
- description: "Returns the updated number of likes after adding the user's like.",
77
- schema: { type: 'number', example: 42 },
78
- }),
79
- (0, pipes_1.ApiMongoIdParam)('resourceId'),
80
- (0, common_1.Put)(':resourceId'),
81
- __param(0, (0, pipes_1.MongoIdParam)('resourceId')),
82
- __param(1, (0, decorators_1.AuthenticatedAccount)('id')),
83
- __metadata("design:type", Function),
84
- __metadata("design:paramtypes", [String, String]),
85
- __metadata("design:returntype", Promise)
86
- ], LikeController.prototype, "addLikeToResource", null);
87
- __decorate([
88
- (0, swagger_1.ApiOperation)({
89
- summary: 'Remove a like from a resource',
90
- description: "Removes the authenticated user's like from the specified resource.",
91
- }),
92
- (0, swagger_1.ApiNoContentResponse)({
93
- description: 'Successfully removed like. Returns the updated number of likes.',
94
- schema: { type: 'number', example: 41 },
95
- }),
96
- (0, pipes_1.ApiMongoIdParam)('resourceId'),
97
- (0, common_1.Delete)(':resourceId'),
98
- __param(0, (0, pipes_1.MongoIdParam)('resourceId')),
99
- __param(1, (0, decorators_1.AuthenticatedAccount)('id')),
100
- __metadata("design:type", Function),
101
- __metadata("design:paramtypes", [String, String]),
102
- __metadata("design:returntype", Promise)
103
- ], LikeController.prototype, "removeLikeFromResource", null);
104
- __decorate([
105
- (0, swagger_1.ApiOperation)({
106
- summary: 'Check if resource is liked by user',
107
- description: 'Returns true if the authenticated user has liked the specified resource, otherwise false.',
108
- }),
109
- (0, swagger_1.ApiOkResponse)({
110
- description: 'Boolean value indicating like status by the user.',
111
- schema: { type: 'boolean', example: true },
112
- }),
113
- (0, pipes_1.ApiMongoIdParam)('resourceId'),
114
- (0, common_1.Get)(':resourceId'),
115
- __param(0, (0, pipes_1.MongoIdParam)('resourceId')),
116
- __param(1, (0, decorators_1.AuthenticatedAccount)('id')),
117
- __metadata("design:type", Function),
118
- __metadata("design:paramtypes", [String, String]),
119
- __metadata("design:returntype", Promise)
120
- ], LikeController.prototype, "isResourceLikedByUser", null);
121
- exports.LikeController = LikeController = __decorate([
122
- (0, authentication_1.RequireJwtAuth)(),
123
- (0, common_1.Controller)(),
124
- __metadata("design:paramtypes", [like_service_1.LikeService])
125
- ], LikeController);
@@ -1,20 +0,0 @@
1
- import { ModelDefinition } from '@nestjs/mongoose';
2
- /**
3
- * Configuration options for dynamically registering the LikeModule.
4
- */
5
- export type LikeModuleOptions = {
6
- /**
7
- * The Mongoose model definition representing the resource type to be liked.
8
- */
9
- model: ModelDefinition;
10
- /**
11
- * Optional array of strings used to define the route path and API tag suffixes.
12
- * Useful for scoping like functionality to different resource contexts (e.g., 'posts', 'comments').
13
- */
14
- routeScope?: string[];
15
- };
16
- /**
17
- * Token used to inject LikeModule options into services or controllers if needed.
18
- * Symbol is used to avoid accidental naming collisions across modules.
19
- */
20
- export declare const LIKE_MODULE_OPTIONS_TOKEN: unique symbol;