itlab-internal-services 2.3.0 → 2.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{modules/services/services.module-utils.js → axios.js} +1 -1
- package/dist/exceptions/bad-body.exception.d.ts +8 -1
- package/dist/exceptions/bad-body.exception.js +26 -1
- package/dist/exceptions/duplicate.exception.d.ts +8 -1
- package/dist/exceptions/duplicate.exception.js +26 -1
- package/dist/exceptions/index.d.ts +7 -0
- package/dist/exceptions/not-found.exception.d.ts +8 -1
- package/dist/exceptions/not-found.exception.js +26 -1
- package/dist/guards/perms.guard.js +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -1
- package/dist/modules/account/account.module.d.ts +12 -0
- package/dist/modules/account/account.module.js +34 -0
- package/dist/modules/{services/account-service → account}/account.service.js +3 -3
- package/dist/modules/account/index.d.ts +2 -0
- package/dist/modules/account/index.js +7 -0
- package/dist/modules/authentication/authentication.module.d.ts +3 -12
- package/dist/modules/authentication/authentication.module.js +4 -6
- package/dist/modules/authentication/index.d.ts +1 -1
- package/dist/modules/comment/comment.controller.d.ts +24 -0
- package/dist/modules/comment/comment.controller.js +78 -0
- package/dist/modules/{services/comment-service/comment-service.definitions.d.ts → comment/comment.module-options.d.ts} +2 -0
- package/dist/modules/{services/comment-service/comment-service.definitions.js → comment/comment.module-options.js} +2 -0
- package/dist/modules/comment/comment.module.d.ts +19 -0
- package/dist/modules/comment/comment.module.js +57 -0
- package/dist/modules/comment/comment.service.d.ts +42 -0
- package/dist/modules/comment/comment.service.js +113 -0
- package/dist/modules/comment/index.d.ts +3 -0
- package/dist/modules/comment/index.js +12 -0
- package/dist/modules/content/content.module.d.ts +18 -0
- package/dist/modules/content/content.module.js +46 -0
- package/dist/modules/{services/content-service → content}/content.service.d.ts +5 -6
- package/dist/modules/{services/content-service → content}/content.service.js +21 -17
- package/dist/modules/content/index.d.ts +2 -0
- package/dist/modules/content/index.js +7 -0
- package/dist/modules/index.d.ts +5 -1
- package/dist/modules/index.js +5 -1
- package/dist/modules/like/like.module.d.ts +1 -1
- package/dist/modules/like/like.module.js +2 -2
- package/dist/modules/mail/index.d.ts +3 -0
- package/dist/modules/mail/index.js +10 -0
- package/dist/modules/mail/mail.module.d.ts +12 -0
- package/dist/modules/mail/mail.module.js +34 -0
- package/dist/modules/{services/mail-service → mail}/mail.service.d.ts +1 -1
- package/dist/modules/{services/mail-service → mail}/mail.service.js +3 -3
- package/dist/modules/search/index.d.ts +3 -0
- package/dist/modules/search/index.js +9 -0
- package/dist/modules/search/search.module.d.ts +18 -0
- package/dist/modules/search/search.module.js +46 -0
- package/dist/modules/{services/search-service → search}/search.service.d.ts +6 -7
- package/dist/modules/{services/search-service → search}/search.service.js +21 -17
- package/dist/schema.transformer.d.ts +2 -0
- package/dist/schema.transformer.js +10 -0
- package/dist/virtuals.factory.d.ts +57 -0
- package/dist/virtuals.factory.js +117 -0
- package/package.json +1 -1
- package/dist/modules/services/comment-service/comment.service.d.ts +0 -38
- package/dist/modules/services/comment-service/comment.service.js +0 -101
- package/dist/modules/services/index.d.ts +0 -9
- package/dist/modules/services/index.js +0 -40
- package/dist/modules/services/services.module.d.ts +0 -24
- package/dist/modules/services/services.module.js +0 -39
- package/dist/virtuals.d.ts +0 -51
- package/dist/virtuals.js +0 -121
- /package/dist/{modules/services/services.module-utils.d.ts → axios.d.ts} +0 -0
- /package/dist/modules/{services/account-service → account}/account.service.d.ts +0 -0
- /package/dist/modules/{services/mail-service/mail-service.definitions.d.ts → mail/mail.models.d.ts} +0 -0
- /package/dist/modules/{services/mail-service/mail-service.definitions.js → mail/mail.models.js} +0 -0
- /package/dist/modules/{services/search-service/search-service.definitions.d.ts → search/search.models.d.ts} +0 -0
- /package/dist/modules/{services/search-service/search-service.definitions.js → search/search.models.js} +0 -0
|
@@ -0,0 +1,113 @@
|
|
|
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 __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
15
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
16
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
17
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
18
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
19
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
20
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
var CommentService_1;
|
|
24
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
+
exports.CommentService = void 0;
|
|
26
|
+
const common_1 = require("@nestjs/common");
|
|
27
|
+
const config_1 = require("@nestjs/config");
|
|
28
|
+
const mongoose_1 = require("@nestjs/mongoose");
|
|
29
|
+
const class_validator_1 = require("class-validator");
|
|
30
|
+
const mongoose_2 = require("mongoose");
|
|
31
|
+
const axios_1 = require("../../axios");
|
|
32
|
+
const env_1 = require("../../env");
|
|
33
|
+
const exceptions_1 = require("../../exceptions");
|
|
34
|
+
const pipes_1 = require("../../pipes");
|
|
35
|
+
/**
|
|
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.
|
|
38
|
+
* @author Timo Scheuermann
|
|
39
|
+
*/
|
|
40
|
+
let CommentService = CommentService_1 = class CommentService {
|
|
41
|
+
/**
|
|
42
|
+
* @constructor Constructor for the CommentService class
|
|
43
|
+
* @param commentModel - The injected model for the COMMENT_SCHEMA
|
|
44
|
+
* @param target - The target for which comments are being posted
|
|
45
|
+
* @param configService - The injected config service
|
|
46
|
+
*/
|
|
47
|
+
constructor(commentModel, target, configService) {
|
|
48
|
+
this.commentModel = commentModel;
|
|
49
|
+
this.target = target;
|
|
50
|
+
this.configService = configService;
|
|
51
|
+
/** The CommentService logger */
|
|
52
|
+
this.logger = new common_1.Logger(CommentService_1.name);
|
|
53
|
+
/** The axios instance */
|
|
54
|
+
this.axios = (0, axios_1.createAxios)({
|
|
55
|
+
baseUrl: 'https://services.svi-itlab.com/comment/internal/',
|
|
56
|
+
k8sToken: this.configService.getOrThrow(env_1.ENV_K8S_TOKEN),
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Post a comment to a specific target.
|
|
61
|
+
*
|
|
62
|
+
* @param {string} targetId - the ID of the target for the comment
|
|
63
|
+
* @param {string} accountId - the ID of the account posting the comment
|
|
64
|
+
* @param {ContentRichtext} comment - the content of the comment
|
|
65
|
+
* @return {Promise<Comment>} a promise that resolves with the posted comment
|
|
66
|
+
*/
|
|
67
|
+
postComment(targetId, accountId, comment) {
|
|
68
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
69
|
+
// CommentModel is null inside manager modules
|
|
70
|
+
if (!(0, class_validator_1.isDefined)(this.commentModel)) {
|
|
71
|
+
this.logger.error('Kommentare können nicht vom Management aus erstell werden');
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
const exists = yield this.commentModel.findOne({ _id: targetId });
|
|
75
|
+
if (!exists)
|
|
76
|
+
throw new exceptions_1.NotFoundException('Kommentar konnte nicht erstellt werden');
|
|
77
|
+
this.logger.log(`Posting comment for ${this.target} (${targetId}) by ${accountId}`);
|
|
78
|
+
return new Promise((resolve, reject) => {
|
|
79
|
+
this.axios
|
|
80
|
+
.post(`${this.target}/${targetId}/${accountId}`, comment)
|
|
81
|
+
.then(({ data }) => {
|
|
82
|
+
this.logger.log(`Comment for ${this.target} (${targetId}) posted`);
|
|
83
|
+
resolve(data);
|
|
84
|
+
})
|
|
85
|
+
.catch(({ response }) => {
|
|
86
|
+
this.logger.error(`Couldn't post comment for ${this.target} (${targetId})`, response.data);
|
|
87
|
+
reject(new common_1.HttpException(response.data, response.status));
|
|
88
|
+
});
|
|
89
|
+
});
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Deletes all comments of the specified target.
|
|
94
|
+
*
|
|
95
|
+
* @param {string} targetId - the ID of the target to be deleted
|
|
96
|
+
* @return {void}
|
|
97
|
+
*/
|
|
98
|
+
delete(targetId) {
|
|
99
|
+
this.logger.log(`Deleting all comments for ${this.target} (${targetId})`);
|
|
100
|
+
this.axios
|
|
101
|
+
.delete(`${this.target}/${targetId}`)
|
|
102
|
+
.then(() => this.logger.log(`All comments for ${this.target} (${targetId}) deleted`))
|
|
103
|
+
.catch(({ response }) => this.logger.error(`Couldn't delete all comments for ${this.target} (${targetId})`, response.data));
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
CommentService = CommentService_1 = __decorate([
|
|
107
|
+
(0, common_1.Injectable)(),
|
|
108
|
+
__param(0, (0, common_1.Optional)()),
|
|
109
|
+
__param(0, (0, mongoose_1.InjectModel)('COMMENT_SCHEMA')),
|
|
110
|
+
__param(1, (0, common_1.Inject)('COMMENT_TARGET')),
|
|
111
|
+
__metadata("design:paramtypes", [mongoose_2.Model, String, config_1.ConfigService])
|
|
112
|
+
], CommentService);
|
|
113
|
+
exports.CommentService = CommentService;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CommentService = exports.Comment = exports.CommentModule = void 0;
|
|
4
|
+
/*
|
|
5
|
+
* Comment Module
|
|
6
|
+
*/
|
|
7
|
+
var comment_module_1 = require("./comment.module");
|
|
8
|
+
Object.defineProperty(exports, "CommentModule", { enumerable: true, get: function () { return comment_module_1.CommentModule; } });
|
|
9
|
+
var comment_module_options_1 = require("./comment.module-options");
|
|
10
|
+
Object.defineProperty(exports, "Comment", { enumerable: true, get: function () { return comment_module_options_1.Comment; } });
|
|
11
|
+
var comment_service_1 = require("./comment.service");
|
|
12
|
+
Object.defineProperty(exports, "CommentService", { enumerable: true, get: function () { return comment_service_1.CommentService; } });
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { DynamicModule } from '@nestjs/common';
|
|
2
|
+
import { Targets } from '../../pipes';
|
|
3
|
+
/**
|
|
4
|
+
* Content module
|
|
5
|
+
* @class ContentModule
|
|
6
|
+
*/
|
|
7
|
+
export declare class ContentModule {
|
|
8
|
+
/**
|
|
9
|
+
* Creates a global ContentModule
|
|
10
|
+
* @returns {DynamicModule} ContentModule
|
|
11
|
+
*/
|
|
12
|
+
static forRoot(target: Targets): DynamicModule;
|
|
13
|
+
/**
|
|
14
|
+
* Creates a local ContentModule
|
|
15
|
+
* @returns {DynamicModule} ContentModule
|
|
16
|
+
*/
|
|
17
|
+
static register(target: Targets): DynamicModule;
|
|
18
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
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 ContentModule_1;
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.ContentModule = void 0;
|
|
11
|
+
const common_1 = require("@nestjs/common");
|
|
12
|
+
const content_service_1 = require("./content.service");
|
|
13
|
+
/**
|
|
14
|
+
* Content module
|
|
15
|
+
* @class ContentModule
|
|
16
|
+
*/
|
|
17
|
+
let ContentModule = ContentModule_1 = class ContentModule {
|
|
18
|
+
/**
|
|
19
|
+
* Creates a global ContentModule
|
|
20
|
+
* @returns {DynamicModule} ContentModule
|
|
21
|
+
*/
|
|
22
|
+
static forRoot(target) {
|
|
23
|
+
return {
|
|
24
|
+
global: true,
|
|
25
|
+
module: ContentModule_1,
|
|
26
|
+
providers: [content_service_1.ContentService, { provide: 'CONTENT_TARGET', useValue: target }],
|
|
27
|
+
exports: [content_service_1.ContentService],
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Creates a local ContentModule
|
|
32
|
+
* @returns {DynamicModule} ContentModule
|
|
33
|
+
*/
|
|
34
|
+
static register(target) {
|
|
35
|
+
return {
|
|
36
|
+
global: true,
|
|
37
|
+
module: ContentModule_1,
|
|
38
|
+
providers: [content_service_1.ContentService, { provide: 'CONTENT_TARGET', useValue: target }],
|
|
39
|
+
exports: [content_service_1.ContentService],
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
ContentModule = ContentModule_1 = __decorate([
|
|
44
|
+
(0, common_1.Module)({})
|
|
45
|
+
], ContentModule);
|
|
46
|
+
exports.ContentModule = ContentModule;
|
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
import { ConfigService } from '@nestjs/config';
|
|
2
2
|
import { Content } from 'itlab-functions';
|
|
3
|
-
import { Targets } from '
|
|
3
|
+
import { Targets } from '../../pipes';
|
|
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
11
|
/** The Logger instance */
|
|
11
12
|
private logger;
|
|
12
13
|
/**
|
|
13
14
|
* Constructor
|
|
14
15
|
* @param configService - the config service
|
|
15
16
|
*/
|
|
16
|
-
constructor(configService: ConfigService);
|
|
17
|
+
constructor(configService: ConfigService, target: Targets);
|
|
17
18
|
/** The axios instance */
|
|
18
19
|
private axios;
|
|
19
20
|
/**
|
|
@@ -29,16 +30,14 @@ export declare class ContentService {
|
|
|
29
30
|
*
|
|
30
31
|
* @param {string} targetId - the ID of the target
|
|
31
32
|
* @param {Content} content - the content to be posted
|
|
32
|
-
* @param {Targets} target - the target to post content
|
|
33
33
|
* @return {Promise<string>}
|
|
34
34
|
*/
|
|
35
|
-
post(targetId: string, content: Content
|
|
35
|
+
post(targetId: string, content: Content): Promise<void>;
|
|
36
36
|
/**
|
|
37
37
|
* Deletes content of the specified target.
|
|
38
38
|
*
|
|
39
39
|
* @param {string} targetId - the ID of the target
|
|
40
|
-
* @param {Targets} target - the target to delete content from
|
|
41
40
|
* @return {Promise<void>} a promise that resolves when the content is deleted
|
|
42
41
|
*/
|
|
43
|
-
delete(targetId: string
|
|
42
|
+
delete(targetId: string): Promise<void>;
|
|
44
43
|
}
|
|
@@ -8,6 +8,9 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
8
8
|
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
9
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
10
|
};
|
|
11
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
+
};
|
|
11
14
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
12
15
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
13
16
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -22,8 +25,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
22
25
|
exports.ContentService = void 0;
|
|
23
26
|
const common_1 = require("@nestjs/common");
|
|
24
27
|
const config_1 = require("@nestjs/config");
|
|
25
|
-
const
|
|
26
|
-
const
|
|
28
|
+
const axios_1 = require("../../axios");
|
|
29
|
+
const env_1 = require("../../env");
|
|
30
|
+
const pipes_1 = require("../../pipes");
|
|
27
31
|
/**
|
|
28
32
|
* Content service
|
|
29
33
|
* @class ContentService
|
|
@@ -33,12 +37,13 @@ let ContentService = ContentService_1 = class ContentService {
|
|
|
33
37
|
* Constructor
|
|
34
38
|
* @param configService - the config service
|
|
35
39
|
*/
|
|
36
|
-
constructor(configService) {
|
|
40
|
+
constructor(configService, target) {
|
|
37
41
|
this.configService = configService;
|
|
42
|
+
this.target = target;
|
|
38
43
|
/** The Logger instance */
|
|
39
44
|
this.logger = new common_1.Logger(ContentService_1.name);
|
|
40
45
|
/** The axios instance */
|
|
41
|
-
this.axios = (0,
|
|
46
|
+
this.axios = (0, axios_1.createAxios)({
|
|
42
47
|
baseUrl: 'https://services.svi-itlab.com/content/internal/',
|
|
43
48
|
k8sToken: this.configService.getOrThrow(env_1.ENV_K8S_TOKEN),
|
|
44
49
|
});
|
|
@@ -72,21 +77,20 @@ let ContentService = ContentService_1 = class ContentService {
|
|
|
72
77
|
*
|
|
73
78
|
* @param {string} targetId - the ID of the target
|
|
74
79
|
* @param {Content} content - the content to be posted
|
|
75
|
-
* @param {Targets} target - the target to post content
|
|
76
80
|
* @return {Promise<string>}
|
|
77
81
|
*/
|
|
78
|
-
post(targetId, content
|
|
82
|
+
post(targetId, content) {
|
|
79
83
|
return __awaiter(this, void 0, void 0, function* () {
|
|
80
|
-
this.logger.log(`Posting content of ${target} (${targetId})`);
|
|
84
|
+
this.logger.log(`Posting content of ${this.target} (${targetId})`);
|
|
81
85
|
return new Promise((resolve, reject) => {
|
|
82
86
|
this.axios
|
|
83
|
-
.post(`${target}/${targetId}`, { content })
|
|
87
|
+
.post(`${this.target}/${targetId}`, { content })
|
|
84
88
|
.then(() => {
|
|
85
|
-
this.logger.log(`Content of ${target} (${targetId}) posted`);
|
|
89
|
+
this.logger.log(`Content of ${this.target} (${targetId}) posted`);
|
|
86
90
|
resolve();
|
|
87
91
|
})
|
|
88
92
|
.catch(({ response }) => {
|
|
89
|
-
this.logger.error(`Couldn't post content of ${target} (${targetId})...`, response.data);
|
|
93
|
+
this.logger.error(`Couldn't post content of ${this.target} (${targetId})...`, response.data);
|
|
90
94
|
reject(new common_1.HttpException(response.data, response.status));
|
|
91
95
|
});
|
|
92
96
|
});
|
|
@@ -96,21 +100,20 @@ let ContentService = ContentService_1 = class ContentService {
|
|
|
96
100
|
* Deletes content of the specified target.
|
|
97
101
|
*
|
|
98
102
|
* @param {string} targetId - the ID of the target
|
|
99
|
-
* @param {Targets} target - the target to delete content from
|
|
100
103
|
* @return {Promise<void>} a promise that resolves when the content is deleted
|
|
101
104
|
*/
|
|
102
|
-
delete(targetId
|
|
105
|
+
delete(targetId) {
|
|
103
106
|
return __awaiter(this, void 0, void 0, function* () {
|
|
104
|
-
this.logger.log(`Deleting content of ${target} (${targetId})`);
|
|
107
|
+
this.logger.log(`Deleting content of ${this.target} (${targetId})`);
|
|
105
108
|
return new Promise((resolve, reject) => {
|
|
106
109
|
this.axios
|
|
107
|
-
.delete(`${target}/${targetId}`)
|
|
110
|
+
.delete(`${this.target}/${targetId}`)
|
|
108
111
|
.then(() => {
|
|
109
|
-
this.logger.log(`Content of ${target} (${targetId}) deleted`);
|
|
112
|
+
this.logger.log(`Content of ${this.target} (${targetId}) deleted`);
|
|
110
113
|
resolve();
|
|
111
114
|
})
|
|
112
115
|
.catch(({ response }) => {
|
|
113
|
-
this.logger.error(`Couldn't delete content of ${target} (${targetId})...`, response.data);
|
|
116
|
+
this.logger.error(`Couldn't delete content of ${this.target} (${targetId})...`, response.data);
|
|
114
117
|
reject(new common_1.HttpException(response.data, response.status));
|
|
115
118
|
});
|
|
116
119
|
});
|
|
@@ -119,6 +122,7 @@ let ContentService = ContentService_1 = class ContentService {
|
|
|
119
122
|
};
|
|
120
123
|
ContentService = ContentService_1 = __decorate([
|
|
121
124
|
(0, common_1.Injectable)(),
|
|
122
|
-
|
|
125
|
+
__param(1, (0, common_1.Inject)('CONTENT_TARGET')),
|
|
126
|
+
__metadata("design:paramtypes", [config_1.ConfigService, String])
|
|
123
127
|
], ContentService);
|
|
124
128
|
exports.ContentService = ContentService;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ContentService = exports.ContentModule = void 0;
|
|
4
|
+
var content_module_1 = require("./content.module");
|
|
5
|
+
Object.defineProperty(exports, "ContentModule", { enumerable: true, get: function () { return content_module_1.ContentModule; } });
|
|
6
|
+
var content_service_1 = require("./content.service");
|
|
7
|
+
Object.defineProperty(exports, "ContentService", { enumerable: true, get: function () { return content_service_1.ContentService; } });
|
package/dist/modules/index.d.ts
CHANGED
package/dist/modules/index.js
CHANGED
|
@@ -14,7 +14,11 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./account"), exports);
|
|
17
18
|
__exportStar(require("./authentication"), exports);
|
|
19
|
+
__exportStar(require("./comment"), exports);
|
|
20
|
+
__exportStar(require("./content"), exports);
|
|
18
21
|
__exportStar(require("./database"), exports);
|
|
19
22
|
__exportStar(require("./like"), exports);
|
|
20
|
-
__exportStar(require("./
|
|
23
|
+
__exportStar(require("./mail"), exports);
|
|
24
|
+
__exportStar(require("./search"), exports);
|
|
@@ -14,5 +14,5 @@ export declare class LikeModule {
|
|
|
14
14
|
* @param {string | string[]} prefix - the prefix for the LikeController (Defaults to "like")
|
|
15
15
|
* @return {DynamicModule} the LikeModule generated for the given schema
|
|
16
16
|
*/
|
|
17
|
-
static forFeature(schema: Schema<LikeableDocument>, prefix
|
|
17
|
+
static forFeature(schema: Schema<LikeableDocument>, ...prefix: string[]): DynamicModule;
|
|
18
18
|
}
|
|
@@ -24,11 +24,11 @@ class LikeModule {
|
|
|
24
24
|
* @param {string | string[]} prefix - the prefix for the LikeController (Defaults to "like")
|
|
25
25
|
* @return {DynamicModule} the LikeModule generated for the given schema
|
|
26
26
|
*/
|
|
27
|
-
static forFeature(schema, prefix
|
|
27
|
+
static forFeature(schema, ...prefix) {
|
|
28
28
|
let LikeController = class LikeController extends like_controller_1.LikeController {
|
|
29
29
|
};
|
|
30
30
|
LikeController = __decorate([
|
|
31
|
-
(0, common_1.Controller)(prefix)
|
|
31
|
+
(0, common_1.Controller)(prefix.concat('like').join('/'))
|
|
32
32
|
], LikeController);
|
|
33
33
|
let LikeModuleTemplate = class LikeModuleTemplate {
|
|
34
34
|
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MailService = exports.MailModule = exports.MailWeeklyDagoBERTSummary = exports.MailDagoBERTDowntime = void 0;
|
|
4
|
+
var mail_models_1 = require("./mail.models");
|
|
5
|
+
Object.defineProperty(exports, "MailDagoBERTDowntime", { enumerable: true, get: function () { return mail_models_1.MailDagoBERTDowntime; } });
|
|
6
|
+
Object.defineProperty(exports, "MailWeeklyDagoBERTSummary", { enumerable: true, get: function () { return mail_models_1.MailWeeklyDagoBERTSummary; } });
|
|
7
|
+
var mail_module_1 = require("./mail.module");
|
|
8
|
+
Object.defineProperty(exports, "MailModule", { enumerable: true, get: function () { return mail_module_1.MailModule; } });
|
|
9
|
+
var mail_service_1 = require("./mail.service");
|
|
10
|
+
Object.defineProperty(exports, "MailService", { enumerable: true, get: function () { return mail_service_1.MailService; } });
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { DynamicModule } from '@nestjs/common';
|
|
2
|
+
/**
|
|
3
|
+
* Mail module
|
|
4
|
+
* @class MailModule
|
|
5
|
+
*/
|
|
6
|
+
export declare class MailModule {
|
|
7
|
+
/**
|
|
8
|
+
* Creates a global MailModule
|
|
9
|
+
* @returns {DynamicModule} MailModule
|
|
10
|
+
*/
|
|
11
|
+
static forRoot(): DynamicModule;
|
|
12
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
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 MailModule_1;
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.MailModule = void 0;
|
|
11
|
+
const common_1 = require("@nestjs/common");
|
|
12
|
+
const mail_service_1 = require("./mail.service");
|
|
13
|
+
/**
|
|
14
|
+
* Mail module
|
|
15
|
+
* @class MailModule
|
|
16
|
+
*/
|
|
17
|
+
let MailModule = MailModule_1 = class MailModule {
|
|
18
|
+
/**
|
|
19
|
+
* Creates a global MailModule
|
|
20
|
+
* @returns {DynamicModule} MailModule
|
|
21
|
+
*/
|
|
22
|
+
static forRoot() {
|
|
23
|
+
return {
|
|
24
|
+
global: true,
|
|
25
|
+
module: MailModule_1,
|
|
26
|
+
providers: [mail_service_1.MailService],
|
|
27
|
+
exports: [mail_service_1.MailService],
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
MailModule = MailModule_1 = __decorate([
|
|
32
|
+
(0, common_1.Module)({})
|
|
33
|
+
], MailModule);
|
|
34
|
+
exports.MailModule = MailModule;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ConfigService } from '@nestjs/config';
|
|
2
|
-
import { MailDagoBERTDowntime, MailWeeklyDagoBERTSummary } from './mail
|
|
2
|
+
import { MailDagoBERTDowntime, MailWeeklyDagoBERTSummary } from './mail.models';
|
|
3
3
|
/**
|
|
4
4
|
* Mail service
|
|
5
5
|
* @class MailService
|
|
@@ -13,8 +13,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
13
13
|
exports.MailService = void 0;
|
|
14
14
|
const common_1 = require("@nestjs/common");
|
|
15
15
|
const config_1 = require("@nestjs/config");
|
|
16
|
-
const
|
|
17
|
-
const
|
|
16
|
+
const axios_1 = require("../../axios");
|
|
17
|
+
const env_1 = require("../../env");
|
|
18
18
|
/**
|
|
19
19
|
* Mail service
|
|
20
20
|
* @class MailService
|
|
@@ -29,7 +29,7 @@ let MailService = MailService_1 = class MailService {
|
|
|
29
29
|
/** The Logger instance */
|
|
30
30
|
this.logger = new common_1.Logger(MailService_1.name);
|
|
31
31
|
/** The axios instance */
|
|
32
|
-
this.axios = (0,
|
|
32
|
+
this.axios = (0, axios_1.createAxios)({
|
|
33
33
|
baseUrl: 'https://services.svi-itlab.com/email/internal/',
|
|
34
34
|
k8sToken: this.configService.getOrThrow(env_1.ENV_K8S_TOKEN),
|
|
35
35
|
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SearchService = exports.SearchModule = exports.SearchableDocument = void 0;
|
|
4
|
+
var search_models_1 = require("./search.models");
|
|
5
|
+
Object.defineProperty(exports, "SearchableDocument", { enumerable: true, get: function () { return search_models_1.SearchableDocument; } });
|
|
6
|
+
var search_module_1 = require("./search.module");
|
|
7
|
+
Object.defineProperty(exports, "SearchModule", { enumerable: true, get: function () { return search_module_1.SearchModule; } });
|
|
8
|
+
var search_service_1 = require("./search.service");
|
|
9
|
+
Object.defineProperty(exports, "SearchService", { enumerable: true, get: function () { return search_service_1.SearchService; } });
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { DynamicModule } from '@nestjs/common';
|
|
2
|
+
import { Targets } from '../../pipes';
|
|
3
|
+
/**
|
|
4
|
+
* Search module
|
|
5
|
+
* @class SearchModule
|
|
6
|
+
*/
|
|
7
|
+
export declare class SearchModule {
|
|
8
|
+
/**
|
|
9
|
+
* Creates a global SearchModule
|
|
10
|
+
* @returns {DynamicModule} SearchModule
|
|
11
|
+
*/
|
|
12
|
+
static forRoot(target: Targets): DynamicModule;
|
|
13
|
+
/**
|
|
14
|
+
* Creates a local SearchModule
|
|
15
|
+
* @returns {DynamicModule} SearchModule
|
|
16
|
+
*/
|
|
17
|
+
static register(target: Targets): DynamicModule;
|
|
18
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
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 SearchModule_1;
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.SearchModule = void 0;
|
|
11
|
+
const common_1 = require("@nestjs/common");
|
|
12
|
+
const search_service_1 = require("./search.service");
|
|
13
|
+
/**
|
|
14
|
+
* Search module
|
|
15
|
+
* @class SearchModule
|
|
16
|
+
*/
|
|
17
|
+
let SearchModule = SearchModule_1 = class SearchModule {
|
|
18
|
+
/**
|
|
19
|
+
* Creates a global SearchModule
|
|
20
|
+
* @returns {DynamicModule} SearchModule
|
|
21
|
+
*/
|
|
22
|
+
static forRoot(target) {
|
|
23
|
+
return {
|
|
24
|
+
global: true,
|
|
25
|
+
module: SearchModule_1,
|
|
26
|
+
providers: [search_service_1.SearchService, { provide: 'SEARCH_TARGET', useValue: target }],
|
|
27
|
+
exports: [search_service_1.SearchService],
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Creates a local SearchModule
|
|
32
|
+
* @returns {DynamicModule} SearchModule
|
|
33
|
+
*/
|
|
34
|
+
static register(target) {
|
|
35
|
+
return {
|
|
36
|
+
global: true,
|
|
37
|
+
module: SearchModule_1,
|
|
38
|
+
providers: [search_service_1.SearchService, { provide: 'SEARCH_TARGET', useValue: target }],
|
|
39
|
+
exports: [search_service_1.SearchService],
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
SearchModule = SearchModule_1 = __decorate([
|
|
44
|
+
(0, common_1.Module)({})
|
|
45
|
+
], SearchModule);
|
|
46
|
+
exports.SearchModule = SearchModule;
|
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
import { ConfigService } from '@nestjs/config';
|
|
2
|
-
import { Targets } from '
|
|
3
|
-
import { SearchableDocument } from './search
|
|
2
|
+
import { Targets } from '../../pipes';
|
|
3
|
+
import { SearchableDocument } from './search.models';
|
|
4
4
|
/**
|
|
5
5
|
* Search service
|
|
6
6
|
* @class SearchService
|
|
7
7
|
*/
|
|
8
8
|
export declare class SearchService {
|
|
9
9
|
private readonly configService;
|
|
10
|
+
private readonly target;
|
|
10
11
|
/** The Logger instance */
|
|
11
12
|
private logger;
|
|
12
13
|
/**
|
|
13
14
|
* Constructor
|
|
14
15
|
* @param configService - the config service
|
|
15
16
|
*/
|
|
16
|
-
constructor(configService: ConfigService);
|
|
17
|
+
constructor(configService: ConfigService, target: Targets);
|
|
17
18
|
/** The axios instance */
|
|
18
19
|
private axios;
|
|
19
20
|
/**
|
|
@@ -21,16 +22,14 @@ export declare class SearchService {
|
|
|
21
22
|
*
|
|
22
23
|
* @param {string} targetId - the ID of the target
|
|
23
24
|
* @param {SearchableDocument} document - the document to be indexed/updated
|
|
24
|
-
* @param {Targets} target - the target for indexing
|
|
25
25
|
* @return {void}
|
|
26
26
|
*/
|
|
27
|
-
index(targetId: string, document: SearchableDocument
|
|
27
|
+
index(targetId: string, document: SearchableDocument): void;
|
|
28
28
|
/**
|
|
29
29
|
* Remove a document from elasticsearch
|
|
30
30
|
*
|
|
31
31
|
* @param {string} targetId - the ID of the target to be removed
|
|
32
|
-
* @param {Targets} target - the type of target to be removed
|
|
33
32
|
* @return {void}
|
|
34
33
|
*/
|
|
35
|
-
remove(targetId: string
|
|
34
|
+
remove(targetId: string): void;
|
|
36
35
|
}
|