itlab-internal-services 2.4.6 → 2.5.2

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 (54) hide show
  1. package/dist/create-duplicate-checker.function.d.ts +1 -1
  2. package/dist/create-duplicate-checker.function.js +4 -4
  3. package/dist/hub-resource.enum.d.ts +17 -0
  4. package/dist/hub-resource.enum.js +36 -0
  5. package/dist/index.d.ts +1 -0
  6. package/dist/index.js +1 -0
  7. package/dist/modules/comment/comment.controller.d.ts +4 -4
  8. package/dist/modules/comment/comment.controller.js +9 -9
  9. package/dist/modules/comment/comment.module.d.ts +4 -3
  10. package/dist/modules/comment/comment.module.js +5 -4
  11. package/dist/modules/comment/comment.service.d.ts +11 -11
  12. package/dist/modules/comment/comment.service.js +21 -21
  13. package/dist/modules/content/content.module.d.ts +3 -3
  14. package/dist/modules/content/content.module.js +4 -4
  15. package/dist/modules/content/content.service.d.ts +9 -9
  16. package/dist/modules/content/content.service.js +18 -18
  17. package/dist/modules/database/account-service/account.service.d.ts +15 -0
  18. package/dist/modules/{account → database/account-service}/account.service.js +9 -24
  19. package/dist/modules/database/database.module.js +3 -2
  20. package/dist/modules/database/index.d.ts +1 -0
  21. package/dist/modules/database/index.js +8 -13
  22. package/dist/modules/database/model-service/schemas/hub-account.schemas.d.ts +6 -0
  23. package/dist/modules/database/model-service/schemas/hub-comments.schemas.d.ts +3 -2
  24. package/dist/modules/database/model-service/schemas/hub-comments.schemas.js +8 -4
  25. package/dist/modules/database/model-service/schemas/hub-content.schemas.d.ts +2 -2
  26. package/dist/modules/database/model-service/schemas/hub-content.schemas.js +2 -2
  27. package/dist/modules/database/service-mapper-service/service-mapper.service.d.ts +8 -18
  28. package/dist/modules/database/service-mapper-service/service-mapper.service.js +27 -39
  29. package/dist/modules/index.d.ts +0 -1
  30. package/dist/modules/index.js +0 -1
  31. package/dist/modules/like/like.controller.d.ts +11 -11
  32. package/dist/modules/like/like.controller.js +27 -27
  33. package/dist/modules/like/like.service.d.ts +14 -14
  34. package/dist/modules/like/like.service.js +29 -29
  35. package/dist/modules/search/search.models.d.ts +2 -0
  36. package/dist/modules/search/search.models.js +6 -2
  37. package/dist/modules/search/search.module.d.ts +3 -3
  38. package/dist/modules/search/search.module.js +4 -4
  39. package/dist/modules/search/search.service.d.ts +9 -9
  40. package/dist/modules/search/search.service.js +20 -20
  41. package/dist/pipes/hub-resource.pipe.d.ts +26 -0
  42. package/dist/pipes/hub-resource.pipe.js +65 -0
  43. package/dist/pipes/index.d.ts +1 -1
  44. package/dist/pipes/index.js +1 -1
  45. package/dist/virtuals.factory.d.ts +5 -5
  46. package/dist/virtuals.factory.js +16 -18
  47. package/package.json +3 -3
  48. package/dist/modules/account/account.module.d.ts +0 -12
  49. package/dist/modules/account/account.module.js +0 -34
  50. package/dist/modules/account/account.service.d.ts +0 -23
  51. package/dist/modules/account/index.d.ts +0 -2
  52. package/dist/modules/account/index.js +0 -7
  53. package/dist/pipes/target.pipe.d.ts +0 -44
  54. package/dist/pipes/target.pipe.js +0 -83
@@ -1,3 +1,3 @@
1
1
  import { Document, Model } from 'mongoose';
2
2
  import { ErrorException } from './exceptions';
3
- export declare function createDuplicateChecker<D, T extends Document>(model: Model<T>, criticalKeys: (keyof D & keyof T)[], error?: new () => ErrorException): (dto: D, target?: T) => Promise<void>;
3
+ export declare function createDuplicateChecker<D, T extends Document>(model: Model<T>, criticalKeys: (keyof D & keyof T)[], error?: new () => ErrorException): (dto: D, resource?: T) => Promise<void>;
@@ -12,16 +12,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.createDuplicateChecker = void 0;
13
13
  const exceptions_1 = require("./exceptions");
14
14
  function createDuplicateChecker(model, criticalKeys, error = exceptions_1.DuplicateException) {
15
- return (dto, target) => __awaiter(this, void 0, void 0, function* () {
15
+ return (dto, resource) => __awaiter(this, void 0, void 0, function* () {
16
16
  const fq = {};
17
17
  for (const key of criticalKeys) {
18
18
  if (dto && key in dto)
19
19
  fq[key] = dto[key];
20
- if (target && key in target)
21
- fq[key] = target[key];
20
+ if (resource && key in resource)
21
+ fq[key] = resource[key];
22
22
  }
23
23
  const found = yield model.findOne(fq);
24
- const compareId = target ? String(target._id).toLowerCase() : undefined;
24
+ const compareId = resource ? String(resource._id).toLowerCase() : undefined;
25
25
  if (found && String(found._id).toLowerCase() !== compareId)
26
26
  throw new error();
27
27
  });
@@ -0,0 +1,17 @@
1
+ export declare enum HubResource {
2
+ NEWSROOM_NEWS = "newsroom-news",
3
+ EVENTS_EVENT = "events-event",
4
+ DEMO_HIVE_DEMO = "demo-hive-demo",
5
+ TECH_RADAR_BLIP = "tech-radar-blip",
6
+ TECH_RADAR_EDITION = "tech-radar-edition",
7
+ PODCASTS_PODCAST = "podcasts-podcast",
8
+ BOOKS_BOOK = "books-book",
9
+ HACKSCHOOL_COURSE = "hackschool-course",
10
+ HACKSCHOOL_THREAD = "hackschool-thread",
11
+ HACKSCHOOL_DOCUMENTATION = "hackschool-documentation",
12
+ TEAM_MEMBER = "team-member",
13
+ NEWSLETTER_ISSUE = "newsletter-issue",
14
+ HUB_USER = "hub-user",
15
+ HUB_FILE = "hub-file"
16
+ }
17
+ export declare const HUB_RESOURCES: HubResource[];
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.HUB_RESOURCES = exports.HubResource = void 0;
4
+ var HubResource;
5
+ (function (HubResource) {
6
+ HubResource["NEWSROOM_NEWS"] = "newsroom-news";
7
+ HubResource["EVENTS_EVENT"] = "events-event";
8
+ HubResource["DEMO_HIVE_DEMO"] = "demo-hive-demo";
9
+ HubResource["TECH_RADAR_BLIP"] = "tech-radar-blip";
10
+ HubResource["TECH_RADAR_EDITION"] = "tech-radar-edition";
11
+ HubResource["PODCASTS_PODCAST"] = "podcasts-podcast";
12
+ HubResource["BOOKS_BOOK"] = "books-book";
13
+ HubResource["HACKSCHOOL_COURSE"] = "hackschool-course";
14
+ HubResource["HACKSCHOOL_THREAD"] = "hackschool-thread";
15
+ HubResource["HACKSCHOOL_DOCUMENTATION"] = "hackschool-documentation";
16
+ HubResource["TEAM_MEMBER"] = "team-member";
17
+ HubResource["NEWSLETTER_ISSUE"] = "newsletter-issue";
18
+ HubResource["HUB_USER"] = "hub-user";
19
+ HubResource["HUB_FILE"] = "hub-file";
20
+ })(HubResource = exports.HubResource || (exports.HubResource = {}));
21
+ exports.HUB_RESOURCES = [
22
+ HubResource.NEWSROOM_NEWS,
23
+ HubResource.EVENTS_EVENT,
24
+ HubResource.DEMO_HIVE_DEMO,
25
+ HubResource.TECH_RADAR_BLIP,
26
+ HubResource.TECH_RADAR_EDITION,
27
+ HubResource.PODCASTS_PODCAST,
28
+ HubResource.BOOKS_BOOK,
29
+ HubResource.HACKSCHOOL_COURSE,
30
+ HubResource.HACKSCHOOL_THREAD,
31
+ HubResource.HACKSCHOOL_DOCUMENTATION,
32
+ HubResource.TEAM_MEMBER,
33
+ HubResource.NEWSLETTER_ISSUE,
34
+ HubResource.HUB_USER,
35
+ HubResource.HUB_FILE,
36
+ ];
package/dist/index.d.ts CHANGED
@@ -3,6 +3,7 @@ export * from './exceptions';
3
3
  export * from './favicon.controller';
4
4
  export * from './guards';
5
5
  export * from './http.logger';
6
+ export * from './hub-resource.enum';
6
7
  export * from './interceptors';
7
8
  export * from './liveness.probe';
8
9
  export * from './models';
package/dist/index.js CHANGED
@@ -19,6 +19,7 @@ __exportStar(require("./exceptions"), exports);
19
19
  __exportStar(require("./favicon.controller"), exports);
20
20
  __exportStar(require("./guards"), exports);
21
21
  __exportStar(require("./http.logger"), exports);
22
+ __exportStar(require("./hub-resource.enum"), exports);
22
23
  __exportStar(require("./interceptors"), exports);
23
24
  __exportStar(require("./liveness.probe"), exports);
24
25
  __exportStar(require("./models"), exports);
@@ -3,7 +3,7 @@ import { Comment } from './comment.module-options';
3
3
  import { CommentService } from './comment.service';
4
4
  /**
5
5
  * @class CommentController
6
- * @description This class handles operations related to adding, removing, and checking likes for specific targets.
6
+ * @description This class handles operations related to adding, removing, and checking likes for specific resources.
7
7
  * @author Timo Scheuermann
8
8
  */
9
9
  export declare class CommentController {
@@ -14,11 +14,11 @@ export declare class CommentController {
14
14
  */
15
15
  constructor(commentService: CommentService);
16
16
  /**
17
- * Add a comment to the specified target by the given account.
17
+ * Add a comment to the specified resource by the given account.
18
18
  *
19
- * @param {string} targetId - The ID of the target to add the comment to
19
+ * @param {string} resourceId - The ID of the hub resource to add the comment to
20
20
  * @param {string} accountId - The ID of the account adding the comment
21
21
  * @param {ContentRichtext} comment - The comment to add
22
22
  */
23
- postComment(targetId: string, accountId: string, comment: ContentRichtext): Promise<Comment>;
23
+ postComment(resourceId: string, accountId: string, comment: ContentRichtext): Promise<Comment>;
24
24
  }
@@ -31,7 +31,7 @@ const comment_module_options_1 = require("./comment.module-options");
31
31
  const comment_service_1 = require("./comment.service");
32
32
  /**
33
33
  * @class CommentController
34
- * @description This class handles operations related to adding, removing, and checking likes for specific targets.
34
+ * @description This class handles operations related to adding, removing, and checking likes for specific resources.
35
35
  * @author Timo Scheuermann
36
36
  */
37
37
  let CommentController = class CommentController {
@@ -43,26 +43,26 @@ let CommentController = class CommentController {
43
43
  this.commentService = commentService;
44
44
  }
45
45
  /**
46
- * Add a comment to the specified target by the given account.
46
+ * Add a comment to the specified resource by the given account.
47
47
  *
48
- * @param {string} targetId - The ID of the target to add the comment to
48
+ * @param {string} resourceId - The ID of the hub resource to add the comment to
49
49
  * @param {string} accountId - The ID of the account adding the comment
50
50
  * @param {ContentRichtext} comment - The comment to add
51
51
  */
52
- postComment(targetId, accountId, comment) {
52
+ postComment(resourceId, accountId, comment) {
53
53
  return __awaiter(this, void 0, void 0, function* () {
54
- return this.commentService.postComment(targetId, accountId, comment);
54
+ return this.commentService.postComment(resourceId, accountId, comment);
55
55
  });
56
56
  }
57
57
  };
58
58
  __decorate([
59
- (0, swagger_1.ApiOperation)({ description: 'Speichert ein Kommentar zum angegeben Target' }),
59
+ (0, swagger_1.ApiOperation)({ description: 'Speichert ein Kommentar zur angegeben Ressource' }),
60
60
  (0, swagger_1.ApiResponse)({ description: 'Der gespeicherte Kommentar', status: common_1.HttpStatus.OK, type: comment_module_options_1.Comment }),
61
61
  (0, swagger_1.ApiBody)({ description: 'Der zu speichernde Kommentar' }),
62
62
  (0, exceptions_1.ApiBadBody)('Validierung des Kommentars fehlgeschlagen'),
63
- (0, pipes_1.ApiId)('targetId'),
64
- (0, common_1.Post)(':targetId'),
65
- __param(0, (0, pipes_1.Id)('targetId')),
63
+ (0, pipes_1.ApiId)('resourceId'),
64
+ (0, common_1.Post)(':resourceId'),
65
+ __param(0, (0, pipes_1.Id)('resourceId')),
66
66
  __param(1, (0, authentication_1.Account)('id')),
67
67
  __param(2, (0, common_1.Body)()),
68
68
  __metadata("design:type", Function),
@@ -1,6 +1,6 @@
1
1
  import { DynamicModule } from '@nestjs/common';
2
2
  import { ModelDefinition } from '@nestjs/mongoose';
3
- import { Targets } from '../../pipes';
3
+ import { HubResource } from '../../hub-resource.enum';
4
4
  /**
5
5
  * @class CommentModule
6
6
  * @description This module handles all operations related to comments.
@@ -11,9 +11,10 @@ export declare class CommentModule {
11
11
  * Generate a CommentModule based on the given schema.
12
12
  *
13
13
  * @param {ModelDefinition} model - the model
14
+ * @param {HubResource} resource - the resource used to bind comments t
14
15
  * @param {string | string[]} suffix - additional suffix for the CommentController (Defaults to "")
15
16
  * @return {DynamicModule} the CommentModule generated for the given schema
16
17
  */
17
- static forFeature(model: ModelDefinition, target: Targets, ...suffix: string[]): DynamicModule;
18
- static register(target: Targets): DynamicModule;
18
+ static forFeature(model: ModelDefinition, resource: HubResource, ...suffix: string[]): DynamicModule;
19
+ static register(resource: HubResource): DynamicModule;
19
20
  }
@@ -22,10 +22,11 @@ class CommentModule {
22
22
  * Generate a CommentModule based on the given schema.
23
23
  *
24
24
  * @param {ModelDefinition} model - the model
25
+ * @param {HubResource} resource - the resource used to bind comments t
25
26
  * @param {string | string[]} suffix - additional suffix for the CommentController (Defaults to "")
26
27
  * @return {DynamicModule} the CommentModule generated for the given schema
27
28
  */
28
- static forFeature(model, target, ...suffix) {
29
+ static forFeature(model, resource, ...suffix) {
29
30
  let CommentController = class CommentController extends comment_controller_1.CommentController {
30
31
  };
31
32
  CommentController = __decorate([
@@ -39,7 +40,7 @@ class CommentModule {
39
40
  controllers: [CommentController],
40
41
  providers: [
41
42
  comment_service_1.CommentService,
42
- { provide: 'COMMENT_TARGET', useValue: target },
43
+ { provide: 'COMMENT_RESOURCE', useValue: resource },
43
44
  { provide: 'COMMENT_MODEL', useValue: model.name },
44
45
  { provide: 'COMMENT_SCHEMA', useValue: model.schema },
45
46
  ],
@@ -48,12 +49,12 @@ class CommentModule {
48
49
  ], CommentModuleTemplate);
49
50
  return { module: CommentModuleTemplate };
50
51
  }
51
- static register(target) {
52
+ static register(resource) {
52
53
  let CommentModuleTemplate = class CommentModuleTemplate {
53
54
  };
54
55
  CommentModuleTemplate = __decorate([
55
56
  (0, common_1.Module)({
56
- providers: [comment_service_1.CommentService, { provide: 'COMMENT_TARGET', useValue: target }],
57
+ providers: [comment_service_1.CommentService, { provide: 'COMMENT_RESOURCE', useValue: resource }],
57
58
  exports: [comment_service_1.CommentService],
58
59
  })
59
60
  ], CommentModuleTemplate);
@@ -1,18 +1,18 @@
1
1
  import { ConfigService } from '@nestjs/config';
2
2
  import { ContentRichtext } from 'itlab-functions';
3
3
  import { Connection, Schema } from 'mongoose';
4
- import { Targets } from '../../pipes';
4
+ import { HubResource } from '../../hub-resource.enum';
5
5
  import { Comment } from './comment.module-options';
6
6
  /**
7
7
  * @class CommentService
8
- * @description The CommentService class is responsible for handling comments for a specified target. It provides methods to add and delete comments of a target.
8
+ * @description The CommentService class is responsible for handling comments for a specified resource. It provides methods to add and delete comments of a resource.
9
9
  * @author Timo Scheuermann
10
10
  */
11
11
  export declare class CommentService {
12
12
  private readonly connection;
13
13
  private readonly model;
14
14
  private readonly schema;
15
- private readonly target;
15
+ private readonly resource;
16
16
  private readonly configService;
17
17
  /** The CommentService logger */
18
18
  private readonly logger;
@@ -21,12 +21,12 @@ export declare class CommentService {
21
21
  * @param {Connection} connection - the database connection
22
22
  * @param {string} model - the model name
23
23
  * @param {string} schema - the schema
24
- * @param {Targets} target - the target
24
+ * @param {HubResource} resource - the resource used
25
25
  * @param {ConfigService} configService - the config service
26
26
  */
27
27
  constructor(connection: Connection, model: string | undefined, schema: Schema<{
28
28
  _url: string;
29
- }>, target: Targets, configService: ConfigService);
29
+ }>, resource: HubResource, configService: ConfigService);
30
30
  /** The axios instance */
31
31
  private axios;
32
32
  /**
@@ -36,19 +36,19 @@ export declare class CommentService {
36
36
  */
37
37
  private getModel;
38
38
  /**
39
- * Post a comment to a specific target.
39
+ * Post a comment to a specific resource.
40
40
  *
41
- * @param {string} targetId - the ID of the target for the comment
41
+ * @param {string} resourceId - the ID of the resource for the comment
42
42
  * @param {string} accountId - the ID of the account posting the comment
43
43
  * @param {ContentRichtext} comment - the content of the comment
44
44
  * @return {Promise<Comment>} a promise that resolves with the posted comment
45
45
  */
46
- postComment(targetId: string, accountId: string, comment: ContentRichtext): Promise<Comment>;
46
+ postComment(resourceId: string, accountId: string, comment: ContentRichtext): Promise<Comment>;
47
47
  /**
48
- * Deletes all comments of the specified target.
48
+ * Deletes all comments of the specified resource.
49
49
  *
50
- * @param {string} targetId - the ID of the target to be deleted
50
+ * @param {string} resourceId - the ID of the resource to be deleted
51
51
  * @return {void}
52
52
  */
53
- delete(targetId: string): void;
53
+ delete(resourceId: string): void;
54
54
  }
@@ -31,10 +31,10 @@ const mongoose_2 = require("mongoose");
31
31
  const axios_1 = require("../../axios");
32
32
  const env_1 = require("../../env");
33
33
  const exceptions_1 = require("../../exceptions");
34
- const pipes_1 = require("../../pipes");
34
+ const hub_resource_enum_1 = require("../../hub-resource.enum");
35
35
  /**
36
36
  * @class CommentService
37
- * @description The CommentService class is responsible for handling comments for a specified target. It provides methods to add and delete comments of a target.
37
+ * @description The CommentService class is responsible for handling comments for a specified resource. It provides methods to add and delete comments of a resource.
38
38
  * @author Timo Scheuermann
39
39
  */
40
40
  let CommentService = CommentService_1 = class CommentService {
@@ -43,14 +43,14 @@ let CommentService = CommentService_1 = class CommentService {
43
43
  * @param {Connection} connection - the database connection
44
44
  * @param {string} model - the model name
45
45
  * @param {string} schema - the schema
46
- * @param {Targets} target - the target
46
+ * @param {HubResource} resource - the resource used
47
47
  * @param {ConfigService} configService - the config service
48
48
  */
49
- constructor(connection, model, schema, target, configService) {
49
+ constructor(connection, model, schema, resource, configService) {
50
50
  this.connection = connection;
51
51
  this.model = model;
52
52
  this.schema = schema;
53
- this.target = target;
53
+ this.resource = resource;
54
54
  this.configService = configService;
55
55
  /** The CommentService logger */
56
56
  this.logger = new common_1.Logger(CommentService_1.name);
@@ -72,50 +72,50 @@ let CommentService = CommentService_1 = class CommentService {
72
72
  return this.connection.model(this.model, this.schema);
73
73
  }
74
74
  /**
75
- * Post a comment to a specific target.
75
+ * Post a comment to a specific resource.
76
76
  *
77
- * @param {string} targetId - the ID of the target for the comment
77
+ * @param {string} resourceId - the ID of the resource for the comment
78
78
  * @param {string} accountId - the ID of the account posting the comment
79
79
  * @param {ContentRichtext} comment - the content of the comment
80
80
  * @return {Promise<Comment>} a promise that resolves with the posted comment
81
81
  */
82
- postComment(targetId, accountId, comment) {
82
+ postComment(resourceId, accountId, comment) {
83
83
  return __awaiter(this, void 0, void 0, function* () {
84
84
  // CommentModel is null inside manager modules
85
85
  if (!(0, class_validator_1.isDefined)(this.getModel())) {
86
86
  this.logger.error('Kommentare können nicht vom Management aus erstell werden');
87
87
  return;
88
88
  }
89
- const exists = yield this.getModel().findOne({ _id: targetId });
89
+ const exists = yield this.getModel().findOne({ _id: resourceId });
90
90
  if (!exists)
91
91
  throw new exceptions_1.NotFoundException('Kommentar konnte nicht erstellt werden');
92
- this.logger.log(`Posting comment for ${this.target} (${targetId}) by ${accountId}`);
92
+ this.logger.log(`Posting comment for ${this.resource} (${resourceId}) by ${accountId}`);
93
93
  return new Promise((resolve, reject) => {
94
94
  this.axios
95
- .post(`${this.target}/${targetId}/${accountId}`, comment)
95
+ .post(`${this.resource}/${resourceId}/${accountId}`, comment)
96
96
  .then(({ data }) => {
97
- this.logger.log(`Comment for ${this.target} (${targetId}) posted`);
97
+ this.logger.log(`Comment for ${this.resource} (${resourceId}) posted`);
98
98
  resolve(data);
99
99
  })
100
100
  .catch(({ response }) => {
101
- this.logger.error(`Couldn't post comment for ${this.target} (${targetId})`, response.data);
101
+ this.logger.error(`Couldn't post comment for ${this.resource} (${resourceId})`, response.data);
102
102
  reject(new common_1.HttpException(response.data, response.status));
103
103
  });
104
104
  });
105
105
  });
106
106
  }
107
107
  /**
108
- * Deletes all comments of the specified target.
108
+ * Deletes all comments of the specified resource.
109
109
  *
110
- * @param {string} targetId - the ID of the target to be deleted
110
+ * @param {string} resourceId - the ID of the resource to be deleted
111
111
  * @return {void}
112
112
  */
113
- delete(targetId) {
114
- this.logger.log(`Deleting all comments for ${this.target} (${targetId})`);
113
+ delete(resourceId) {
114
+ this.logger.log(`Deleting all comments for ${this.resource} (${resourceId})`);
115
115
  this.axios
116
- .delete(`${this.target}/${targetId}`)
117
- .then(() => this.logger.log(`All comments for ${this.target} (${targetId}) deleted`))
118
- .catch(({ response }) => this.logger.error(`Couldn't delete all comments for ${this.target} (${targetId})`, response.data));
116
+ .delete(`${this.resource}/${resourceId}`)
117
+ .then(() => this.logger.log(`All comments for ${this.resource} (${resourceId}) deleted`))
118
+ .catch(({ response }) => this.logger.error(`Couldn't delete all comments for ${this.resource} (${resourceId})`, response.data));
119
119
  }
120
120
  };
121
121
  CommentService = CommentService_1 = __decorate([
@@ -125,7 +125,7 @@ CommentService = CommentService_1 = __decorate([
125
125
  __param(1, (0, common_1.Inject)('COMMENT_MODEL')),
126
126
  __param(2, (0, common_1.Optional)()),
127
127
  __param(2, (0, common_1.Inject)('COMMENT_SCHEMA')),
128
- __param(3, (0, common_1.Inject)('COMMENT_TARGET')),
128
+ __param(3, (0, common_1.Inject)('COMMENT_RESOURCE')),
129
129
  __metadata("design:paramtypes", [mongoose_2.Connection, String, mongoose_2.Schema, String, config_1.ConfigService])
130
130
  ], CommentService);
131
131
  exports.CommentService = CommentService;
@@ -1,5 +1,5 @@
1
1
  import { DynamicModule } from '@nestjs/common';
2
- import { Targets } from '../../pipes';
2
+ import { HubResource } from '../../hub-resource.enum';
3
3
  /**
4
4
  * Content module
5
5
  * @class ContentModule
@@ -9,10 +9,10 @@ export declare class ContentModule {
9
9
  * Creates a global ContentModule
10
10
  * @returns {DynamicModule} ContentModule
11
11
  */
12
- static forRoot(target: Targets): DynamicModule;
12
+ static forRoot(resource: HubResource): DynamicModule;
13
13
  /**
14
14
  * Creates a local ContentModule
15
15
  * @returns {DynamicModule} ContentModule
16
16
  */
17
- static register(target: Targets): DynamicModule;
17
+ static register(resource: HubResource): DynamicModule;
18
18
  }
@@ -19,11 +19,11 @@ let ContentModule = ContentModule_1 = class ContentModule {
19
19
  * Creates a global ContentModule
20
20
  * @returns {DynamicModule} ContentModule
21
21
  */
22
- static forRoot(target) {
22
+ static forRoot(resource) {
23
23
  return {
24
24
  global: true,
25
25
  module: ContentModule_1,
26
- providers: [content_service_1.ContentService, { provide: 'CONTENT_TARGET', useValue: target }],
26
+ providers: [content_service_1.ContentService, { provide: 'CONTENT_RESOURCE', useValue: resource }],
27
27
  exports: [content_service_1.ContentService],
28
28
  };
29
29
  }
@@ -31,11 +31,11 @@ let ContentModule = ContentModule_1 = class ContentModule {
31
31
  * Creates a local ContentModule
32
32
  * @returns {DynamicModule} ContentModule
33
33
  */
34
- static register(target) {
34
+ static register(resource) {
35
35
  return {
36
36
  global: true,
37
37
  module: ContentModule_1,
38
- providers: [content_service_1.ContentService, { provide: 'CONTENT_TARGET', useValue: target }],
38
+ providers: [content_service_1.ContentService, { provide: 'CONTENT_RESOURCE', useValue: resource }],
39
39
  exports: [content_service_1.ContentService],
40
40
  };
41
41
  }
@@ -1,20 +1,20 @@
1
1
  import { ConfigService } from '@nestjs/config';
2
2
  import { Content } from 'itlab-functions';
3
- import { Targets } from '../../pipes';
3
+ import { HubResource } from '../../hub-resource.enum';
4
4
  /**
5
5
  * Content service
6
6
  * @class ContentService
7
7
  */
8
8
  export declare class ContentService {
9
9
  private readonly configService;
10
- private readonly target;
10
+ private readonly resource;
11
11
  /** The Logger instance */
12
12
  private logger;
13
13
  /**
14
14
  * Constructor
15
15
  * @param configService - the config service
16
16
  */
17
- constructor(configService: ConfigService, target: Targets);
17
+ constructor(configService: ConfigService, resource: HubResource);
18
18
  /** The axios instance */
19
19
  private axios;
20
20
  /**
@@ -26,18 +26,18 @@ export declare class ContentService {
26
26
  */
27
27
  verify(content: Content): Promise<void>;
28
28
  /**
29
- * Posts content of the specified target.
29
+ * Posts content of the specified resource.
30
30
  *
31
- * @param {string} targetId - the ID of the target
31
+ * @param {string} resourceId - the ID of the resource
32
32
  * @param {Content} content - the content to be posted
33
33
  * @return {Promise<string>}
34
34
  */
35
- post(targetId: string, content: Content): Promise<void>;
35
+ post(resourceId: string, content: Content): Promise<void>;
36
36
  /**
37
- * Deletes content of the specified target.
37
+ * Deletes content of the specified resource.
38
38
  *
39
- * @param {string} targetId - the ID of the target
39
+ * @param {string} resourceId - the ID of the resource
40
40
  * @return {Promise<void>} a promise that resolves when the content is deleted
41
41
  */
42
- delete(targetId: string): Promise<void>;
42
+ delete(resourceId: string): Promise<void>;
43
43
  }
@@ -27,7 +27,7 @@ const common_1 = require("@nestjs/common");
27
27
  const config_1 = require("@nestjs/config");
28
28
  const axios_1 = require("../../axios");
29
29
  const env_1 = require("../../env");
30
- const pipes_1 = require("../../pipes");
30
+ const hub_resource_enum_1 = require("../../hub-resource.enum");
31
31
  /**
32
32
  * Content service
33
33
  * @class ContentService
@@ -37,9 +37,9 @@ let ContentService = ContentService_1 = class ContentService {
37
37
  * Constructor
38
38
  * @param configService - the config service
39
39
  */
40
- constructor(configService, target) {
40
+ constructor(configService, resource) {
41
41
  this.configService = configService;
42
- this.target = target;
42
+ this.resource = resource;
43
43
  /** The Logger instance */
44
44
  this.logger = new common_1.Logger(ContentService_1.name);
45
45
  /** The axios instance */
@@ -73,47 +73,47 @@ let ContentService = ContentService_1 = class ContentService {
73
73
  });
74
74
  }
75
75
  /**
76
- * Posts content of the specified target.
76
+ * Posts content of the specified resource.
77
77
  *
78
- * @param {string} targetId - the ID of the target
78
+ * @param {string} resourceId - the ID of the resource
79
79
  * @param {Content} content - the content to be posted
80
80
  * @return {Promise<string>}
81
81
  */
82
- post(targetId, content) {
82
+ post(resourceId, content) {
83
83
  return __awaiter(this, void 0, void 0, function* () {
84
- this.logger.log(`Posting content of ${this.target} (${targetId})`);
84
+ this.logger.log(`Posting content of ${this.resource} (${resourceId})`);
85
85
  return new Promise((resolve, reject) => {
86
86
  this.axios
87
- .post(`${this.target}/${targetId}`, { content })
87
+ .post(`${this.resource}/${resourceId}`, { content })
88
88
  .then(() => {
89
- this.logger.log(`Content of ${this.target} (${targetId}) posted`);
89
+ this.logger.log(`Content of ${this.resource} (${resourceId}) posted`);
90
90
  resolve();
91
91
  })
92
92
  .catch(({ response }) => {
93
- this.logger.error(`Couldn't post content of ${this.target} (${targetId})...`, response.data);
93
+ this.logger.error(`Couldn't post content of ${this.resource} (${resourceId})...`, response.data);
94
94
  reject(new common_1.HttpException(response.data, response.status));
95
95
  });
96
96
  });
97
97
  });
98
98
  }
99
99
  /**
100
- * Deletes content of the specified target.
100
+ * Deletes content of the specified resource.
101
101
  *
102
- * @param {string} targetId - the ID of the target
102
+ * @param {string} resourceId - the ID of the resource
103
103
  * @return {Promise<void>} a promise that resolves when the content is deleted
104
104
  */
105
- delete(targetId) {
105
+ delete(resourceId) {
106
106
  return __awaiter(this, void 0, void 0, function* () {
107
- this.logger.log(`Deleting content of ${this.target} (${targetId})`);
107
+ this.logger.log(`Deleting content of ${this.resource} (${resourceId})`);
108
108
  return new Promise((resolve, reject) => {
109
109
  this.axios
110
- .delete(`${this.target}/${targetId}`)
110
+ .delete(`${this.resource}/${resourceId}`)
111
111
  .then(() => {
112
- this.logger.log(`Content of ${this.target} (${targetId}) deleted`);
112
+ this.logger.log(`Content of ${this.resource} (${resourceId}) deleted`);
113
113
  resolve();
114
114
  })
115
115
  .catch(({ response }) => {
116
- this.logger.error(`Couldn't delete content of ${this.target} (${targetId})...`, response.data);
116
+ this.logger.error(`Couldn't delete content of ${this.resource} (${resourceId})...`, response.data);
117
117
  reject(new common_1.HttpException(response.data, response.status));
118
118
  });
119
119
  });
@@ -122,7 +122,7 @@ let ContentService = ContentService_1 = class ContentService {
122
122
  };
123
123
  ContentService = ContentService_1 = __decorate([
124
124
  (0, common_1.Injectable)(),
125
- __param(1, (0, common_1.Inject)('CONTENT_TARGET')),
125
+ __param(1, (0, common_1.Inject)('CONTENT_RESOURCE')),
126
126
  __metadata("design:paramtypes", [config_1.ConfigService, String])
127
127
  ], ContentService);
128
128
  exports.ContentService = ContentService;
@@ -0,0 +1,15 @@
1
+ import { ModelService } from '../model-service/model.service';
2
+ import { AccountInformation } from '../model-service/schemas/hub-account.schemas';
3
+ /**
4
+ * Account service
5
+ * @class AccountService
6
+ */
7
+ export declare class AccountService {
8
+ private readonly modelService;
9
+ /**
10
+ * Constructor
11
+ * @param modelService - the model service
12
+ */
13
+ constructor(modelService: ModelService);
14
+ get(accountId: string): Promise<AccountInformation>;
15
+ }