itlab-internal-services 1.12.0 → 1.12.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.
- package/dist/pipes/target.pipe.d.ts +1 -2
- package/dist/pipes/target.pipe.js +0 -1
- package/dist/services/account.service.d.ts +0 -1
- package/dist/services/account.service.js +0 -10
- package/dist/services/comment.service.d.ts +1 -0
- package/dist/services/comment.service.js +19 -4
- package/dist/services/content.service.js +27 -6
- package/dist/services/mail.service.js +2 -1
- package/dist/services/search.service.js +6 -4
- package/package.json +1 -1
|
@@ -12,8 +12,7 @@ export declare enum Targets {
|
|
|
12
12
|
HACKSCHOOL_COURSE = "hackschool-course",
|
|
13
13
|
TEAM_MEMBER = "team-member",
|
|
14
14
|
HUB_USER = "hub-user",
|
|
15
|
-
HUB_FILE = "hub-file"
|
|
16
|
-
UNKNOWN = "unknown"
|
|
15
|
+
HUB_FILE = "hub-file"
|
|
17
16
|
}
|
|
18
17
|
export declare class InvalidTargetException extends HttpException {
|
|
19
18
|
constructor(param: string);
|
|
@@ -18,7 +18,6 @@ var Targets;
|
|
|
18
18
|
Targets["TEAM_MEMBER"] = "team-member";
|
|
19
19
|
Targets["HUB_USER"] = "hub-user";
|
|
20
20
|
Targets["HUB_FILE"] = "hub-file";
|
|
21
|
-
Targets["UNKNOWN"] = "unknown";
|
|
22
21
|
})(Targets = exports.Targets || (exports.Targets = {}));
|
|
23
22
|
function generateExamples() {
|
|
24
23
|
const map = {};
|
|
@@ -33,16 +33,6 @@ let AccountService = class AccountService {
|
|
|
33
33
|
this.instance = instance;
|
|
34
34
|
this.prefix = 'account/internal';
|
|
35
35
|
}
|
|
36
|
-
create(accountId, email) {
|
|
37
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
38
|
-
return new Promise((resolve, reject) => {
|
|
39
|
-
this.instance
|
|
40
|
-
.post(`${this.prefix}`, { accountId, email })
|
|
41
|
-
.then(() => resolve())
|
|
42
|
-
.catch(({ response }) => reject(new common_1.HttpException(response.data, response.status)));
|
|
43
|
-
});
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
36
|
get(accountId) {
|
|
47
37
|
return __awaiter(this, void 0, void 0, function* () {
|
|
48
38
|
return new Promise((resolve) => {
|
|
@@ -9,6 +9,7 @@ export declare class Comment {
|
|
|
9
9
|
export declare class CommentService {
|
|
10
10
|
protected readonly instance: AxiosInstance;
|
|
11
11
|
constructor(instance?: AxiosInstance);
|
|
12
|
+
private logger;
|
|
12
13
|
protected prefix: string;
|
|
13
14
|
post(targetId: string, authorId: string, comment: ContentRichtext, target: Targets): Promise<Comment>;
|
|
14
15
|
delete(targetId: string, target: Targets): Promise<void>;
|
|
@@ -47,25 +47,40 @@ exports.Comment = Comment;
|
|
|
47
47
|
let CommentService = class CommentService {
|
|
48
48
|
constructor(instance = axios_1.default) {
|
|
49
49
|
this.instance = instance;
|
|
50
|
+
this.logger = new common_1.Logger(CommentService.name);
|
|
50
51
|
this.prefix = 'comment/internal';
|
|
51
52
|
}
|
|
52
53
|
post(targetId, authorId, comment, target) {
|
|
53
54
|
return __awaiter(this, void 0, void 0, function* () {
|
|
55
|
+
this.logger.log(`Posting comment for ${target} (${targetId}) by ${authorId}`);
|
|
54
56
|
return new Promise((resolve, reject) => {
|
|
55
57
|
this.instance
|
|
56
58
|
.post(`${this.prefix}/${target}/${targetId}/${authorId}`, comment)
|
|
57
|
-
.then(({ data }) =>
|
|
58
|
-
.
|
|
59
|
+
.then(({ data }) => {
|
|
60
|
+
this.logger.log(`Comment for ${target} (${targetId}) posted`);
|
|
61
|
+
resolve(data);
|
|
62
|
+
})
|
|
63
|
+
.catch(({ response }) => {
|
|
64
|
+
this.logger.error(`Couldn't post comment for ${target} (${targetId})`, response.data);
|
|
65
|
+
reject(new common_1.HttpException(response.data, response.status));
|
|
66
|
+
});
|
|
59
67
|
});
|
|
60
68
|
});
|
|
61
69
|
}
|
|
62
70
|
delete(targetId, target) {
|
|
63
71
|
return __awaiter(this, void 0, void 0, function* () {
|
|
72
|
+
this.logger.log(`Deleting all comments for ${target} (${targetId})`);
|
|
64
73
|
return new Promise((resolve, reject) => {
|
|
65
74
|
this.instance
|
|
66
75
|
.delete(`${this.prefix}/${target}/${targetId}`)
|
|
67
|
-
.then(() =>
|
|
68
|
-
.
|
|
76
|
+
.then(() => {
|
|
77
|
+
this.logger.log(`All comments for ${target} (${targetId}) deleted`);
|
|
78
|
+
resolve();
|
|
79
|
+
})
|
|
80
|
+
.catch(({ response }) => {
|
|
81
|
+
this.logger.error(`Couldn't delete all comments for ${target} (${targetId})`, response.data);
|
|
82
|
+
reject(new common_1.HttpException(response.data, response.status));
|
|
83
|
+
});
|
|
69
84
|
});
|
|
70
85
|
});
|
|
71
86
|
}
|
|
@@ -36,31 +36,52 @@ let ContentService = class ContentService {
|
|
|
36
36
|
}
|
|
37
37
|
verify(content) {
|
|
38
38
|
return __awaiter(this, void 0, void 0, function* () {
|
|
39
|
+
this.logger.log('Verifing content');
|
|
39
40
|
return new Promise((resolve, reject) => {
|
|
40
41
|
this.instance
|
|
41
42
|
.post(`${this.prefix}/verify`, { content })
|
|
42
|
-
.then(() =>
|
|
43
|
-
.
|
|
43
|
+
.then(() => {
|
|
44
|
+
this.logger.log('Content is valid');
|
|
45
|
+
resolve();
|
|
46
|
+
})
|
|
47
|
+
.catch(({ response }) => {
|
|
48
|
+
this.logger.error('Content is invalid', response.data);
|
|
49
|
+
reject(new common_1.HttpException(response.data, response.status));
|
|
50
|
+
});
|
|
44
51
|
});
|
|
45
52
|
});
|
|
46
53
|
}
|
|
47
54
|
post(targetId, content, target) {
|
|
48
55
|
return __awaiter(this, void 0, void 0, function* () {
|
|
56
|
+
this.logger.log(`Posting content of ${target} (${targetId})`);
|
|
49
57
|
return new Promise((resolve, reject) => {
|
|
50
58
|
this.instance
|
|
51
59
|
.post(`${this.prefix}/${target}/${targetId}`, { content })
|
|
52
|
-
.then(({ data }) =>
|
|
53
|
-
.
|
|
60
|
+
.then(({ data }) => {
|
|
61
|
+
this.logger.log(`Content of ${target} (${targetId}) posted`);
|
|
62
|
+
resolve(data);
|
|
63
|
+
})
|
|
64
|
+
.catch(({ response }) => {
|
|
65
|
+
this.logger.error(`Couldn't post content of ${target} (${targetId})...`, response.data);
|
|
66
|
+
reject(new common_1.HttpException(response.data, response.status));
|
|
67
|
+
});
|
|
54
68
|
});
|
|
55
69
|
});
|
|
56
70
|
}
|
|
57
71
|
delete(targetId, target) {
|
|
58
72
|
return __awaiter(this, void 0, void 0, function* () {
|
|
73
|
+
this.logger.log(`Deleting content of ${target} (${targetId})`);
|
|
59
74
|
return new Promise((resolve, reject) => {
|
|
60
75
|
this.instance
|
|
61
76
|
.delete(`${this.prefix}/${target}/${targetId}`)
|
|
62
|
-
.then(() =>
|
|
63
|
-
.
|
|
77
|
+
.then(() => {
|
|
78
|
+
this.logger.log(`Content of ${target} (${targetId}) deleted`);
|
|
79
|
+
resolve();
|
|
80
|
+
})
|
|
81
|
+
.catch(({ response }) => {
|
|
82
|
+
this.logger.error(`Couldn't delete content of ${target} (${targetId})...`, response.data);
|
|
83
|
+
reject(new common_1.HttpException(response.data, response.status));
|
|
84
|
+
});
|
|
64
85
|
});
|
|
65
86
|
});
|
|
66
87
|
}
|
|
@@ -26,10 +26,11 @@ let MailService = class MailService {
|
|
|
26
26
|
this.prefix = 'email/internal';
|
|
27
27
|
}
|
|
28
28
|
sendToken(token, address) {
|
|
29
|
+
this.logger.log('Sending token');
|
|
29
30
|
this.instance
|
|
30
31
|
.post(`${this.prefix}/token`, { token, address })
|
|
31
32
|
.then(() => this.logger.log('Token sent'))
|
|
32
|
-
.catch((
|
|
33
|
+
.catch(({ response }) => this.logger.error("Couldn't send token...", response.data));
|
|
33
34
|
}
|
|
34
35
|
};
|
|
35
36
|
MailService = __decorate([
|
|
@@ -46,16 +46,18 @@ let SearchService = class SearchService {
|
|
|
46
46
|
this.prefix = 'search/internal';
|
|
47
47
|
}
|
|
48
48
|
index(targetId, document, target) {
|
|
49
|
+
this.logger.log(`Indexing ${target} (${targetId})`);
|
|
49
50
|
this.instance
|
|
50
51
|
.post(`${this.prefix}/${target}/${targetId}`, document)
|
|
51
|
-
.then(() => this.logger.log(`Sucessfully indexed ${
|
|
52
|
-
.catch((
|
|
52
|
+
.then(() => this.logger.log(`Sucessfully indexed ${target} (${targetId})`))
|
|
53
|
+
.catch(({ response }) => this.logger.error(`Couldn't index ${target} (${targetId})`, response.data));
|
|
53
54
|
}
|
|
54
55
|
remove(targetId, target) {
|
|
56
|
+
this.logger.log(`Removing ${target} (${targetId})`);
|
|
55
57
|
this.instance
|
|
56
58
|
.delete(`${this.prefix}/${target}/${targetId}`)
|
|
57
|
-
.then(() => this.logger.log(`Sucessfully removed ${
|
|
58
|
-
.catch((
|
|
59
|
+
.then(() => this.logger.log(`Sucessfully removed ${target} (${targetId})`))
|
|
60
|
+
.catch(({ response }) => this.logger.error(`Couldn't remove ${target} (${targetId})`, response.data));
|
|
59
61
|
}
|
|
60
62
|
};
|
|
61
63
|
SearchService = __decorate([
|