@things-factory/board-service 9.0.0-beta.8 → 9.0.0
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-server/controllers/analyzer/analyze-integration.js +4 -4
- package/dist-server/controllers/analyzer/analyze-integration.js.map +1 -1
- package/dist-server/controllers/fonts.js +12 -9
- package/dist-server/controllers/fonts.js.map +1 -1
- package/dist-server/controllers/headless-model.d.ts +1 -1
- package/dist-server/controllers/headless-model.js +6 -6
- package/dist-server/controllers/headless-model.js.map +1 -1
- package/dist-server/controllers/headless-playlist.d.ts +1 -1
- package/dist-server/controllers/headless-playlist.js +5 -5
- package/dist-server/controllers/headless-playlist.js.map +1 -1
- package/dist-server/controllers/headless-pool-for-label.js +4 -17
- package/dist-server/controllers/headless-pool-for-label.js.map +1 -1
- package/dist-server/controllers/index.d.ts +1 -1
- package/dist-server/controllers/index.js +8 -8
- package/dist-server/controllers/index.js.map +1 -1
- package/dist-server/controllers/label-command.js +5 -5
- package/dist-server/controllers/label-command.js.map +1 -1
- package/dist-server/controllers/pdf.d.ts +9 -1
- package/dist-server/controllers/pdf.js +18 -11
- package/dist-server/controllers/pdf.js.map +1 -1
- package/dist-server/controllers/screenshot.js +14 -10
- package/dist-server/controllers/screenshot.js.map +1 -1
- package/dist-server/controllers/thumbnail.js +2 -2
- package/dist-server/controllers/thumbnail.js.map +1 -1
- package/dist-server/errors/index.d.ts +1 -1
- package/dist-server/errors/index.js +1 -1
- package/dist-server/errors/index.js.map +1 -1
- package/dist-server/errors/license-error.js +4 -2
- package/dist-server/errors/license-error.js.map +1 -1
- package/dist-server/index.d.ts +4 -4
- package/dist-server/index.js +4 -4
- package/dist-server/index.js.map +1 -1
- package/dist-server/migrations/1556862253000-SeedGroup.js +7 -4
- package/dist-server/migrations/1556862253000-SeedGroup.js.map +1 -1
- package/dist-server/routers/internal-board-view-router.js +1 -1
- package/dist-server/routers/internal-board-view-router.js.map +1 -1
- package/dist-server/routers/standalone-board-service-router.js +41 -41
- package/dist-server/routers/standalone-board-service-router.js.map +1 -1
- package/dist-server/routes.js +12 -10
- package/dist-server/routes.js.map +1 -1
- package/dist-server/service/analysis/analysis-query.js +2 -2
- package/dist-server/service/analysis/analysis-query.js.map +1 -1
- package/dist-server/service/analysis/index.d.ts +1 -1
- package/dist-server/service/analysis/index.js +2 -2
- package/dist-server/service/analysis/index.js.map +1 -1
- package/dist-server/service/board/board-history.d.ts +4 -3
- package/dist-server/service/board/board-history.js +35 -20
- package/dist-server/service/board/board-history.js.map +1 -1
- package/dist-server/service/board/board-mutation.d.ts +2 -2
- package/dist-server/service/board/board-mutation.js +112 -53
- package/dist-server/service/board/board-mutation.js.map +1 -1
- package/dist-server/service/board/board-query.d.ts +5 -5
- package/dist-server/service/board/board-query.js +40 -39
- package/dist-server/service/board/board-query.js.map +1 -1
- package/dist-server/service/board/board-subscription.d.ts +1 -1
- package/dist-server/service/board/board-subscription.js +6 -6
- package/dist-server/service/board/board-subscription.js.map +1 -1
- package/dist-server/service/board/board-type.d.ts +4 -2
- package/dist-server/service/board/board-type.js +28 -20
- package/dist-server/service/board/board-type.js.map +1 -1
- package/dist-server/service/board/board.d.ts +3 -2
- package/dist-server/service/board/board.js +26 -21
- package/dist-server/service/board/board.js.map +1 -1
- package/dist-server/service/board/event-subscriber.d.ts +5 -5
- package/dist-server/service/board/event-subscriber.js +8 -8
- package/dist-server/service/board/event-subscriber.js.map +1 -1
- package/dist-server/service/board/index.d.ts +6 -6
- package/dist-server/service/board/index.js +9 -9
- package/dist-server/service/board/index.js.map +1 -1
- package/dist-server/service/board-favorite/board-favorite-query.d.ts +1 -1
- package/dist-server/service/board-favorite/board-favorite-query.js +5 -5
- package/dist-server/service/board-favorite/board-favorite-query.js.map +1 -1
- package/dist-server/service/board-favorite/board-favorite-type.d.ts +1 -1
- package/dist-server/service/board-favorite/board-favorite-type.js +7 -7
- package/dist-server/service/board-favorite/board-favorite-type.js.map +1 -1
- package/dist-server/service/board-favorite/index.d.ts +1 -1
- package/dist-server/service/board-favorite/index.js +2 -2
- package/dist-server/service/board-favorite/index.js.map +1 -1
- package/dist-server/service/board-template/board-template-mutation.d.ts +2 -2
- package/dist-server/service/board-template/board-template-mutation.js +43 -25
- package/dist-server/service/board-template/board-template-mutation.js.map +1 -1
- package/dist-server/service/board-template/board-template-query.d.ts +2 -2
- package/dist-server/service/board-template/board-template-query.js +13 -13
- package/dist-server/service/board-template/board-template-query.js.map +1 -1
- package/dist-server/service/board-template/board-template-type.d.ts +1 -1
- package/dist-server/service/board-template/board-template-type.js +21 -18
- package/dist-server/service/board-template/board-template-type.js.map +1 -1
- package/dist-server/service/board-template/board-template.js +14 -14
- package/dist-server/service/board-template/board-template.js.map +1 -1
- package/dist-server/service/board-template/index.d.ts +3 -3
- package/dist-server/service/board-template/index.js +5 -5
- package/dist-server/service/board-template/index.js.map +1 -1
- package/dist-server/service/group/group-mutation.d.ts +2 -2
- package/dist-server/service/group/group-mutation.js +25 -16
- package/dist-server/service/group/group-mutation.js.map +1 -1
- package/dist-server/service/group/group-query.d.ts +3 -3
- package/dist-server/service/group/group-query.js +17 -17
- package/dist-server/service/group/group-query.js.map +1 -1
- package/dist-server/service/group/group-type.d.ts +1 -1
- package/dist-server/service/group/group-type.js +10 -10
- package/dist-server/service/group/group-type.js.map +1 -1
- package/dist-server/service/group/group.d.ts +1 -1
- package/dist-server/service/group/group.js +12 -12
- package/dist-server/service/group/group.js.map +1 -1
- package/dist-server/service/group/index.d.ts +3 -3
- package/dist-server/service/group/index.js +5 -5
- package/dist-server/service/group/index.js.map +1 -1
- package/dist-server/service/index.d.ts +6 -6
- package/dist-server/service/index.js +31 -31
- package/dist-server/service/index.js.map +1 -1
- package/dist-server/service/permission/domain-permission-subscriber.js +3 -3
- package/dist-server/service/permission/domain-permission-subscriber.js.map +1 -1
- package/dist-server/service/permission/index.d.ts +1 -1
- package/dist-server/service/permission/index.js +2 -2
- package/dist-server/service/permission/index.js.map +1 -1
- package/dist-server/service/play-group/event-subscriber.d.ts +1 -1
- package/dist-server/service/play-group/event-subscriber.js +3 -3
- package/dist-server/service/play-group/event-subscriber.js.map +1 -1
- package/dist-server/service/play-group/index.d.ts +5 -5
- package/dist-server/service/play-group/index.js +8 -8
- package/dist-server/service/play-group/index.js.map +1 -1
- package/dist-server/service/play-group/play-group-mutation.d.ts +2 -2
- package/dist-server/service/play-group/play-group-mutation.js +35 -22
- package/dist-server/service/play-group/play-group-mutation.js.map +1 -1
- package/dist-server/service/play-group/play-group-query.d.ts +3 -3
- package/dist-server/service/play-group/play-group-query.js +20 -18
- package/dist-server/service/play-group/play-group-query.js.map +1 -1
- package/dist-server/service/play-group/play-group-subscription.d.ts +1 -1
- package/dist-server/service/play-group/play-group-subscription.js +6 -6
- package/dist-server/service/play-group/play-group-subscription.js.map +1 -1
- package/dist-server/service/play-group/play-group-type.d.ts +1 -1
- package/dist-server/service/play-group/play-group-type.js +10 -10
- package/dist-server/service/play-group/play-group-type.js.map +1 -1
- package/dist-server/service/play-group/play-group.d.ts +2 -2
- package/dist-server/service/play-group/play-group.js +17 -13
- package/dist-server/service/play-group/play-group.js.map +1 -1
- package/dist-server/service/theme/index.d.ts +3 -3
- package/dist-server/service/theme/index.js +5 -5
- package/dist-server/service/theme/index.js.map +1 -1
- package/dist-server/service/theme/theme-mutation.d.ts +2 -2
- package/dist-server/service/theme/theme-mutation.js +44 -24
- package/dist-server/service/theme/theme-mutation.js.map +1 -1
- package/dist-server/service/theme/theme-query.d.ts +2 -2
- package/dist-server/service/theme/theme-query.js +13 -13
- package/dist-server/service/theme/theme-query.js.map +1 -1
- package/dist-server/service/theme/theme-type.d.ts +1 -1
- package/dist-server/service/theme/theme-type.js +18 -18
- package/dist-server/service/theme/theme-type.js.map +1 -1
- package/dist-server/service/theme/theme.js +16 -13
- package/dist-server/service/theme/theme.js.map +1 -1
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/package.json +10 -9
- package/views/internal-board-full-feature-view.html +0 -1
- package/views/internal-board-player-view.html +0 -1
- package/views/internal-board-service-view.html +0 -1
|
@@ -4,14 +4,14 @@ exports.BoardTemplateMutation = void 0;
|
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const type_graphql_1 = require("type-graphql");
|
|
6
6
|
const shell_1 = require("@things-factory/shell");
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
const
|
|
7
|
+
const board_template_js_1 = require("./board-template.js");
|
|
8
|
+
const board_js_1 = require("../board/board.js");
|
|
9
|
+
const board_template_type_js_1 = require("./board-template-type.js");
|
|
10
|
+
const thumbnail_js_1 = require("../../controllers/thumbnail.js");
|
|
11
11
|
let BoardTemplateMutation = class BoardTemplateMutation {
|
|
12
12
|
async createBoardTemplate(boardTemplate, context) {
|
|
13
13
|
const { domain, user, tx } = context.state;
|
|
14
|
-
const repository =
|
|
14
|
+
const repository = (0, shell_1.getRepository)(board_template_js_1.BoardTemplate, tx);
|
|
15
15
|
const oldBoardTemplate = await repository.findOneBy({
|
|
16
16
|
name: boardTemplate.name,
|
|
17
17
|
domain: { id: domain.id }
|
|
@@ -19,8 +19,10 @@ let BoardTemplateMutation = class BoardTemplateMutation {
|
|
|
19
19
|
if (oldBoardTemplate) {
|
|
20
20
|
throw new Error(context.t('error.board-template name is already taken', { name: boardTemplate.name }));
|
|
21
21
|
}
|
|
22
|
-
const newBoardTemplate =
|
|
23
|
-
|
|
22
|
+
const newBoardTemplate = {
|
|
23
|
+
...boardTemplate
|
|
24
|
+
};
|
|
25
|
+
const base64 = await (0, thumbnail_js_1.thumbnail)({
|
|
24
26
|
model: boardTemplate.model,
|
|
25
27
|
context
|
|
26
28
|
});
|
|
@@ -30,16 +32,21 @@ let BoardTemplateMutation = class BoardTemplateMutation {
|
|
|
30
32
|
else {
|
|
31
33
|
newBoardTemplate.thumbnail = 'data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==';
|
|
32
34
|
}
|
|
33
|
-
return await repository.save(
|
|
35
|
+
return await repository.save({
|
|
36
|
+
domain,
|
|
37
|
+
...newBoardTemplate,
|
|
38
|
+
creator: user,
|
|
39
|
+
updater: user
|
|
40
|
+
});
|
|
34
41
|
}
|
|
35
42
|
async updateBoardTemplate(id, patch, context) {
|
|
36
43
|
const { domain, user, tx } = context.state;
|
|
37
|
-
const repository =
|
|
44
|
+
const repository = (0, shell_1.getRepository)(board_template_js_1.BoardTemplate, tx);
|
|
38
45
|
const boardTemplate = await repository.findOne({
|
|
39
46
|
where: { domain: { id: domain.id }, id }
|
|
40
47
|
});
|
|
41
48
|
if (patch.model) {
|
|
42
|
-
const base64 = await (0,
|
|
49
|
+
const base64 = await (0, thumbnail_js_1.thumbnail)({
|
|
43
50
|
model: patch.model,
|
|
44
51
|
context
|
|
45
52
|
});
|
|
@@ -50,30 +57,41 @@ let BoardTemplateMutation = class BoardTemplateMutation {
|
|
|
50
57
|
patch.thumbnail = 'data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==';
|
|
51
58
|
}
|
|
52
59
|
}
|
|
53
|
-
return await repository.save(
|
|
60
|
+
return await repository.save({
|
|
61
|
+
...boardTemplate,
|
|
62
|
+
...patch,
|
|
63
|
+
updater: user
|
|
64
|
+
});
|
|
54
65
|
}
|
|
55
66
|
async deleteBoardTemplate(id, context) {
|
|
56
67
|
const { domain, tx } = context.state;
|
|
57
|
-
await
|
|
68
|
+
await (0, shell_1.getRepository)(board_template_js_1.BoardTemplate, tx).delete({ domain: { id: domain.id }, id });
|
|
58
69
|
return true;
|
|
59
70
|
}
|
|
60
71
|
async registerBoardAsTemplate(id, name, description, visibility, context) {
|
|
61
72
|
const { domain, user, notify, tx } = context.state;
|
|
62
|
-
const boardTemplateRepository =
|
|
63
|
-
const board = await
|
|
73
|
+
const boardTemplateRepository = (0, shell_1.getRepository)(board_template_js_1.BoardTemplate, tx);
|
|
74
|
+
const board = await (0, shell_1.getRepository)(board_js_1.Board, tx).findOne({
|
|
64
75
|
where: { domain: { id: domain.id }, id }
|
|
65
76
|
});
|
|
66
77
|
if (!board) {
|
|
67
78
|
throw `Board given id(${id}) is not found`;
|
|
68
79
|
}
|
|
69
|
-
name
|
|
80
|
+
name ||= board.name;
|
|
70
81
|
const { model, thumbnail } = board;
|
|
71
82
|
const boardTemplate = await boardTemplateRepository.findOne({
|
|
72
83
|
where: { domain: { id: domain.id }, name }
|
|
73
84
|
});
|
|
74
85
|
const registered = boardTemplate
|
|
75
|
-
? await boardTemplateRepository.save(
|
|
76
|
-
|
|
86
|
+
? await boardTemplateRepository.save({
|
|
87
|
+
...boardTemplate,
|
|
88
|
+
name,
|
|
89
|
+
description: description || boardTemplate.description,
|
|
90
|
+
visibility: visibility || boardTemplate.visibility,
|
|
91
|
+
model,
|
|
92
|
+
thumbnail,
|
|
93
|
+
updater: user
|
|
94
|
+
})
|
|
77
95
|
: await boardTemplateRepository.save({
|
|
78
96
|
domain: { id: domain.id },
|
|
79
97
|
name,
|
|
@@ -89,8 +107,8 @@ let BoardTemplateMutation = class BoardTemplateMutation {
|
|
|
89
107
|
mode: 'in-app',
|
|
90
108
|
title: `BoardTemplate '${registered.name}' registered`,
|
|
91
109
|
body: `BoardTemplate '${registered.name}' registered by ${user.name}\n${registered.description}`,
|
|
92
|
-
image: (0, shell_1.getRedirectSubdomainPath)(context, domain
|
|
93
|
-
url: (0, shell_1.getRedirectSubdomainPath)(context, domain
|
|
110
|
+
image: (0, shell_1.getRedirectSubdomainPath)(context, domain, `/board-template-thumbnail/${registered.id}`),
|
|
111
|
+
url: (0, shell_1.getRedirectSubdomainPath)(context, domain, `/board-template-viewer/${registered.id}`)
|
|
94
112
|
});
|
|
95
113
|
return registered;
|
|
96
114
|
}
|
|
@@ -99,22 +117,22 @@ exports.BoardTemplateMutation = BoardTemplateMutation;
|
|
|
99
117
|
tslib_1.__decorate([
|
|
100
118
|
(0, type_graphql_1.Directive)('@transaction'),
|
|
101
119
|
(0, type_graphql_1.Directive)('@privilege(category: "board-template", privilege: "mutation", domainOwnerGranted: true)'),
|
|
102
|
-
(0, type_graphql_1.Mutation)(returns =>
|
|
120
|
+
(0, type_graphql_1.Mutation)(returns => board_template_js_1.BoardTemplate, { description: 'To create new BoardTemplate' }),
|
|
103
121
|
tslib_1.__param(0, (0, type_graphql_1.Arg)('boardTemplate')),
|
|
104
122
|
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
|
105
123
|
tslib_1.__metadata("design:type", Function),
|
|
106
|
-
tslib_1.__metadata("design:paramtypes", [
|
|
124
|
+
tslib_1.__metadata("design:paramtypes", [board_template_type_js_1.NewBoardTemplate, Object]),
|
|
107
125
|
tslib_1.__metadata("design:returntype", Promise)
|
|
108
126
|
], BoardTemplateMutation.prototype, "createBoardTemplate", null);
|
|
109
127
|
tslib_1.__decorate([
|
|
110
128
|
(0, type_graphql_1.Directive)('@transaction'),
|
|
111
129
|
(0, type_graphql_1.Directive)('@privilege(category: "board-template", privilege: "mutation", domainOwnerGranted: true)'),
|
|
112
|
-
(0, type_graphql_1.Mutation)(returns =>
|
|
130
|
+
(0, type_graphql_1.Mutation)(returns => board_template_js_1.BoardTemplate, { description: 'To modify BoardTemplate information' }),
|
|
113
131
|
tslib_1.__param(0, (0, type_graphql_1.Arg)('id')),
|
|
114
132
|
tslib_1.__param(1, (0, type_graphql_1.Arg)('patch')),
|
|
115
133
|
tslib_1.__param(2, (0, type_graphql_1.Ctx)()),
|
|
116
134
|
tslib_1.__metadata("design:type", Function),
|
|
117
|
-
tslib_1.__metadata("design:paramtypes", [String,
|
|
135
|
+
tslib_1.__metadata("design:paramtypes", [String, board_template_type_js_1.BoardTemplatePatch, Object]),
|
|
118
136
|
tslib_1.__metadata("design:returntype", Promise)
|
|
119
137
|
], BoardTemplateMutation.prototype, "updateBoardTemplate", null);
|
|
120
138
|
tslib_1.__decorate([
|
|
@@ -130,7 +148,7 @@ tslib_1.__decorate([
|
|
|
130
148
|
tslib_1.__decorate([
|
|
131
149
|
(0, type_graphql_1.Directive)('@transaction'),
|
|
132
150
|
(0, type_graphql_1.Directive)('@privilege(category: "board-template", privilege: "mutation", domainOwnerGranted: true)'),
|
|
133
|
-
(0, type_graphql_1.Mutation)(returns =>
|
|
151
|
+
(0, type_graphql_1.Mutation)(returns => board_template_js_1.BoardTemplate, { description: 'To register a board as a board template with the given ID' }),
|
|
134
152
|
tslib_1.__param(0, (0, type_graphql_1.Arg)('id', { description: 'board Id to be regiestered' })),
|
|
135
153
|
tslib_1.__param(1, (0, type_graphql_1.Arg)('name', { description: 'name of board template to be regiestered' })),
|
|
136
154
|
tslib_1.__param(2, (0, type_graphql_1.Arg)('description', { description: 'description of board template to be regiestered' })),
|
|
@@ -141,6 +159,6 @@ tslib_1.__decorate([
|
|
|
141
159
|
tslib_1.__metadata("design:returntype", Promise)
|
|
142
160
|
], BoardTemplateMutation.prototype, "registerBoardAsTemplate", null);
|
|
143
161
|
exports.BoardTemplateMutation = BoardTemplateMutation = tslib_1.__decorate([
|
|
144
|
-
(0, type_graphql_1.Resolver)(
|
|
162
|
+
(0, type_graphql_1.Resolver)(board_template_js_1.BoardTemplate)
|
|
145
163
|
], BoardTemplateMutation);
|
|
146
164
|
//# sourceMappingURL=board-template-mutation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"board-template-mutation.js","sourceRoot":"","sources":["../../../server/service/board-template/board-template-mutation.ts"],"names":[],"mappings":";;;;AAAA,+CAAsE;AAEtE,iDAAgE;AAChE,qDAAgD;AAChD,0CAAsC;AACtC,+DAA4E;AAC5E,2DAAuD;AAGhD,IAAM,qBAAqB,GAA3B,MAAM,qBAAqB;IAI1B,AAAN,KAAK,CAAC,mBAAmB,CACD,aAA+B,EAC9C,OAAwB;QAE/B,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAC1C,MAAM,UAAU,GAAG,EAAE,CAAC,aAAa,CAAC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A,wBAAS,EAAC,cAAc,CAAC;IACzB,IAAA,wBAAS,EAAC,yFAAyF,CAAC;IACpG,IAAA,uBAAQ,EAAC,OAAO,CAAC,EAAE,CAAC,8BAAa,EAAE,EAAE,WAAW,EAAE,2DAA2D,EAAE,CAAC;IAE9G,mBAAA,IAAA,kBAAG,EAAC,IAAI,EAAE,EAAE,WAAW,EAAE,4BAA4B,EAAE,CAAC,CAAA;IACxD,mBAAA,IAAA,kBAAG,EAAC,MAAM,EAAE,EAAE,WAAW,EAAE,0CAA0C,EAAE,CAAC,CAAA;IACxE,mBAAA,IAAA,kBAAG,EAAC,aAAa,EAAE,EAAE,WAAW,EAAE,iDAAiD,EAAE,CAAC,CAAA;IACtF,mBAAA,IAAA,kBAAG,EAAC,YAAY,EAAE,EAAE,WAAW,EAAE,gDAAgD,EAAE,CAAC,CAAA;IACpF,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;oEAqDP;gCAtJU,qBAAqB;IADjC,IAAA,uBAAQ,EAAC,8BAAa,CAAC;GACX,qBAAqB,CAuJjC","sourcesContent":["import { Resolver, Mutation, Arg, Ctx, Directive } from 'type-graphql'\n\nimport { getRedirectSubdomainPath } from '@things-factory/shell'\nimport { BoardTemplate } from './board-template'\nimport { Board } from '../board/board'\nimport { NewBoardTemplate, BoardTemplatePatch } from './board-template-type'\nimport { thumbnail } from '../../controllers/thumbnail'\n\n@Resolver(BoardTemplate)\nexport class BoardTemplateMutation {\n @Directive('@transaction')\n @Directive('@privilege(category: \"board-template\", privilege: \"mutation\", domainOwnerGranted: true)')\n @Mutation(returns => BoardTemplate, { description: 'To create new BoardTemplate' })\n async createBoardTemplate(\n @Arg('boardTemplate') boardTemplate: NewBoardTemplate,\n @Ctx() context: ResolverContext\n ): Promise<BoardTemplate> {\n const { domain, user, tx } = context.state\n const repository = tx.getRepository(BoardTemplate)\n\n const oldBoardTemplate: BoardTemplate = await repository.findOneBy({\n name: boardTemplate.name,\n domain: { id: domain.id }\n })\n\n if (oldBoardTemplate) {\n throw new Error(context.t('error.board-template name is already taken', { name: boardTemplate.name }))\n }\n\n const newBoardTemplate: Partial<BoardTemplate> = {\n ...boardTemplate\n }\n\n const base64 = await thumbnail({\n model: boardTemplate.model,\n context\n })\n\n if (base64) {\n newBoardTemplate.thumbnail = 'data:image/png;base64,' + base64.toString('base64')\n } else {\n newBoardTemplate.thumbnail = 'data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=='\n }\n\n return await repository.save({\n domain,\n ...newBoardTemplate,\n creator: user,\n updater: user\n })\n }\n\n @Directive('@transaction')\n @Directive('@privilege(category: \"board-template\", privilege: \"mutation\", domainOwnerGranted: true)')\n @Mutation(returns => BoardTemplate, { description: 'To modify BoardTemplate information' })\n async updateBoardTemplate(\n @Arg('id') id: string,\n @Arg('patch') patch: BoardTemplatePatch,\n @Ctx() context: ResolverContext\n ): Promise<BoardTemplate> {\n const { domain, user, tx } = context.state\n const repository = tx.getRepository(BoardTemplate)\n\n const boardTemplate = await repository.findOne({\n where: { domain: { id: domain.id }, id }\n })\n\n if (patch.model) {\n const base64 = await thumbnail({\n model: patch.model,\n context\n })\n\n if (base64) {\n patch.thumbnail = 'data:image/png;base64,' + base64.toString('base64')\n } else {\n patch.thumbnail = 'data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=='\n }\n }\n\n return await repository.save({\n ...boardTemplate,\n ...patch,\n updater: user\n })\n }\n\n @Directive('@transaction')\n @Directive('@privilege(category: \"board-template\", privilege: \"mutation\", domainOwnerGranted: true)')\n @Mutation(returns => Boolean, { description: 'To delete BoardTemplate' })\n async deleteBoardTemplate(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<boolean> {\n const { domain, tx } = context.state\n\n await tx.getRepository(BoardTemplate).delete({ domain: { id: domain.id }, id })\n\n return true\n }\n\n @Directive('@transaction')\n @Directive('@privilege(category: \"board-template\", privilege: \"mutation\", domainOwnerGranted: true)')\n @Mutation(returns => BoardTemplate, { description: 'To register a board as a board template with the given ID' })\n async registerBoardAsTemplate(\n @Arg('id', { description: 'board Id to be regiestered' }) id: string,\n @Arg('name', { description: 'name of board template to be regiestered' }) name: string,\n @Arg('description', { description: 'description of board template to be regiestered' }) description: string,\n @Arg('visibility', { description: 'visibility of board template to be regiestered' }) visibility: string,\n @Ctx() context: ResolverContext\n ): Promise<BoardTemplate> {\n const { domain, user, notify, tx } = context.state\n\n const boardTemplateRepository = tx.getRepository(BoardTemplate)\n\n const board = await tx.getRepository(Board).findOne({\n where: { domain: { id: domain.id }, id }\n })\n\n if (!board) {\n throw `Board given id(${id}) is not found`\n }\n\n name ||= board.name\n\n const { model, thumbnail } = board\n\n const boardTemplate = await boardTemplateRepository.findOne({\n where: { domain: { id: domain.id }, name }\n })\n\n const registered = boardTemplate\n ? await boardTemplateRepository.save({\n ...boardTemplate,\n name,\n description: description || boardTemplate.description,\n visibility: visibility || boardTemplate.visibility,\n model,\n thumbnail,\n updater: user\n })\n : await boardTemplateRepository.save({\n domain: { id: domain.id },\n name,\n description: description || board.description,\n model,\n thumbnail,\n visibility: visibility || 'private',\n updater: user,\n creator: user\n })\n\n notify &&\n notify({\n mode: 'in-app',\n title: `BoardTemplate '${registered.name}' registered`,\n body: `BoardTemplate '${registered.name}' registered by ${user.name}\\n${registered.description}`,\n image: getRedirectSubdomainPath(context, domain.subdomain, `/board-template-thumbnail/${registered.id}`),\n url: getRedirectSubdomainPath(context, domain.subdomain, `/board-template-viewer/${registered.id}`)\n })\n\n return registered\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"board-template-mutation.js","sourceRoot":"","sources":["../../../server/service/board-template/board-template-mutation.ts"],"names":[],"mappings":";;;;AAAA,+CAAsE;AAEtE,iDAA+E;AAC/E,2DAAmD;AACnD,gDAAyC;AACzC,qEAA+E;AAC/E,iEAA0D;AAGnD,IAAM,qBAAqB,GAA3B,MAAM,qBAAqB;IAI1B,AAAN,KAAK,CAAC,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AAA,wBAAS,EAAC,yFAAyF,CAAC;IACpG,IAAA,uBAAQ,EAAC,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,WAAW,EAAE,yBAAyB,EAAE,CAAC;IAC9C,mBAAA,IAAA,kBAAG,EAAC,IAAI,CAAC,CAAA;IAAc,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;gEAMtD;AAKK;IAHL,IAAA,wBAAS,EAAC,cAAc,CAAC;IACzB,IAAA,wBAAS,EAAC,yFAAyF,CAAC;IACpG,IAAA,uBAAQ,EAAC,OAAO,CAAC,EAAE,CAAC,iCAAa,EAAE,EAAE,WAAW,EAAE,2DAA2D,EAAE,CAAC;IAE9G,mBAAA,IAAA,kBAAG,EAAC,IAAI,EAAE,EAAE,WAAW,EAAE,4BAA4B,EAAE,CAAC,CAAA;IACxD,mBAAA,IAAA,kBAAG,EAAC,MAAM,EAAE,EAAE,WAAW,EAAE,0CAA0C,EAAE,CAAC,CAAA;IACxE,mBAAA,IAAA,kBAAG,EAAC,aAAa,EAAE,EAAE,WAAW,EAAE,iDAAiD,EAAE,CAAC,CAAA;IACtF,mBAAA,IAAA,kBAAG,EAAC,YAAY,EAAE,EAAE,WAAW,EAAE,gDAAgD,EAAE,CAAC,CAAA;IACpF,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;oEAqDP;gCAtJU,qBAAqB;IADjC,IAAA,uBAAQ,EAAC,iCAAa,CAAC;GACX,qBAAqB,CAuJjC","sourcesContent":["import { Resolver, Mutation, Arg, Ctx, Directive } from 'type-graphql'\n\nimport { getRedirectSubdomainPath, getRepository } from '@things-factory/shell'\nimport { BoardTemplate } from './board-template.js'\nimport { Board } from '../board/board.js'\nimport { NewBoardTemplate, BoardTemplatePatch } from './board-template-type.js'\nimport { thumbnail } from '../../controllers/thumbnail.js'\n\n@Resolver(BoardTemplate)\nexport class BoardTemplateMutation {\n @Directive('@transaction')\n @Directive('@privilege(category: \"board-template\", privilege: \"mutation\", domainOwnerGranted: true)')\n @Mutation(returns => BoardTemplate, { description: 'To create new BoardTemplate' })\n async createBoardTemplate(\n @Arg('boardTemplate') boardTemplate: NewBoardTemplate,\n @Ctx() context: ResolverContext\n ): Promise<BoardTemplate> {\n const { domain, user, tx } = context.state\n const repository = getRepository(BoardTemplate, tx)\n\n const oldBoardTemplate: BoardTemplate = await repository.findOneBy({\n name: boardTemplate.name,\n domain: { id: domain.id }\n })\n\n if (oldBoardTemplate) {\n throw new Error(context.t('error.board-template name is already taken', { name: boardTemplate.name }))\n }\n\n const newBoardTemplate: Partial<BoardTemplate> = {\n ...boardTemplate\n }\n\n const base64 = await thumbnail({\n model: boardTemplate.model,\n context\n })\n\n if (base64) {\n newBoardTemplate.thumbnail = 'data:image/png;base64,' + base64.toString('base64')\n } else {\n newBoardTemplate.thumbnail = 'data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=='\n }\n\n return await repository.save({\n domain,\n ...newBoardTemplate,\n creator: user,\n updater: user\n })\n }\n\n @Directive('@transaction')\n @Directive('@privilege(category: \"board-template\", privilege: \"mutation\", domainOwnerGranted: true)')\n @Mutation(returns => BoardTemplate, { description: 'To modify BoardTemplate information' })\n async updateBoardTemplate(\n @Arg('id') id: string,\n @Arg('patch') patch: BoardTemplatePatch,\n @Ctx() context: ResolverContext\n ): Promise<BoardTemplate> {\n const { domain, user, tx } = context.state\n const repository = getRepository(BoardTemplate, tx)\n\n const boardTemplate = await repository.findOne({\n where: { domain: { id: domain.id }, id }\n })\n\n if (patch.model) {\n const base64 = await thumbnail({\n model: patch.model,\n context\n })\n\n if (base64) {\n patch.thumbnail = 'data:image/png;base64,' + base64.toString('base64')\n } else {\n patch.thumbnail = 'data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=='\n }\n }\n\n return await repository.save({\n ...boardTemplate,\n ...patch,\n updater: user\n })\n }\n\n @Directive('@transaction')\n @Directive('@privilege(category: \"board-template\", privilege: \"mutation\", domainOwnerGranted: true)')\n @Mutation(returns => Boolean, { description: 'To delete BoardTemplate' })\n async deleteBoardTemplate(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<boolean> {\n const { domain, tx } = context.state\n\n await getRepository(BoardTemplate, tx).delete({ domain: { id: domain.id }, id })\n\n return true\n }\n\n @Directive('@transaction')\n @Directive('@privilege(category: \"board-template\", privilege: \"mutation\", domainOwnerGranted: true)')\n @Mutation(returns => BoardTemplate, { description: 'To register a board as a board template with the given ID' })\n async registerBoardAsTemplate(\n @Arg('id', { description: 'board Id to be regiestered' }) id: string,\n @Arg('name', { description: 'name of board template to be regiestered' }) name: string,\n @Arg('description', { description: 'description of board template to be regiestered' }) description: string,\n @Arg('visibility', { description: 'visibility of board template to be regiestered' }) visibility: string,\n @Ctx() context: ResolverContext\n ): Promise<BoardTemplate> {\n const { domain, user, notify, tx } = context.state\n\n const boardTemplateRepository = getRepository(BoardTemplate, tx)\n\n const board = await getRepository(Board, tx).findOne({\n where: { domain: { id: domain.id }, id }\n })\n\n if (!board) {\n throw `Board given id(${id}) is not found`\n }\n\n name ||= board.name\n\n const { model, thumbnail } = board\n\n const boardTemplate = await boardTemplateRepository.findOne({\n where: { domain: { id: domain.id }, name }\n })\n\n const registered = boardTemplate\n ? await boardTemplateRepository.save({\n ...boardTemplate,\n name,\n description: description || boardTemplate.description,\n visibility: visibility || boardTemplate.visibility,\n model,\n thumbnail,\n updater: user\n })\n : await boardTemplateRepository.save({\n domain: { id: domain.id },\n name,\n description: description || board.description,\n model,\n thumbnail,\n visibility: visibility || 'private',\n updater: user,\n creator: user\n })\n\n notify &&\n notify({\n mode: 'in-app',\n title: `BoardTemplate '${registered.name}' registered`,\n body: `BoardTemplate '${registered.name}' registered by ${user.name}\\n${registered.description}`,\n image: getRedirectSubdomainPath(context, domain, `/board-template-thumbnail/${registered.id}`),\n url: getRedirectSubdomainPath(context, domain, `/board-template-viewer/${registered.id}`)\n })\n\n return registered\n }\n}\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Domain, ListParam } from '@things-factory/shell';
|
|
2
2
|
import { User } from '@things-factory/auth-base';
|
|
3
|
-
import { BoardTemplate } from './board-template';
|
|
4
|
-
import { BoardTemplateList } from './board-template-type';
|
|
3
|
+
import { BoardTemplate } from './board-template.js';
|
|
4
|
+
import { BoardTemplateList } from './board-template-type.js';
|
|
5
5
|
export declare class BoardTemplateQuery {
|
|
6
6
|
boardTemplate(id: string, context: ResolverContext): Promise<BoardTemplate>;
|
|
7
7
|
boardTemplatesCreatedByMe(params: ListParam, context: ResolverContext): Promise<BoardTemplateList>;
|
|
@@ -6,12 +6,12 @@ const typeorm_1 = require("typeorm");
|
|
|
6
6
|
const type_graphql_1 = require("type-graphql");
|
|
7
7
|
const shell_1 = require("@things-factory/shell");
|
|
8
8
|
const auth_base_1 = require("@things-factory/auth-base");
|
|
9
|
-
const
|
|
10
|
-
const
|
|
9
|
+
const board_template_js_1 = require("./board-template.js");
|
|
10
|
+
const board_template_type_js_1 = require("./board-template-type.js");
|
|
11
11
|
let BoardTemplateQuery = class BoardTemplateQuery {
|
|
12
12
|
async boardTemplate(id, context) {
|
|
13
13
|
const { domain, user } = context.state;
|
|
14
|
-
const qb = await (0, shell_1.getRepository)(
|
|
14
|
+
const qb = await (0, shell_1.getRepository)(board_template_js_1.BoardTemplate)
|
|
15
15
|
.createQueryBuilder('BoardTemplate')
|
|
16
16
|
.where('id=:id', { id })
|
|
17
17
|
.andWhere(new typeorm_1.Brackets(qb => {
|
|
@@ -36,7 +36,7 @@ let BoardTemplateQuery = class BoardTemplateQuery {
|
|
|
36
36
|
async boardTemplatesCreatedByMe(params, context) {
|
|
37
37
|
const { user } = context.state;
|
|
38
38
|
const queryBuilder = (0, shell_1.getQueryBuilderFromListParams)({
|
|
39
|
-
repository: (0, shell_1.getRepository)(
|
|
39
|
+
repository: (0, shell_1.getRepository)(board_template_js_1.BoardTemplate),
|
|
40
40
|
params,
|
|
41
41
|
alias: 'template',
|
|
42
42
|
searchables: ['name', 'description']
|
|
@@ -54,7 +54,7 @@ let BoardTemplateQuery = class BoardTemplateQuery {
|
|
|
54
54
|
*/
|
|
55
55
|
const queryBuilder = (0, shell_1.getQueryBuilderFromListParams)({
|
|
56
56
|
params,
|
|
57
|
-
repository: await (0, shell_1.getRepository)(
|
|
57
|
+
repository: await (0, shell_1.getRepository)(board_template_js_1.BoardTemplate),
|
|
58
58
|
searchables: ['name', 'description']
|
|
59
59
|
}).andWhere(new typeorm_1.Brackets(qb => {
|
|
60
60
|
qb.where({ visibility: 'public' })
|
|
@@ -87,7 +87,7 @@ let BoardTemplateQuery = class BoardTemplateQuery {
|
|
|
87
87
|
};
|
|
88
88
|
exports.BoardTemplateQuery = BoardTemplateQuery;
|
|
89
89
|
tslib_1.__decorate([
|
|
90
|
-
(0, type_graphql_1.Query)(returns =>
|
|
90
|
+
(0, type_graphql_1.Query)(returns => board_template_js_1.BoardTemplate, { nullable: true, description: 'To fetch a BoardTemplate' }),
|
|
91
91
|
(0, type_graphql_1.Directive)('@privilege(category: "board-template", privilege: "query", domainOwnerGranted: true)'),
|
|
92
92
|
tslib_1.__param(0, (0, type_graphql_1.Arg)('id')),
|
|
93
93
|
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
|
@@ -96,7 +96,7 @@ tslib_1.__decorate([
|
|
|
96
96
|
tslib_1.__metadata("design:returntype", Promise)
|
|
97
97
|
], BoardTemplateQuery.prototype, "boardTemplate", null);
|
|
98
98
|
tslib_1.__decorate([
|
|
99
|
-
(0, type_graphql_1.Query)(returns =>
|
|
99
|
+
(0, type_graphql_1.Query)(returns => board_template_type_js_1.BoardTemplateList, { description: 'To fetch BoardTemplates created by me' }),
|
|
100
100
|
tslib_1.__param(0, (0, type_graphql_1.Args)(type => shell_1.ListParam)),
|
|
101
101
|
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
|
102
102
|
tslib_1.__metadata("design:type", Function),
|
|
@@ -104,7 +104,7 @@ tslib_1.__decorate([
|
|
|
104
104
|
tslib_1.__metadata("design:returntype", Promise)
|
|
105
105
|
], BoardTemplateQuery.prototype, "boardTemplatesCreatedByMe", null);
|
|
106
106
|
tslib_1.__decorate([
|
|
107
|
-
(0, type_graphql_1.Query)(returns =>
|
|
107
|
+
(0, type_graphql_1.Query)(returns => board_template_type_js_1.BoardTemplateList, { description: 'To fetch multiple BoardTemplates' }),
|
|
108
108
|
(0, type_graphql_1.Directive)('@privilege(category: "board-template", privilege: "query", domainOwnerGranted: true)'),
|
|
109
109
|
tslib_1.__param(0, (0, type_graphql_1.Args)(type => shell_1.ListParam)),
|
|
110
110
|
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
|
@@ -117,31 +117,31 @@ tslib_1.__decorate([
|
|
|
117
117
|
tslib_1.__param(0, (0, type_graphql_1.Root)()),
|
|
118
118
|
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
|
119
119
|
tslib_1.__metadata("design:type", Function),
|
|
120
|
-
tslib_1.__metadata("design:paramtypes", [
|
|
120
|
+
tslib_1.__metadata("design:paramtypes", [board_template_js_1.BoardTemplate, Object]),
|
|
121
121
|
tslib_1.__metadata("design:returntype", Promise)
|
|
122
122
|
], BoardTemplateQuery.prototype, "mine", null);
|
|
123
123
|
tslib_1.__decorate([
|
|
124
124
|
(0, type_graphql_1.FieldResolver)(type => shell_1.Domain),
|
|
125
125
|
tslib_1.__param(0, (0, type_graphql_1.Root)()),
|
|
126
126
|
tslib_1.__metadata("design:type", Function),
|
|
127
|
-
tslib_1.__metadata("design:paramtypes", [
|
|
127
|
+
tslib_1.__metadata("design:paramtypes", [board_template_js_1.BoardTemplate]),
|
|
128
128
|
tslib_1.__metadata("design:returntype", Promise)
|
|
129
129
|
], BoardTemplateQuery.prototype, "domain", null);
|
|
130
130
|
tslib_1.__decorate([
|
|
131
131
|
(0, type_graphql_1.FieldResolver)(type => auth_base_1.User),
|
|
132
132
|
tslib_1.__param(0, (0, type_graphql_1.Root)()),
|
|
133
133
|
tslib_1.__metadata("design:type", Function),
|
|
134
|
-
tslib_1.__metadata("design:paramtypes", [
|
|
134
|
+
tslib_1.__metadata("design:paramtypes", [board_template_js_1.BoardTemplate]),
|
|
135
135
|
tslib_1.__metadata("design:returntype", Promise)
|
|
136
136
|
], BoardTemplateQuery.prototype, "updater", null);
|
|
137
137
|
tslib_1.__decorate([
|
|
138
138
|
(0, type_graphql_1.FieldResolver)(type => auth_base_1.User),
|
|
139
139
|
tslib_1.__param(0, (0, type_graphql_1.Root)()),
|
|
140
140
|
tslib_1.__metadata("design:type", Function),
|
|
141
|
-
tslib_1.__metadata("design:paramtypes", [
|
|
141
|
+
tslib_1.__metadata("design:paramtypes", [board_template_js_1.BoardTemplate]),
|
|
142
142
|
tslib_1.__metadata("design:returntype", Promise)
|
|
143
143
|
], BoardTemplateQuery.prototype, "creator", null);
|
|
144
144
|
exports.BoardTemplateQuery = BoardTemplateQuery = tslib_1.__decorate([
|
|
145
|
-
(0, type_graphql_1.Resolver)(
|
|
145
|
+
(0, type_graphql_1.Resolver)(board_template_js_1.BoardTemplate)
|
|
146
146
|
], BoardTemplateQuery);
|
|
147
147
|
//# sourceMappingURL=board-template-query.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"board-template-query.js","sourceRoot":"","sources":["../../../server/service/board-template/board-template-query.ts"],"names":[],"mappings":";;;;AAAA,qCAAsC;AACtC,+CAA8F;
|
|
1
|
+
{"version":3,"file":"board-template-query.js","sourceRoot":"","sources":["../../../server/service/board-template/board-template-query.ts"],"names":[],"mappings":";;;;AAAA,qCAAsC;AACtC,+CAA8F;AAC9F,iDAAuG;AACvG,yDAAgD;AAChD,2DAAmD;AACnD,qEAA4D;AAGrD,IAAM,kBAAkB,GAAxB,MAAM,kBAAkB;IAGvB,AAAN,KAAK,CAAC,aAAa,CAAY,EAAU,EAAS,OAAwB;QACxE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,OAAO,CAA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0CAAiB,EAAE,EAAE,WAAW,EAAE,kCAAkC,EAAE,CAAC;IACxF,IAAA,wBAAS,EAAC,sFAAsF,CAAC;IAE/F,mBAAA,IAAA,mBAAI,EAAC,IAAI,CAAC,EAAE,CAAC,iBAAS,CAAC,CAAA;IACvB,mBAAA,IAAA,kBAAG,GAAE,CAAA;;6CAD2B,iBAAS;;wDAgC3C;AAGK;IADL,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,OAAO,CAAC;IACnB,mBAAA,IAAA,mBAAI,GAAE,CAAA;IAAgC,mBAAA,IAAA,kBAAG,GAAE,CAAA;;6CAArB,iCAAa;;8CAK9C;AAGK;IADL,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,cAAM,CAAC;IAChB,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAgB,iCAAa;;gDAEhD;AAGK;IADL,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,CAAC;IACb,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAgB,iCAAa;;iDAEjD;AAGK;IADL,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,CAAC;IACb,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAgB,iCAAa;;iDAEjD;6BA9GU,kBAAkB;IAD9B,IAAA,uBAAQ,EAAC,iCAAa,CAAC;GACX,kBAAkB,CA+G9B","sourcesContent":["import { Brackets, In } from 'typeorm'\nimport { Resolver, Query, FieldResolver, Root, Args, Arg, Ctx, Directive } from 'type-graphql'\nimport { Domain, getQueryBuilderFromListParams, getRepository, ListParam } from '@things-factory/shell'\nimport { User } from '@things-factory/auth-base'\nimport { BoardTemplate } from './board-template.js'\nimport { BoardTemplateList } from './board-template-type.js'\n\n@Resolver(BoardTemplate)\nexport class BoardTemplateQuery {\n @Query(returns => BoardTemplate!, { nullable: true, description: 'To fetch a BoardTemplate' })\n @Directive('@privilege(category: \"board-template\", privilege: \"query\", domainOwnerGranted: true)')\n async boardTemplate(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<BoardTemplate> {\n const { domain, user } = context.state\n\n const qb = await getRepository(BoardTemplate)\n .createQueryBuilder('BoardTemplate')\n .where('id=:id', { id })\n .andWhere(\n new Brackets(qb => {\n qb.where({ visibility: 'public' })\n .orWhere({\n visibility: 'domain',\n domain: { id: In([domain.id, domain.parentId]) }\n })\n .orWhere({\n visibility: 'private',\n creator: { id: user.id }\n })\n })\n )\n\n return qb.getOne()\n\n // return await getRepository(BoardTemplate).findOne({\n // where: {\n // domain: { id: In([domain.id, domain.parentId].filter(Boolean)) },\n // id\n // }\n // })\n }\n\n @Query(returns => BoardTemplateList, { description: 'To fetch BoardTemplates created by me' })\n async boardTemplatesCreatedByMe(\n @Args(type => ListParam) params: ListParam,\n @Ctx() context: ResolverContext\n ): Promise<BoardTemplateList> {\n const { user } = context.state\n\n const queryBuilder = getQueryBuilderFromListParams({\n repository: getRepository(BoardTemplate),\n params,\n alias: 'template',\n searchables: ['name', 'description']\n }).andWhere('template.creator = :user', { user: user.id })\n\n const [items, total] = await queryBuilder.getManyAndCount()\n\n return { items, total }\n }\n\n @Query(returns => BoardTemplateList, { description: 'To fetch multiple BoardTemplates' })\n @Directive('@privilege(category: \"board-template\", privilege: \"query\", domainOwnerGranted: true)')\n async boardTemplates(\n @Args(type => ListParam) params: ListParam,\n @Ctx() context: ResolverContext\n ): Promise<BoardTemplateList> {\n const { domain, user } = context.state\n /* \n 리스트에 포함되는 보드템플릿들 \n - visibility가 public 인 경우\n - visibility가 domain이며 컨텍스트의 도메인과 같은 경우\n - visibility가 private 이며, creator가 나인 경우\n */\n\n const queryBuilder = getQueryBuilderFromListParams({\n params,\n repository: await getRepository(BoardTemplate),\n searchables: ['name', 'description']\n }).andWhere(\n new Brackets(qb => {\n qb.where({ visibility: 'public' })\n .orWhere({\n visibility: 'domain',\n domain: { id: In([domain.id, domain.parentId]) }\n })\n .orWhere({\n visibility: 'private',\n creator: { id: user.id }\n })\n })\n )\n\n const [items, total] = await queryBuilder.getManyAndCount()\n\n return { items, total }\n }\n\n @FieldResolver(type => Boolean)\n async mine(@Root() boardTemplate: BoardTemplate, @Ctx() context: ResolverContext): Promise<boolean> {\n const { creatorId } = boardTemplate\n const { user } = context.state\n\n return creatorId == user.id\n }\n\n @FieldResolver(type => Domain)\n async domain(@Root() boardTemplate: BoardTemplate): Promise<Domain> {\n return boardTemplate.domainId && (await getRepository(Domain).findOneBy({ id: boardTemplate.domainId }))\n }\n\n @FieldResolver(type => User)\n async updater(@Root() boardTemplate: BoardTemplate): Promise<User> {\n return boardTemplate.updaterId && (await getRepository(User).findOneBy({ id: boardTemplate.updaterId }))\n }\n\n @FieldResolver(type => User)\n async creator(@Root() boardTemplate: BoardTemplate): Promise<User> {\n return boardTemplate.creatorId && (await getRepository(User).findOneBy({ id: boardTemplate.creatorId }))\n }\n}\n"]}
|
|
@@ -3,79 +3,82 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.BoardTemplateList = exports.BoardTemplatePatch = exports.NewBoardTemplate = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const type_graphql_1 = require("type-graphql");
|
|
6
|
-
const
|
|
6
|
+
const board_template_js_1 = require("./board-template.js");
|
|
7
7
|
let NewBoardTemplate = class NewBoardTemplate {
|
|
8
8
|
};
|
|
9
9
|
exports.NewBoardTemplate = NewBoardTemplate;
|
|
10
10
|
tslib_1.__decorate([
|
|
11
|
-
(0, type_graphql_1.Field)(),
|
|
11
|
+
(0, type_graphql_1.Field)({ description: 'The name of the new board template.' }),
|
|
12
12
|
tslib_1.__metadata("design:type", String)
|
|
13
13
|
], NewBoardTemplate.prototype, "name", void 0);
|
|
14
14
|
tslib_1.__decorate([
|
|
15
|
-
(0, type_graphql_1.Field)(),
|
|
15
|
+
(0, type_graphql_1.Field)({ description: 'A detailed description for the new board template.' }),
|
|
16
16
|
tslib_1.__metadata("design:type", String)
|
|
17
17
|
], NewBoardTemplate.prototype, "description", void 0);
|
|
18
18
|
tslib_1.__decorate([
|
|
19
|
-
(0, type_graphql_1.Field)(),
|
|
19
|
+
(0, type_graphql_1.Field)({ description: 'The JSON model for the new board template.' }),
|
|
20
20
|
tslib_1.__metadata("design:type", String)
|
|
21
21
|
], NewBoardTemplate.prototype, "model", void 0);
|
|
22
22
|
tslib_1.__decorate([
|
|
23
|
-
(0, type_graphql_1.Field)(),
|
|
23
|
+
(0, type_graphql_1.Field)({ description: "The visibility for the new board template: 'private' or 'public'." }),
|
|
24
24
|
tslib_1.__metadata("design:type", String)
|
|
25
25
|
], NewBoardTemplate.prototype, "visibility", void 0);
|
|
26
26
|
tslib_1.__decorate([
|
|
27
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
|
27
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'A base64 encoded thumbnail image for the new board template.' }),
|
|
28
28
|
tslib_1.__metadata("design:type", String)
|
|
29
29
|
], NewBoardTemplate.prototype, "thumbnail", void 0);
|
|
30
30
|
exports.NewBoardTemplate = NewBoardTemplate = tslib_1.__decorate([
|
|
31
|
-
(0, type_graphql_1.InputType)()
|
|
31
|
+
(0, type_graphql_1.InputType)({ description: 'Input for creating a new board template.' })
|
|
32
32
|
], NewBoardTemplate);
|
|
33
33
|
let BoardTemplatePatch = class BoardTemplatePatch {
|
|
34
34
|
};
|
|
35
35
|
exports.BoardTemplatePatch = BoardTemplatePatch;
|
|
36
36
|
tslib_1.__decorate([
|
|
37
|
-
(0, type_graphql_1.Field)(type => type_graphql_1.ID, { nullable: true }),
|
|
37
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.ID, { nullable: true, description: 'The unique identifier of the board template to update.' }),
|
|
38
38
|
tslib_1.__metadata("design:type", String)
|
|
39
39
|
], BoardTemplatePatch.prototype, "id", void 0);
|
|
40
40
|
tslib_1.__decorate([
|
|
41
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
|
41
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'The new name for the board template.' }),
|
|
42
42
|
tslib_1.__metadata("design:type", String)
|
|
43
43
|
], BoardTemplatePatch.prototype, "name", void 0);
|
|
44
44
|
tslib_1.__decorate([
|
|
45
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
|
45
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'The new description for the board template.' }),
|
|
46
46
|
tslib_1.__metadata("design:type", String)
|
|
47
47
|
], BoardTemplatePatch.prototype, "description", void 0);
|
|
48
48
|
tslib_1.__decorate([
|
|
49
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
|
49
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'The new JSON model for the board template.' }),
|
|
50
50
|
tslib_1.__metadata("design:type", String)
|
|
51
51
|
], BoardTemplatePatch.prototype, "model", void 0);
|
|
52
52
|
tslib_1.__decorate([
|
|
53
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
|
53
|
+
(0, type_graphql_1.Field)({ nullable: true, description: "The new visibility for the board template: 'private' or 'public'." }),
|
|
54
54
|
tslib_1.__metadata("design:type", String)
|
|
55
55
|
], BoardTemplatePatch.prototype, "visibility", void 0);
|
|
56
56
|
tslib_1.__decorate([
|
|
57
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
|
57
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'The new base64 encoded thumbnail image for the board template.' }),
|
|
58
58
|
tslib_1.__metadata("design:type", String)
|
|
59
59
|
], BoardTemplatePatch.prototype, "thumbnail", void 0);
|
|
60
60
|
tslib_1.__decorate([
|
|
61
|
-
(0, type_graphql_1.Field)({
|
|
61
|
+
(0, type_graphql_1.Field)({
|
|
62
|
+
nullable: true,
|
|
63
|
+
description: 'A flag indicating whether the template is being created, updated, or deleted.'
|
|
64
|
+
}),
|
|
62
65
|
tslib_1.__metadata("design:type", String)
|
|
63
66
|
], BoardTemplatePatch.prototype, "cuFlag", void 0);
|
|
64
67
|
exports.BoardTemplatePatch = BoardTemplatePatch = tslib_1.__decorate([
|
|
65
|
-
(0, type_graphql_1.InputType)()
|
|
68
|
+
(0, type_graphql_1.InputType)({ description: 'Input for updating (patching) an existing board template.' })
|
|
66
69
|
], BoardTemplatePatch);
|
|
67
70
|
let BoardTemplateList = class BoardTemplateList {
|
|
68
71
|
};
|
|
69
72
|
exports.BoardTemplateList = BoardTemplateList;
|
|
70
73
|
tslib_1.__decorate([
|
|
71
|
-
(0, type_graphql_1.Field)(type => [
|
|
74
|
+
(0, type_graphql_1.Field)(type => [board_template_js_1.BoardTemplate], { description: 'The list of board template items.' }),
|
|
72
75
|
tslib_1.__metadata("design:type", Array)
|
|
73
76
|
], BoardTemplateList.prototype, "items", void 0);
|
|
74
77
|
tslib_1.__decorate([
|
|
75
|
-
(0, type_graphql_1.Field)(type => type_graphql_1.Int),
|
|
78
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.Int, { description: 'The total number of board templates.' }),
|
|
76
79
|
tslib_1.__metadata("design:type", Number)
|
|
77
80
|
], BoardTemplateList.prototype, "total", void 0);
|
|
78
81
|
exports.BoardTemplateList = BoardTemplateList = tslib_1.__decorate([
|
|
79
|
-
(0, type_graphql_1.ObjectType)()
|
|
82
|
+
(0, type_graphql_1.ObjectType)({ description: 'A paginated list of board templates.' })
|
|
80
83
|
], BoardTemplateList);
|
|
81
84
|
//# sourceMappingURL=board-template-type.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"board-template-type.js","sourceRoot":"","sources":["../../../server/service/board-template/board-template-type.ts"],"names":[],"mappings":";;;;AAAA,+CAAoE;AACpE,
|
|
1
|
+
{"version":3,"file":"board-template-type.js","sourceRoot":"","sources":["../../../server/service/board-template/board-template-type.ts"],"names":[],"mappings":";;;;AAAA,+CAAoE;AACpE,2DAAmD;AAG5C,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB;CAe5B,CAAA;AAfY,4CAAgB;AAE3B;IADC,IAAA,oBAAK,EAAC,EAAE,WAAW,EAAE,qCAAqC,EAA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EAAE,IAAI;QACd,WAAW,EAAE,+EAA+E;KAC7F,CAAC;;kDACa;6BAvBJ,kBAAkB;IAD9B,IAAA,wBAAS,EAAC,EAAE,WAAW,EAAE,2DAA2D,EAAE,CAAC;GAC3E,kBAAkB,CAwB9B;AAGM,IAAM,iBAAiB,GAAvB,MAAM,iBAAiB;CAM7B,CAAA;AANY,8CAAiB;AAE5B;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,CAAC,iCAAa,CAAC,EAAE,EAAE,WAAW,EAAE,mCAAmC,EAAE,CAAC;;gDAC/D;AAGtB;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,kBAAG,EAAE,EAAE,WAAW,EAAE,sCAAsC,EAAE,CAAC;;gDAC/D;4BALF,iBAAiB;IAD7B,IAAA,yBAAU,EAAC,EAAE,WAAW,EAAE,sCAAsC,EAAE,CAAC;GACvD,iBAAiB,CAM7B","sourcesContent":["import { ObjectType, Field, InputType, Int, ID } from 'type-graphql'\nimport { BoardTemplate } from './board-template.js'\n\n@InputType({ description: 'Input for creating a new board template.' })\nexport class NewBoardTemplate {\n @Field({ description: 'The name of the new board template.' })\n name: string\n\n @Field({ description: 'A detailed description for the new board template.' })\n description: string\n\n @Field({ description: 'The JSON model for the new board template.' })\n model: string\n\n @Field({ description: \"The visibility for the new board template: 'private' or 'public'.\" })\n visibility: 'private' | 'public'\n\n @Field({ nullable: true, description: 'A base64 encoded thumbnail image for the new board template.' })\n thumbnail: string\n}\n\n@InputType({ description: 'Input for updating (patching) an existing board template.' })\nexport class BoardTemplatePatch {\n @Field(type => ID, { nullable: true, description: 'The unique identifier of the board template to update.' })\n id?: string\n\n @Field({ nullable: true, description: 'The new name for the board template.' })\n name?: string\n\n @Field({ nullable: true, description: 'The new description for the board template.' })\n description?: string\n\n @Field({ nullable: true, description: 'The new JSON model for the board template.' })\n model: string\n\n @Field({ nullable: true, description: \"The new visibility for the board template: 'private' or 'public'.\" })\n visibility?: 'private' | 'public'\n\n @Field({ nullable: true, description: 'The new base64 encoded thumbnail image for the board template.' })\n thumbnail?: string\n\n @Field({\n nullable: true,\n description: 'A flag indicating whether the template is being created, updated, or deleted.'\n })\n cuFlag?: string\n}\n\n@ObjectType({ description: 'A paginated list of board templates.' })\nexport class BoardTemplateList {\n @Field(type => [BoardTemplate], { description: 'The list of board template items.' })\n items: BoardTemplate[]\n\n @Field(type => Int, { description: 'The total number of board templates.' })\n total: number\n}\n"]}
|
|
@@ -16,19 +16,19 @@ var BoardTemplateStatus;
|
|
|
16
16
|
})(BoardTemplateStatus || (exports.BoardTemplateStatus = BoardTemplateStatus = {}));
|
|
17
17
|
(0, type_graphql_1.registerEnumType)(BoardTemplateStatus, {
|
|
18
18
|
name: 'BoardTemplateStatus',
|
|
19
|
-
description: '
|
|
19
|
+
description: 'The publication status of a board template, indicating whether it is a draft or released.'
|
|
20
20
|
});
|
|
21
21
|
let BoardTemplate = class BoardTemplate {
|
|
22
22
|
};
|
|
23
23
|
exports.BoardTemplate = BoardTemplate;
|
|
24
24
|
tslib_1.__decorate([
|
|
25
25
|
(0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
|
|
26
|
-
(0, type_graphql_1.Field)(type => type_graphql_1.ID),
|
|
26
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.ID, { description: 'Unique identifier for the board template.' }),
|
|
27
27
|
tslib_1.__metadata("design:type", String)
|
|
28
28
|
], BoardTemplate.prototype, "id", void 0);
|
|
29
29
|
tslib_1.__decorate([
|
|
30
30
|
(0, typeorm_1.ManyToOne)(type => shell_1.Domain),
|
|
31
|
-
(0, type_graphql_1.Field)(type => shell_1.Domain),
|
|
31
|
+
(0, type_graphql_1.Field)(type => shell_1.Domain, { description: 'The domain to which this template belongs.' }),
|
|
32
32
|
tslib_1.__metadata("design:type", shell_1.Domain)
|
|
33
33
|
], BoardTemplate.prototype, "domain", void 0);
|
|
34
34
|
tslib_1.__decorate([
|
|
@@ -37,22 +37,22 @@ tslib_1.__decorate([
|
|
|
37
37
|
], BoardTemplate.prototype, "domainId", void 0);
|
|
38
38
|
tslib_1.__decorate([
|
|
39
39
|
(0, typeorm_1.Column)(),
|
|
40
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
|
40
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'The name of the board template.' }),
|
|
41
41
|
tslib_1.__metadata("design:type", String)
|
|
42
42
|
], BoardTemplate.prototype, "name", void 0);
|
|
43
43
|
tslib_1.__decorate([
|
|
44
44
|
(0, typeorm_1.Column)({ nullable: true }),
|
|
45
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
|
45
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'A detailed description of the board template.' }),
|
|
46
46
|
tslib_1.__metadata("design:type", String)
|
|
47
47
|
], BoardTemplate.prototype, "description", void 0);
|
|
48
48
|
tslib_1.__decorate([
|
|
49
49
|
(0, typeorm_1.Column)('simple-json', { nullable: true, default: null }),
|
|
50
|
-
(0, type_graphql_1.Field)(type =>
|
|
50
|
+
(0, type_graphql_1.Field)(type => [String], { nullable: true, description: 'A list of tags for categorizing the template.' }),
|
|
51
51
|
tslib_1.__metadata("design:type", Array)
|
|
52
52
|
], BoardTemplate.prototype, "tags", void 0);
|
|
53
53
|
tslib_1.__decorate([
|
|
54
54
|
(0, typeorm_1.Column)({ nullable: true, default: 'private' }),
|
|
55
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
|
55
|
+
(0, type_graphql_1.Field)({ nullable: true, description: "The visibility of the template: 'private', 'public', or 'domain'." }),
|
|
56
56
|
tslib_1.__metadata("design:type", String)
|
|
57
57
|
], BoardTemplate.prototype, "visibility", void 0);
|
|
58
58
|
tslib_1.__decorate([
|
|
@@ -67,7 +67,7 @@ tslib_1.__decorate([
|
|
|
67
67
|
: 'varchar',
|
|
68
68
|
length: DATABASE_TYPE == 'mssql' ? 'MAX' : undefined
|
|
69
69
|
}),
|
|
70
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
|
70
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'The JSON model that defines the layout and components of the template.' }),
|
|
71
71
|
tslib_1.__metadata("design:type", String)
|
|
72
72
|
], BoardTemplate.prototype, "model", void 0);
|
|
73
73
|
tslib_1.__decorate([
|
|
@@ -82,22 +82,22 @@ tslib_1.__decorate([
|
|
|
82
82
|
: 'varchar',
|
|
83
83
|
length: DATABASE_TYPE == 'mssql' ? 'MAX' : undefined
|
|
84
84
|
}),
|
|
85
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
|
85
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'A base64 encoded thumbnail image of the template.' }),
|
|
86
86
|
tslib_1.__metadata("design:type", String)
|
|
87
87
|
], BoardTemplate.prototype, "thumbnail", void 0);
|
|
88
88
|
tslib_1.__decorate([
|
|
89
89
|
(0, typeorm_1.CreateDateColumn)(),
|
|
90
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
|
90
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'The timestamp when the template was created.' }),
|
|
91
91
|
tslib_1.__metadata("design:type", Date)
|
|
92
92
|
], BoardTemplate.prototype, "createdAt", void 0);
|
|
93
93
|
tslib_1.__decorate([
|
|
94
94
|
(0, typeorm_1.UpdateDateColumn)(),
|
|
95
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
|
95
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'The timestamp when the template was last updated.' }),
|
|
96
96
|
tslib_1.__metadata("design:type", Date)
|
|
97
97
|
], BoardTemplate.prototype, "updatedAt", void 0);
|
|
98
98
|
tslib_1.__decorate([
|
|
99
99
|
(0, typeorm_1.ManyToOne)(type => auth_base_1.User, { nullable: true }),
|
|
100
|
-
(0, type_graphql_1.Field)(type => auth_base_1.User, { nullable: true }),
|
|
100
|
+
(0, type_graphql_1.Field)(type => auth_base_1.User, { nullable: true, description: 'The user who created the template.' }),
|
|
101
101
|
tslib_1.__metadata("design:type", auth_base_1.User)
|
|
102
102
|
], BoardTemplate.prototype, "creator", void 0);
|
|
103
103
|
tslib_1.__decorate([
|
|
@@ -106,7 +106,7 @@ tslib_1.__decorate([
|
|
|
106
106
|
], BoardTemplate.prototype, "creatorId", void 0);
|
|
107
107
|
tslib_1.__decorate([
|
|
108
108
|
(0, typeorm_1.ManyToOne)(type => auth_base_1.User, { nullable: true }),
|
|
109
|
-
(0, type_graphql_1.Field)(type => auth_base_1.User, { nullable: true }),
|
|
109
|
+
(0, type_graphql_1.Field)(type => auth_base_1.User, { nullable: true, description: 'The user who last updated the template.' }),
|
|
110
110
|
tslib_1.__metadata("design:type", auth_base_1.User)
|
|
111
111
|
], BoardTemplate.prototype, "updater", void 0);
|
|
112
112
|
tslib_1.__decorate([
|
|
@@ -118,6 +118,6 @@ exports.BoardTemplate = BoardTemplate = tslib_1.__decorate([
|
|
|
118
118
|
(0, typeorm_1.Index)('ix_board_template_0', (boardTemplate) => [boardTemplate.domain, boardTemplate.name], {
|
|
119
119
|
unique: true
|
|
120
120
|
}),
|
|
121
|
-
(0, type_graphql_1.ObjectType)({ description: '
|
|
121
|
+
(0, type_graphql_1.ObjectType)({ description: 'A reusable template for creating new boards.' })
|
|
122
122
|
], BoardTemplate);
|
|
123
123
|
//# sourceMappingURL=board-template.js.map
|