@things-factory/board-service 6.1.46 → 6.1.55
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/client/index.js +0 -0
- package/dist-server/service/board/board-query.js +1 -0
- package/dist-server/service/board/board-query.js.map +1 -1
- package/dist-server/service/board-template/board-template-mutation.js +94 -0
- package/dist-server/service/board-template/board-template-mutation.js.map +1 -0
- package/dist-server/service/board-template/board-template-query.js +135 -0
- package/dist-server/service/board-template/board-template-query.js.map +1 -0
- package/dist-server/service/board-template/board-template-type.js +81 -0
- package/dist-server/service/board-template/board-template-type.js.map +1 -0
- package/dist-server/service/board-template/board-template.js +120 -0
- package/dist-server/service/board-template/board-template.js.map +1 -0
- package/dist-server/service/board-template/index.js +10 -0
- package/dist-server/service/board-template/index.js.map +1 -0
- package/dist-server/service/index.js +5 -0
- package/dist-server/service/index.js.map +1 -1
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/helps/board-service/{share.md → board-template.md} +1 -1
- package/package.json +5 -5
- package/server/service/board/board-query.ts +1 -0
- package/server/service/board-template/board-template-mutation.ts +96 -0
- package/server/service/board-template/board-template-query.ts +95 -0
- package/server/service/board-template/board-template-type.ts +58 -0
- package/server/service/board-template/board-template.ts +109 -0
- package/server/service/board-template/index.ts +7 -0
- package/server/service/index.ts +5 -0
package/client/index.js
ADDED
|
File without changes
|
|
@@ -89,6 +89,7 @@ tslib_1.__decorate([
|
|
|
89
89
|
], BoardQuery.prototype, "board", null);
|
|
90
90
|
tslib_1.__decorate([
|
|
91
91
|
(0, type_graphql_1.Query)(returns => board_1.Board, { nullable: true, description: 'To fetch a Board Model by name' }),
|
|
92
|
+
(0, type_graphql_1.Directive)('@privilege(category: "board", privilege: "query", domainOwnerGranted: true)'),
|
|
92
93
|
tslib_1.__param(0, (0, type_graphql_1.Arg)('name')),
|
|
93
94
|
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
|
94
95
|
tslib_1.__metadata("design:type", Function),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"board-query.js","sourceRoot":"","sources":["../../../server/service/board/board-query.ts"],"names":[],"mappings":";;;;AAAA,qCAA4B;AAC5B,+CAA8F;AAE9F,yDAAgD;AAChD,iDAAuG;AAEvG,0CAAsC;AACtC,yDAAoD;AACpD,mCAA+B;AAC/B,6CAAwC;AAGjC,IAAM,UAAU,GAAhB,MAAM,UAAU;IAGf,AAAN,KAAK,CAAC,KAAK,CAAY,EAAU,EAAS,OAAwB;QAChE,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAEhC,OAAO,MAAM,IAAA,qBAAa,EAAC,aAAK,CAAC,CAAC,OAAO,CAAC;YACxC,KAAK,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,IAAA,YAAE,EAAC,CAAC,MAAM,CAAC,EAAE,EAAE,MAAM,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE;SAChF,CAAC,CAAA;IACJ,CAAC;
|
|
1
|
+
{"version":3,"file":"board-query.js","sourceRoot":"","sources":["../../../server/service/board/board-query.ts"],"names":[],"mappings":";;;;AAAA,qCAA4B;AAC5B,+CAA8F;AAE9F,yDAAgD;AAChD,iDAAuG;AAEvG,0CAAsC;AACtC,yDAAoD;AACpD,mCAA+B;AAC/B,6CAAwC;AAGjC,IAAM,UAAU,GAAhB,MAAM,UAAU;IAGf,AAAN,KAAK,CAAC,KAAK,CAAY,EAAU,EAAS,OAAwB;QAChE,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAEhC,OAAO,MAAM,IAAA,qBAAa,EAAC,aAAK,CAAC,CAAC,OAAO,CAAC;YACxC,KAAK,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,IAAA,YAAE,EAAC,CAAC,MAAM,CAAC,EAAE,EAAE,MAAM,CAAC,QAAQ,CAAC,CAAC,M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E,CAAC,aAAK,CAAC;IAChB,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAQ,aAAK;;uCAO/B;AAGK;IADL,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,CAAC,sBAAS,CAAC,CAAC;IACjB,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAQ,aAAK;;4CAOpC;AAGK;IADL,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,cAAM,CAAC;IAChB,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAQ,aAAK;;wCAOhC;AAGK;IADL,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,CAAC;IACb,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAQ,aAAK;;yCAOjC;AAGK;IADL,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,CAAC;IACb,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAQ,aAAK;;yCAOjC;AAvGU,UAAU;IADtB,IAAA,uBAAQ,EAAC,aAAK,CAAC;GACH,UAAU,CAwGtB;AAxGY,gCAAU","sourcesContent":["import { In } from 'typeorm'\nimport { Arg, Args, Ctx, FieldResolver, Query, Resolver, Root, Directive } from 'type-graphql'\n\nimport { User } from '@things-factory/auth-base'\nimport { Domain, getQueryBuilderFromListParams, getRepository, ListParam } from '@things-factory/shell'\n\nimport { Group } from '../group/group'\nimport { PlayGroup } from '../play-group/play-group'\nimport { Board } from './board'\nimport { BoardList } from './board-type'\n\n@Resolver(Board)\nexport class BoardQuery {\n @Query(returns => Board, { description: 'To fetch a Board' })\n @Directive('@privilege(category: \"board\", privilege: \"query\", domainOwnerGranted: true)')\n async board(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<Board> {\n const { domain } = context.state\n\n return await getRepository(Board).findOne({\n where: { domain: { id: In([domain.id, domain.parentId].filter(Boolean)) }, id }\n })\n }\n\n @Query(returns => Board, { nullable: true, description: 'To fetch a Board Model by name' })\n @Directive('@privilege(category: \"board\", privilege: \"query\", domainOwnerGranted: true)')\n async boardByName(@Arg('name') name: string, @Ctx() context: ResolverContext): Promise<Board> {\n const { domain } = context.state\n\n return await getRepository(Board).findOne({\n where: { domain: { id: In([domain.id, domain.parentId].filter(Boolean)) }, name }\n })\n }\n\n @Query(returns => BoardList, { description: 'To fetch Boards created by me' })\n async boardsCreatedByMe(@Args() params: ListParam, @Ctx() context: ResolverContext): Promise<BoardList> {\n const { domain, user } = context.state\n\n const queryBuilder = getQueryBuilderFromListParams({\n repository: getRepository(Board),\n params,\n domain,\n alias: 'board',\n searchables: ['name', 'description']\n }).andWhere('board.creator = :user', { user: user.id })\n\n const [items, total] = await queryBuilder.getManyAndCount()\n\n return { items, total }\n }\n\n @Query(returns => BoardList, { description: 'To fetch multiple Boards' })\n @Directive('@privilege(category: \"board\", privilege: \"query\", domainOwnerGranted: true)')\n async boards(@Args() params: ListParam, @Ctx() context: ResolverContext): Promise<BoardList> {\n const { domain } = context.state\n\n const queryBuilder = getQueryBuilderFromListParams({\n repository: getRepository(Board),\n params,\n domain,\n searchables: ['name', 'description']\n })\n\n const [items, total] = await queryBuilder.getManyAndCount()\n\n return { items, total }\n }\n\n @FieldResolver(type => Group)\n async group(@Root() board: Board) {\n return (\n board.groupId &&\n (await getRepository(Group).findOneBy({\n id: board.groupId\n }))\n )\n }\n\n @FieldResolver(type => [PlayGroup])\n async playGroups(@Root() board: Board) {\n return (\n await getRepository(Board).findOne({\n where: { id: board.id },\n relations: ['playGroups']\n })\n )?.playGroups\n }\n\n @FieldResolver(type => Domain)\n async domain(@Root() board: Board) {\n return (\n board.domainId &&\n (await getRepository(Domain).findOneBy({\n id: board.domainId\n }))\n )\n }\n\n @FieldResolver(type => User)\n async updater(@Root() board: Board): Promise<User> {\n return (\n board.updaterId &&\n (await getRepository(User).findOneBy({\n id: board.updaterId\n }))\n )\n }\n\n @FieldResolver(type => User)\n async creator(@Root() board: Board): Promise<User> {\n return (\n board.creatorId &&\n (await getRepository(User).findOneBy({\n id: board.creatorId\n }))\n )\n }\n}\n"]}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BoardTemplateMutation = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const type_graphql_1 = require("type-graphql");
|
|
6
|
+
const thumbnail_1 = require("../../controllers/thumbnail");
|
|
7
|
+
const board_template_1 = require("./board-template");
|
|
8
|
+
const board_template_type_1 = require("./board-template-type");
|
|
9
|
+
let BoardTemplateMutation = class BoardTemplateMutation {
|
|
10
|
+
async createBoardTemplate(boardTemplate, context) {
|
|
11
|
+
const { domain, user, tx } = context.state;
|
|
12
|
+
const repository = tx.getRepository(board_template_1.BoardTemplate);
|
|
13
|
+
const oldBoardTemplate = await repository.findOneBy({
|
|
14
|
+
name: boardTemplate.name,
|
|
15
|
+
domain: { id: domain.id }
|
|
16
|
+
});
|
|
17
|
+
if (oldBoardTemplate) {
|
|
18
|
+
throw new Error(context.t('error.board-template name is already taken', { name: boardTemplate.name }));
|
|
19
|
+
}
|
|
20
|
+
const newBoardTemplate = Object.assign({}, boardTemplate);
|
|
21
|
+
const base64 = await (0, thumbnail_1.thumbnail)({
|
|
22
|
+
model: boardTemplate.model,
|
|
23
|
+
context
|
|
24
|
+
});
|
|
25
|
+
if (base64) {
|
|
26
|
+
newBoardTemplate.thumbnail = 'data:image/png;base64,' + base64.toString('base64');
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
newBoardTemplate.thumbnail = 'data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==';
|
|
30
|
+
}
|
|
31
|
+
return await repository.save(Object.assign(Object.assign({ domain }, newBoardTemplate), { creator: user, updater: user }));
|
|
32
|
+
}
|
|
33
|
+
async updateBoardTemplate(id, patch, context) {
|
|
34
|
+
const { domain, user, tx } = context.state;
|
|
35
|
+
const repository = tx.getRepository(board_template_1.BoardTemplate);
|
|
36
|
+
const boardTemplate = await repository.findOne({
|
|
37
|
+
where: { domain: { id: domain.id }, id }
|
|
38
|
+
});
|
|
39
|
+
if (patch.model) {
|
|
40
|
+
const base64 = await (0, thumbnail_1.thumbnail)({
|
|
41
|
+
model: patch.model,
|
|
42
|
+
context
|
|
43
|
+
});
|
|
44
|
+
if (base64) {
|
|
45
|
+
patch.thumbnail = 'data:image/png;base64,' + base64.toString('base64');
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
patch.thumbnail = 'data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==';
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
return await repository.save(Object.assign(Object.assign(Object.assign({}, boardTemplate), patch), { updater: user }));
|
|
52
|
+
}
|
|
53
|
+
async deleteBoardTemplate(id, context) {
|
|
54
|
+
const { domain, tx } = context.state;
|
|
55
|
+
await tx.getRepository(board_template_1.BoardTemplate).delete({ domain: { id: domain.id }, id });
|
|
56
|
+
return true;
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
tslib_1.__decorate([
|
|
60
|
+
(0, type_graphql_1.Directive)('@transaction'),
|
|
61
|
+
(0, type_graphql_1.Directive)('@privilege(category: "board", privilege: "mutation", domainOwnerGranted: true)'),
|
|
62
|
+
(0, type_graphql_1.Mutation)(returns => board_template_1.BoardTemplate, { description: 'To create new BoardTemplate' }),
|
|
63
|
+
tslib_1.__param(0, (0, type_graphql_1.Arg)('boardTemplate')),
|
|
64
|
+
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
|
65
|
+
tslib_1.__metadata("design:type", Function),
|
|
66
|
+
tslib_1.__metadata("design:paramtypes", [board_template_type_1.NewBoardTemplate, Object]),
|
|
67
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
68
|
+
], BoardTemplateMutation.prototype, "createBoardTemplate", null);
|
|
69
|
+
tslib_1.__decorate([
|
|
70
|
+
(0, type_graphql_1.Directive)('@transaction'),
|
|
71
|
+
(0, type_graphql_1.Directive)('@privilege(category: "board", privilege: "mutation", domainOwnerGranted: true)'),
|
|
72
|
+
(0, type_graphql_1.Mutation)(returns => board_template_1.BoardTemplate, { description: 'To modify BoardTemplate information' }),
|
|
73
|
+
tslib_1.__param(0, (0, type_graphql_1.Arg)('id')),
|
|
74
|
+
tslib_1.__param(1, (0, type_graphql_1.Arg)('patch')),
|
|
75
|
+
tslib_1.__param(2, (0, type_graphql_1.Ctx)()),
|
|
76
|
+
tslib_1.__metadata("design:type", Function),
|
|
77
|
+
tslib_1.__metadata("design:paramtypes", [String, board_template_type_1.BoardTemplatePatch, Object]),
|
|
78
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
79
|
+
], BoardTemplateMutation.prototype, "updateBoardTemplate", null);
|
|
80
|
+
tslib_1.__decorate([
|
|
81
|
+
(0, type_graphql_1.Directive)('@transaction'),
|
|
82
|
+
(0, type_graphql_1.Directive)('@privilege(category: "board", privilege: "mutation", domainOwnerGranted: true)'),
|
|
83
|
+
(0, type_graphql_1.Mutation)(returns => Boolean, { description: 'To delete BoardTemplate' }),
|
|
84
|
+
tslib_1.__param(0, (0, type_graphql_1.Arg)('id')),
|
|
85
|
+
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
|
86
|
+
tslib_1.__metadata("design:type", Function),
|
|
87
|
+
tslib_1.__metadata("design:paramtypes", [String, Object]),
|
|
88
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
89
|
+
], BoardTemplateMutation.prototype, "deleteBoardTemplate", null);
|
|
90
|
+
BoardTemplateMutation = tslib_1.__decorate([
|
|
91
|
+
(0, type_graphql_1.Resolver)(board_template_1.BoardTemplate)
|
|
92
|
+
], BoardTemplateMutation);
|
|
93
|
+
exports.BoardTemplateMutation = BoardTemplateMutation;
|
|
94
|
+
//# sourceMappingURL=board-template-mutation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"board-template-mutation.js","sourceRoot":"","sources":["../../../server/service/board-template/board-template-mutation.ts"],"names":[],"mappings":";;;;AAAA,+CAAsE;AAEtE,2DAAuD;AACvD,qDAAgD;AAChD,+DAA4E;AAGrE,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,8BAAa,CAAC,CAAA;QAElD,MAAM,gBAAgB,GAAkB,MAAM,UAAU,CAAC,SAAS,CAAC;YACjE,IAAI,EAAE,aAAa,CAAC,IAAI;YACxB,MAAM,EAAE,EAAE,EAAE,EAAE,MAAM,CAAC,EAAE,EAAE;SAC1B,CAAC,CAAA;QAEF,IAAI,gBAAgB,EAAE;YACpB,MAAM,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,4CAA4C,EAAE,EAAE,IAAI,EAAE,aAAa,CAAC,IAAI,EAAE,CAAC,CAAC,CAAA;SACvG;QAED,MAAM,gBAAgB,qBACjB,aAAa,CACjB,CAAA;QAED,MAAM,MAAM,GAAG,MAAM,IAAA,qBAAS,EAAC;YAC7B,KAAK,EAAE,aAAa,CAAC,KAAK;YAC1B,OAAO;SACR,CAAC,CAAA;QAEF,IAAI,MAAM,EAAE;YACV,gBAAgB,CAAC,SAAS,GAAG,wBAAwB,GAAG,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAA;SAClF;aAAM;YACL,gBAAgB,CAAC,SAAS,GAAG,4EAA4E,CAAA;SAC1G;QAED,OAAO,MAAM,UAAU,CAAC,IAAI,+BAC1B,MAAM,IACH,gBAAgB,KACnB,OAAO,EAAE,IAAI,EACb,OAAO,EAAE,IAAI,IACb,CAAA;IACJ,CAAC;IAKK,AAAN,KAAK,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AC;IAC3F,IAAA,uBAAQ,EAAC,OAAO,CAAC,EAAE,CAAC,8BAAa,EAAE,EAAE,WAAW,EAAE,6BAA6B,EAAE,CAAC;IAEhF,mBAAA,IAAA,kBAAG,EAAC,eAAe,CAAC,CAAA;IACpB,mBAAA,IAAA,kBAAG,GAAE,CAAA;;6CAD+B,sCAAgB;;gEAoCtD;AAKK;IAHL,IAAA,wBAAS,EAAC,cAAc,CAAC;IACzB,IAAA,wBAAS,EAAC,gFAAgF,CAAC;IAC3F,IAAA,uBAAQ,EAAC,OAAO,CAAC,EAAE,CAAC,8BAAa,EAAE,EAAE,WAAW,EAAE,qCAAqC,EAAE,CAAC;IAExF,mBAAA,IAAA,kBAAG,EAAC,IAAI,CAAC,CAAA;IACT,mBAAA,IAAA,kBAAG,EAAC,OAAO,CAAC,CAAA;IACZ,mBAAA,IAAA,kBAAG,GAAE,CAAA;;qDADe,wCAAkB;;gEA4BxC;AAKK;IAHL,IAAA,wBAAS,EAAC,cAAc,CAAC;IACzB,IAAA,wBAAS,EAAC,gFAAgF,CAAC;IAC3F,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;AAvFU,qBAAqB;IADjC,IAAA,uBAAQ,EAAC,8BAAa,CAAC;GACX,qBAAqB,CAwFjC;AAxFY,sDAAqB","sourcesContent":["import { Resolver, Mutation, Arg, Ctx, Directive } from 'type-graphql'\n\nimport { thumbnail } from '../../controllers/thumbnail'\nimport { BoardTemplate } from './board-template'\nimport { NewBoardTemplate, BoardTemplatePatch } from './board-template-type'\n\n@Resolver(BoardTemplate)\nexport class BoardTemplateMutation {\n @Directive('@transaction')\n @Directive('@privilege(category: \"board\", 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\", 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\", 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"]}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BoardTemplateQuery = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const typeorm_1 = require("typeorm");
|
|
6
|
+
const type_graphql_1 = require("type-graphql");
|
|
7
|
+
const attachment_base_1 = require("@things-factory/attachment-base");
|
|
8
|
+
const shell_1 = require("@things-factory/shell");
|
|
9
|
+
const auth_base_1 = require("@things-factory/auth-base");
|
|
10
|
+
const board_template_1 = require("./board-template");
|
|
11
|
+
const board_template_type_1 = require("./board-template-type");
|
|
12
|
+
let BoardTemplateQuery = class BoardTemplateQuery {
|
|
13
|
+
async boardTemplate(id, context) {
|
|
14
|
+
const { domain } = context.state;
|
|
15
|
+
return await (0, shell_1.getRepository)(board_template_1.BoardTemplate).findOne({
|
|
16
|
+
where: { domain: { id: (0, typeorm_1.In)([domain.id, domain.parentId].filter(Boolean)) }, id }
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
async boardTemplateByName(name, context) {
|
|
20
|
+
const { domain } = context.state;
|
|
21
|
+
return await (0, shell_1.getRepository)(board_template_1.BoardTemplate).findOne({
|
|
22
|
+
where: { domain: { id: (0, typeorm_1.In)([domain.id, domain.parentId].filter(Boolean)) }, name }
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
async boardTemplatesCreatedByMe(params, context) {
|
|
26
|
+
const { domain, user } = context.state;
|
|
27
|
+
const queryBuilder = (0, shell_1.getQueryBuilderFromListParams)({
|
|
28
|
+
repository: (0, shell_1.getRepository)(board_template_1.BoardTemplate),
|
|
29
|
+
params,
|
|
30
|
+
domain,
|
|
31
|
+
alias: 'template',
|
|
32
|
+
searchables: ['name', 'description']
|
|
33
|
+
}).andWhere('template.creator = :user', { user: user.id });
|
|
34
|
+
const [items, total] = await queryBuilder.getManyAndCount();
|
|
35
|
+
return { items, total };
|
|
36
|
+
}
|
|
37
|
+
async boardTemplates(params, context) {
|
|
38
|
+
const { domain } = context.state;
|
|
39
|
+
const queryBuilder = (0, shell_1.getQueryBuilderFromListParams)({
|
|
40
|
+
domain,
|
|
41
|
+
params,
|
|
42
|
+
repository: await (0, shell_1.getRepository)(board_template_1.BoardTemplate),
|
|
43
|
+
searchables: ['name', 'description']
|
|
44
|
+
});
|
|
45
|
+
const [items, total] = await queryBuilder.getManyAndCount();
|
|
46
|
+
return { items, total };
|
|
47
|
+
}
|
|
48
|
+
async thumbnail(boardTemplate) {
|
|
49
|
+
const attachment = await (0, shell_1.getRepository)(attachment_base_1.Attachment).findOne({
|
|
50
|
+
where: {
|
|
51
|
+
domain: { id: boardTemplate.domainId },
|
|
52
|
+
refType: board_template_1.BoardTemplate.name,
|
|
53
|
+
refBy: boardTemplate.id
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
return attachment === null || attachment === void 0 ? void 0 : attachment.fullpath;
|
|
57
|
+
}
|
|
58
|
+
async domain(boardTemplate) {
|
|
59
|
+
return boardTemplate.domainId && (await (0, shell_1.getRepository)(shell_1.Domain).findOneBy({ id: boardTemplate.domainId }));
|
|
60
|
+
}
|
|
61
|
+
async updater(boardTemplate) {
|
|
62
|
+
return boardTemplate.updaterId && (await (0, shell_1.getRepository)(auth_base_1.User).findOneBy({ id: boardTemplate.updaterId }));
|
|
63
|
+
}
|
|
64
|
+
async creator(boardTemplate) {
|
|
65
|
+
return boardTemplate.creatorId && (await (0, shell_1.getRepository)(auth_base_1.User).findOneBy({ id: boardTemplate.creatorId }));
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
tslib_1.__decorate([
|
|
69
|
+
(0, type_graphql_1.Query)(returns => board_template_1.BoardTemplate, { nullable: true, description: 'To fetch a BoardTemplate' }),
|
|
70
|
+
(0, type_graphql_1.Directive)('@privilege(category: "board", privilege: "query", domainOwnerGranted: true)'),
|
|
71
|
+
tslib_1.__param(0, (0, type_graphql_1.Arg)('id')),
|
|
72
|
+
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
|
73
|
+
tslib_1.__metadata("design:type", Function),
|
|
74
|
+
tslib_1.__metadata("design:paramtypes", [String, Object]),
|
|
75
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
76
|
+
], BoardTemplateQuery.prototype, "boardTemplate", null);
|
|
77
|
+
tslib_1.__decorate([
|
|
78
|
+
(0, type_graphql_1.Query)(returns => board_template_1.BoardTemplate, { nullable: true, description: 'To fetch a BoardTemplate by name' }),
|
|
79
|
+
(0, type_graphql_1.Directive)('@privilege(category: "board", privilege: "query", domainOwnerGranted: true)'),
|
|
80
|
+
tslib_1.__param(0, (0, type_graphql_1.Arg)('name')),
|
|
81
|
+
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
|
82
|
+
tslib_1.__metadata("design:type", Function),
|
|
83
|
+
tslib_1.__metadata("design:paramtypes", [String, Object]),
|
|
84
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
85
|
+
], BoardTemplateQuery.prototype, "boardTemplateByName", null);
|
|
86
|
+
tslib_1.__decorate([
|
|
87
|
+
(0, type_graphql_1.Query)(returns => board_template_type_1.BoardTemplateList, { description: 'To fetch BoardTemplates created by me' }),
|
|
88
|
+
tslib_1.__param(0, (0, type_graphql_1.Args)()),
|
|
89
|
+
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
|
90
|
+
tslib_1.__metadata("design:type", Function),
|
|
91
|
+
tslib_1.__metadata("design:paramtypes", [shell_1.ListParam, Object]),
|
|
92
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
93
|
+
], BoardTemplateQuery.prototype, "boardTemplatesCreatedByMe", null);
|
|
94
|
+
tslib_1.__decorate([
|
|
95
|
+
(0, type_graphql_1.Query)(returns => board_template_type_1.BoardTemplateList, { description: 'To fetch multiple BoardTemplates' }),
|
|
96
|
+
(0, type_graphql_1.Directive)('@privilege(category: "board", privilege: "query", domainOwnerGranted: true)'),
|
|
97
|
+
tslib_1.__param(0, (0, type_graphql_1.Args)()),
|
|
98
|
+
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
|
99
|
+
tslib_1.__metadata("design:type", Function),
|
|
100
|
+
tslib_1.__metadata("design:paramtypes", [shell_1.ListParam, Object]),
|
|
101
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
102
|
+
], BoardTemplateQuery.prototype, "boardTemplates", null);
|
|
103
|
+
tslib_1.__decorate([
|
|
104
|
+
(0, type_graphql_1.FieldResolver)(type => String),
|
|
105
|
+
tslib_1.__param(0, (0, type_graphql_1.Root)()),
|
|
106
|
+
tslib_1.__metadata("design:type", Function),
|
|
107
|
+
tslib_1.__metadata("design:paramtypes", [board_template_1.BoardTemplate]),
|
|
108
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
109
|
+
], BoardTemplateQuery.prototype, "thumbnail", null);
|
|
110
|
+
tslib_1.__decorate([
|
|
111
|
+
(0, type_graphql_1.FieldResolver)(type => shell_1.Domain),
|
|
112
|
+
tslib_1.__param(0, (0, type_graphql_1.Root)()),
|
|
113
|
+
tslib_1.__metadata("design:type", Function),
|
|
114
|
+
tslib_1.__metadata("design:paramtypes", [board_template_1.BoardTemplate]),
|
|
115
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
116
|
+
], BoardTemplateQuery.prototype, "domain", null);
|
|
117
|
+
tslib_1.__decorate([
|
|
118
|
+
(0, type_graphql_1.FieldResolver)(type => auth_base_1.User),
|
|
119
|
+
tslib_1.__param(0, (0, type_graphql_1.Root)()),
|
|
120
|
+
tslib_1.__metadata("design:type", Function),
|
|
121
|
+
tslib_1.__metadata("design:paramtypes", [board_template_1.BoardTemplate]),
|
|
122
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
123
|
+
], BoardTemplateQuery.prototype, "updater", null);
|
|
124
|
+
tslib_1.__decorate([
|
|
125
|
+
(0, type_graphql_1.FieldResolver)(type => auth_base_1.User),
|
|
126
|
+
tslib_1.__param(0, (0, type_graphql_1.Root)()),
|
|
127
|
+
tslib_1.__metadata("design:type", Function),
|
|
128
|
+
tslib_1.__metadata("design:paramtypes", [board_template_1.BoardTemplate]),
|
|
129
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
130
|
+
], BoardTemplateQuery.prototype, "creator", null);
|
|
131
|
+
BoardTemplateQuery = tslib_1.__decorate([
|
|
132
|
+
(0, type_graphql_1.Resolver)(board_template_1.BoardTemplate)
|
|
133
|
+
], BoardTemplateQuery);
|
|
134
|
+
exports.BoardTemplateQuery = BoardTemplateQuery;
|
|
135
|
+
//# sourceMappingURL=board-template-query.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"board-template-query.js","sourceRoot":"","sources":["../../../server/service/board-template/board-template-query.ts"],"names":[],"mappings":";;;;AAAA,qCAA4B;AAC5B,+CAA8F;AAC9F,qEAA4D;AAC5D,iDAAuG;AACvG,yDAAgD;AAChD,qDAAgD;AAChD,+DAAyD;AAGlD,IAAM,kBAAkB,GAAxB,MAAM,kBAAkB;IAGvB,AAAN,KAAK,CAAC,aAAa,CAAY,EAAU,EAAS,OAAwB;QACxE,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAEhC,OAAO,MAAM,IAAA,qBAAa,EAAC,8BAAa,CAAC,CAAC,OAAO,CAAC;YAChD,KAAK,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,IAAA,YAAE,EAAC,CAAC,MAAM,CAAC,EAAE,EAAE,MAAM,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE;SAChF,CAAC,CAAA;IACJ,CAAC;IAIK,AAAN,KAAK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A;;6CAAgB,8BAAa;;gDAEhD;AAGK;IADL,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,CAAC;IACb,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAgB,8BAAa;;iDAEjD;AAGK;IADL,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,CAAC;IACb,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAgB,8BAAa;;iDAEjD;AApFU,kBAAkB;IAD9B,IAAA,uBAAQ,EAAC,8BAAa,CAAC;GACX,kBAAkB,CAqF9B;AArFY,gDAAkB","sourcesContent":["import { In } from 'typeorm'\nimport { Resolver, Query, FieldResolver, Root, Args, Arg, Ctx, Directive } from 'type-graphql'\nimport { Attachment } from '@things-factory/attachment-base'\nimport { Domain, getQueryBuilderFromListParams, getRepository, ListParam } from '@things-factory/shell'\nimport { User } from '@things-factory/auth-base'\nimport { BoardTemplate } from './board-template'\nimport { BoardTemplateList } from './board-template-type'\n\n@Resolver(BoardTemplate)\nexport class BoardTemplateQuery {\n @Query(returns => BoardTemplate!, { nullable: true, description: 'To fetch a BoardTemplate' })\n @Directive('@privilege(category: \"board\", privilege: \"query\", domainOwnerGranted: true)')\n async boardTemplate(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<BoardTemplate> {\n const { domain } = context.state\n\n return await getRepository(BoardTemplate).findOne({\n where: { domain: { id: In([domain.id, domain.parentId].filter(Boolean)) }, id }\n })\n }\n\n @Query(returns => BoardTemplate, { nullable: true, description: 'To fetch a BoardTemplate by name' })\n @Directive('@privilege(category: \"board\", privilege: \"query\", domainOwnerGranted: true)')\n async boardTemplateByName(@Arg('name') name: string, @Ctx() context: ResolverContext): Promise<BoardTemplate> {\n const { domain } = context.state\n\n return await getRepository(BoardTemplate).findOne({\n where: { domain: { id: In([domain.id, domain.parentId].filter(Boolean)) }, name }\n })\n }\n\n @Query(returns => BoardTemplateList, { description: 'To fetch BoardTemplates created by me' })\n async boardTemplatesCreatedByMe(\n @Args() params: ListParam,\n @Ctx() context: ResolverContext\n ): Promise<BoardTemplateList> {\n const { domain, user } = context.state\n\n const queryBuilder = getQueryBuilderFromListParams({\n repository: getRepository(BoardTemplate),\n params,\n domain,\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\", privilege: \"query\", domainOwnerGranted: true)')\n async boardTemplates(@Args() params: ListParam, @Ctx() context: ResolverContext): Promise<BoardTemplateList> {\n const { domain } = context.state\n\n const queryBuilder = getQueryBuilderFromListParams({\n domain,\n params,\n repository: await getRepository(BoardTemplate),\n searchables: ['name', 'description']\n })\n\n const [items, total] = await queryBuilder.getManyAndCount()\n\n return { items, total }\n }\n\n @FieldResolver(type => String)\n async thumbnail(@Root() boardTemplate: BoardTemplate): Promise<string | undefined> {\n const attachment: Attachment = await getRepository(Attachment).findOne({\n where: {\n domain: { id: boardTemplate.domainId },\n refType: BoardTemplate.name,\n refBy: boardTemplate.id\n }\n })\n\n return attachment?.fullpath\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"]}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BoardTemplateList = exports.BoardTemplatePatch = exports.NewBoardTemplate = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const type_graphql_1 = require("type-graphql");
|
|
6
|
+
const board_template_1 = require("./board-template");
|
|
7
|
+
let NewBoardTemplate = class NewBoardTemplate {
|
|
8
|
+
};
|
|
9
|
+
tslib_1.__decorate([
|
|
10
|
+
(0, type_graphql_1.Field)(),
|
|
11
|
+
tslib_1.__metadata("design:type", String)
|
|
12
|
+
], NewBoardTemplate.prototype, "name", void 0);
|
|
13
|
+
tslib_1.__decorate([
|
|
14
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
|
15
|
+
tslib_1.__metadata("design:type", String)
|
|
16
|
+
], NewBoardTemplate.prototype, "description", void 0);
|
|
17
|
+
tslib_1.__decorate([
|
|
18
|
+
(0, type_graphql_1.Field)(type => board_template_1.BoardTemplateStatus, { nullable: true }),
|
|
19
|
+
tslib_1.__metadata("design:type", String)
|
|
20
|
+
], NewBoardTemplate.prototype, "state", void 0);
|
|
21
|
+
tslib_1.__decorate([
|
|
22
|
+
(0, type_graphql_1.Field)(),
|
|
23
|
+
tslib_1.__metadata("design:type", String)
|
|
24
|
+
], NewBoardTemplate.prototype, "model", void 0);
|
|
25
|
+
tslib_1.__decorate([
|
|
26
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
|
27
|
+
tslib_1.__metadata("design:type", String)
|
|
28
|
+
], NewBoardTemplate.prototype, "thumbnail", void 0);
|
|
29
|
+
NewBoardTemplate = tslib_1.__decorate([
|
|
30
|
+
(0, type_graphql_1.InputType)()
|
|
31
|
+
], NewBoardTemplate);
|
|
32
|
+
exports.NewBoardTemplate = NewBoardTemplate;
|
|
33
|
+
let BoardTemplatePatch = class BoardTemplatePatch {
|
|
34
|
+
};
|
|
35
|
+
tslib_1.__decorate([
|
|
36
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.ID, { nullable: true }),
|
|
37
|
+
tslib_1.__metadata("design:type", String)
|
|
38
|
+
], BoardTemplatePatch.prototype, "id", void 0);
|
|
39
|
+
tslib_1.__decorate([
|
|
40
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
|
41
|
+
tslib_1.__metadata("design:type", String)
|
|
42
|
+
], BoardTemplatePatch.prototype, "name", void 0);
|
|
43
|
+
tslib_1.__decorate([
|
|
44
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
|
45
|
+
tslib_1.__metadata("design:type", String)
|
|
46
|
+
], BoardTemplatePatch.prototype, "description", void 0);
|
|
47
|
+
tslib_1.__decorate([
|
|
48
|
+
(0, type_graphql_1.Field)(type => board_template_1.BoardTemplateStatus, { nullable: true }),
|
|
49
|
+
tslib_1.__metadata("design:type", String)
|
|
50
|
+
], BoardTemplatePatch.prototype, "state", void 0);
|
|
51
|
+
tslib_1.__decorate([
|
|
52
|
+
(0, type_graphql_1.Field)(),
|
|
53
|
+
tslib_1.__metadata("design:type", String)
|
|
54
|
+
], BoardTemplatePatch.prototype, "model", void 0);
|
|
55
|
+
tslib_1.__decorate([
|
|
56
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
|
57
|
+
tslib_1.__metadata("design:type", String)
|
|
58
|
+
], BoardTemplatePatch.prototype, "thumbnail", void 0);
|
|
59
|
+
tslib_1.__decorate([
|
|
60
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
|
61
|
+
tslib_1.__metadata("design:type", String)
|
|
62
|
+
], BoardTemplatePatch.prototype, "cuFlag", void 0);
|
|
63
|
+
BoardTemplatePatch = tslib_1.__decorate([
|
|
64
|
+
(0, type_graphql_1.InputType)()
|
|
65
|
+
], BoardTemplatePatch);
|
|
66
|
+
exports.BoardTemplatePatch = BoardTemplatePatch;
|
|
67
|
+
let BoardTemplateList = class BoardTemplateList {
|
|
68
|
+
};
|
|
69
|
+
tslib_1.__decorate([
|
|
70
|
+
(0, type_graphql_1.Field)(type => [board_template_1.BoardTemplate]),
|
|
71
|
+
tslib_1.__metadata("design:type", Array)
|
|
72
|
+
], BoardTemplateList.prototype, "items", void 0);
|
|
73
|
+
tslib_1.__decorate([
|
|
74
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.Int),
|
|
75
|
+
tslib_1.__metadata("design:type", Number)
|
|
76
|
+
], BoardTemplateList.prototype, "total", void 0);
|
|
77
|
+
BoardTemplateList = tslib_1.__decorate([
|
|
78
|
+
(0, type_graphql_1.ObjectType)()
|
|
79
|
+
], BoardTemplateList);
|
|
80
|
+
exports.BoardTemplateList = BoardTemplateList;
|
|
81
|
+
//# sourceMappingURL=board-template-type.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"board-template-type.js","sourceRoot":"","sources":["../../../server/service/board-template/board-template-type.ts"],"names":[],"mappings":";;;;AAEA,+CAAsF;AAItF,qDAAqE;AAG9D,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB;CAe5B,CAAA;AAdC;IAAC,IAAA,oBAAK,GAAE;;8CACI;AAEZ;IAAC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;qDACN;AAEpB;IAAC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,oCAAmB,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;+CAC5B;AAE3B;IAAC,IAAA,oBAAK,GAAE;;+CACK;AAEb;IAAC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;mDACR;AAdP,gBAAgB;IAD5B,IAAA,wBAAS,GAAE;GACC,gBAAgB,CAe5B;AAfY,4CAAgB;AAkBtB,IAAM,kBAAkB,GAAxB,MAAM,kBAAkB;CAqB9B,CAAA;AApBC;IAAC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,iBAAE,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;8CAC3B;AAEX;IAAC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;gDACb;AAEb;IAAC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;uDACN;AAEpB;IAAC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,oCAAmB,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;iDAC5B;AAE3B;IAAC,IAAA,oBAAK,GAAE;;iDACK;AAEb;IAAC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;qDACR;AAElB;IAAC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;kDACX;AApBJ,kBAAkB;IAD9B,IAAA,wBAAS,GAAE;GACC,kBAAkB,CAqB9B;AArBY,gDAAkB;AAwBxB,IAAM,iBAAiB,GAAvB,MAAM,iBAAiB;CAM7B,CAAA;AALC;IAAC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,CAAC,8BAAa,CAAC,CAAC;;gDACT;AAEtB;IAAC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,kBAAG,CAAC;;gDACN;AALF,iBAAiB;IAD7B,IAAA,yBAAU,GAAE;GACA,iBAAiB,CAM7B;AANY,8CAAiB","sourcesContent":["import type { FileUpload } from 'graphql-upload/GraphQLUpload.js'\nimport GraphQLUpload from 'graphql-upload/GraphQLUpload.js'\nimport { ObjectType, Field, InputType, Int, ID, registerEnumType } from 'type-graphql'\n\nimport { ObjectRef, ScalarObject } from '@things-factory/shell'\n\nimport { BoardTemplate, BoardTemplateStatus } from './board-template'\n\n@InputType()\nexport class NewBoardTemplate {\n @Field()\n name: string\n\n @Field({ nullable: true })\n description?: string\n\n @Field(type => BoardTemplateStatus, { nullable: true })\n state?: BoardTemplateStatus\n\n @Field()\n model: string\n\n @Field({ nullable: true })\n thumbnail?: string\n}\n\n@InputType()\nexport class BoardTemplatePatch {\n @Field(type => ID, { nullable: true })\n id?: string\n\n @Field({ nullable: true })\n name?: string\n\n @Field({ nullable: true })\n description?: string\n\n @Field(type => BoardTemplateStatus, { nullable: true })\n state?: BoardTemplateStatus\n\n @Field()\n model: string\n\n @Field({ nullable: true })\n thumbnail?: string\n\n @Field({ nullable: true })\n cuFlag?: string\n}\n\n@ObjectType()\nexport class BoardTemplateList {\n @Field(type => [BoardTemplate])\n items: BoardTemplate[]\n\n @Field(type => Int)\n total: number\n}\n"]}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BoardTemplate = exports.BoardTemplateStatus = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const typeorm_1 = require("typeorm");
|
|
6
|
+
const type_graphql_1 = require("type-graphql");
|
|
7
|
+
const shell_1 = require("@things-factory/shell");
|
|
8
|
+
const auth_base_1 = require("@things-factory/auth-base");
|
|
9
|
+
const env_1 = require("@things-factory/env");
|
|
10
|
+
const ORMCONFIG = env_1.config.get('ormconfig', {});
|
|
11
|
+
const DATABASE_TYPE = ORMCONFIG.type;
|
|
12
|
+
var BoardTemplateStatus;
|
|
13
|
+
(function (BoardTemplateStatus) {
|
|
14
|
+
BoardTemplateStatus["DRAFT"] = "DRAFT";
|
|
15
|
+
BoardTemplateStatus["RELEASED"] = "RELEASED";
|
|
16
|
+
})(BoardTemplateStatus = exports.BoardTemplateStatus || (exports.BoardTemplateStatus = {}));
|
|
17
|
+
(0, type_graphql_1.registerEnumType)(BoardTemplateStatus, {
|
|
18
|
+
name: 'BoardTemplateStatus',
|
|
19
|
+
description: 'state enumeration of a boardTemplate'
|
|
20
|
+
});
|
|
21
|
+
let BoardTemplate = class BoardTemplate {
|
|
22
|
+
constructor() {
|
|
23
|
+
this.version = 1;
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
tslib_1.__decorate([
|
|
27
|
+
(0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
|
|
28
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.ID),
|
|
29
|
+
tslib_1.__metadata("design:type", String)
|
|
30
|
+
], BoardTemplate.prototype, "id", void 0);
|
|
31
|
+
tslib_1.__decorate([
|
|
32
|
+
(0, typeorm_1.VersionColumn)(),
|
|
33
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
|
34
|
+
tslib_1.__metadata("design:type", Number)
|
|
35
|
+
], BoardTemplate.prototype, "version", void 0);
|
|
36
|
+
tslib_1.__decorate([
|
|
37
|
+
(0, typeorm_1.ManyToOne)(type => shell_1.Domain),
|
|
38
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
|
39
|
+
tslib_1.__metadata("design:type", shell_1.Domain)
|
|
40
|
+
], BoardTemplate.prototype, "domain", void 0);
|
|
41
|
+
tslib_1.__decorate([
|
|
42
|
+
(0, typeorm_1.RelationId)((boardTemplate) => boardTemplate.domain),
|
|
43
|
+
tslib_1.__metadata("design:type", String)
|
|
44
|
+
], BoardTemplate.prototype, "domainId", void 0);
|
|
45
|
+
tslib_1.__decorate([
|
|
46
|
+
(0, typeorm_1.Column)(),
|
|
47
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
|
48
|
+
tslib_1.__metadata("design:type", String)
|
|
49
|
+
], BoardTemplate.prototype, "name", void 0);
|
|
50
|
+
tslib_1.__decorate([
|
|
51
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
|
52
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
|
53
|
+
tslib_1.__metadata("design:type", String)
|
|
54
|
+
], BoardTemplate.prototype, "description", void 0);
|
|
55
|
+
tslib_1.__decorate([
|
|
56
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
|
57
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
|
58
|
+
tslib_1.__metadata("design:type", String)
|
|
59
|
+
], BoardTemplate.prototype, "state", void 0);
|
|
60
|
+
tslib_1.__decorate([
|
|
61
|
+
(0, typeorm_1.Column)({
|
|
62
|
+
nullable: true,
|
|
63
|
+
type: DATABASE_TYPE == 'mysql' || DATABASE_TYPE == 'mariadb'
|
|
64
|
+
? 'longtext'
|
|
65
|
+
: DATABASE_TYPE == 'oracle'
|
|
66
|
+
? 'clob'
|
|
67
|
+
: 'varchar'
|
|
68
|
+
}),
|
|
69
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
|
70
|
+
tslib_1.__metadata("design:type", String)
|
|
71
|
+
], BoardTemplate.prototype, "model", void 0);
|
|
72
|
+
tslib_1.__decorate([
|
|
73
|
+
(0, typeorm_1.Column)({
|
|
74
|
+
nullable: true,
|
|
75
|
+
type: DATABASE_TYPE == 'mysql' || DATABASE_TYPE == 'mariadb'
|
|
76
|
+
? 'longtext'
|
|
77
|
+
: DATABASE_TYPE == 'oracle'
|
|
78
|
+
? 'clob'
|
|
79
|
+
: 'varchar'
|
|
80
|
+
}),
|
|
81
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
|
82
|
+
tslib_1.__metadata("design:type", String)
|
|
83
|
+
], BoardTemplate.prototype, "thumbnail", void 0);
|
|
84
|
+
tslib_1.__decorate([
|
|
85
|
+
(0, typeorm_1.CreateDateColumn)(),
|
|
86
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
|
87
|
+
tslib_1.__metadata("design:type", Date)
|
|
88
|
+
], BoardTemplate.prototype, "createdAt", void 0);
|
|
89
|
+
tslib_1.__decorate([
|
|
90
|
+
(0, typeorm_1.UpdateDateColumn)(),
|
|
91
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
|
92
|
+
tslib_1.__metadata("design:type", Date)
|
|
93
|
+
], BoardTemplate.prototype, "updatedAt", void 0);
|
|
94
|
+
tslib_1.__decorate([
|
|
95
|
+
(0, typeorm_1.ManyToOne)(type => auth_base_1.User, { nullable: true }),
|
|
96
|
+
(0, type_graphql_1.Field)(type => auth_base_1.User, { nullable: true }),
|
|
97
|
+
tslib_1.__metadata("design:type", auth_base_1.User)
|
|
98
|
+
], BoardTemplate.prototype, "creator", void 0);
|
|
99
|
+
tslib_1.__decorate([
|
|
100
|
+
(0, typeorm_1.RelationId)((boardTemplate) => boardTemplate.creator),
|
|
101
|
+
tslib_1.__metadata("design:type", String)
|
|
102
|
+
], BoardTemplate.prototype, "creatorId", void 0);
|
|
103
|
+
tslib_1.__decorate([
|
|
104
|
+
(0, typeorm_1.ManyToOne)(type => auth_base_1.User, { nullable: true }),
|
|
105
|
+
(0, type_graphql_1.Field)(type => auth_base_1.User, { nullable: true }),
|
|
106
|
+
tslib_1.__metadata("design:type", auth_base_1.User)
|
|
107
|
+
], BoardTemplate.prototype, "updater", void 0);
|
|
108
|
+
tslib_1.__decorate([
|
|
109
|
+
(0, typeorm_1.RelationId)((boardTemplate) => boardTemplate.updater),
|
|
110
|
+
tslib_1.__metadata("design:type", String)
|
|
111
|
+
], BoardTemplate.prototype, "updaterId", void 0);
|
|
112
|
+
BoardTemplate = tslib_1.__decorate([
|
|
113
|
+
(0, typeorm_1.Entity)(),
|
|
114
|
+
(0, typeorm_1.Index)('ix_board_template_0', (boardTemplate) => [boardTemplate.domain, boardTemplate.name], {
|
|
115
|
+
unique: true
|
|
116
|
+
}),
|
|
117
|
+
(0, type_graphql_1.ObjectType)({ description: 'Entity for BoardTemplate' })
|
|
118
|
+
], BoardTemplate);
|
|
119
|
+
exports.BoardTemplate = BoardTemplate;
|
|
120
|
+
//# sourceMappingURL=board-template.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"board-template.js","sourceRoot":"","sources":["../../../server/service/board-template/board-template.ts"],"names":[],"mappings":";;;;AAAA,qCAUgB;AAChB,+CAA2E;AAE3E,iDAA8C;AAC9C,yDAAgD;AAChD,6CAA4C;AAE5C,MAAM,SAAS,GAAG,YAAM,CAAC,GAAG,CAAC,WAAW,EAAE,EAAE,CAAC,CAAA;AAC7C,MAAM,aAAa,GAAG,SAAS,CAAC,IAAI,CAAA;AAEpC,IAAY,mBAGX;AAHD,WAAY,mBAAmB;IAC7B,sCAAe,CAAA;IACf,4CAAqB,CAAA;AACvB,CAAC,EAHW,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IAAI,EAAE,CAAC;sCAC9B,gBAAI;8CAAA;AAEd;IAAC,IAAA,oBAAU,EAAC,CAAC,aAA4B,EAAE,EAAE,CAAC,aAAa,CAAC,OAAO,CAAC;;gDAClD;AAxEP,aAAa;IALzB,IAAA,gBAAM,GAAE;IACR,IAAA,eAAK,EAAC,qBAAqB,EAAE,CAAC,aAA4B,EAAE,EAAE,CAAC,CAAC,aAAa,CAAC,MAAM,EAAE,aAAa,CAAC,IAAI,CAAC,EAAE;QAC1G,MAAM,EAAE,IAAI;KACb,CAAC;IACD,IAAA,yBAAU,EAAC,EAAE,WAAW,EAAE,0BAA0B,EAAE,CAAC;GAC3C,aAAa,CAyEzB;AAzEY,sCAAa","sourcesContent":["import {\n CreateDateColumn,\n UpdateDateColumn,\n Entity,\n Index,\n Column,\n RelationId,\n ManyToOne,\n PrimaryGeneratedColumn,\n VersionColumn\n} from 'typeorm'\nimport { ObjectType, Field, Int, ID, registerEnumType } from 'type-graphql'\n\nimport { Domain } from '@things-factory/shell'\nimport { User } from '@things-factory/auth-base'\nimport { config } from '@things-factory/env'\n\nconst ORMCONFIG = config.get('ormconfig', {})\nconst DATABASE_TYPE = ORMCONFIG.type\n\nexport enum BoardTemplateStatus {\n DRAFT = 'DRAFT',\n RELEASED = 'RELEASED'\n}\n\nregisterEnumType(BoardTemplateStatus, {\n name: 'BoardTemplateStatus',\n description: 'state enumeration of a boardTemplate'\n})\n\n@Entity()\n@Index('ix_board_template_0', (boardTemplate: BoardTemplate) => [boardTemplate.domain, boardTemplate.name], {\n unique: true\n})\n@ObjectType({ description: 'Entity for BoardTemplate' })\nexport class BoardTemplate {\n @PrimaryGeneratedColumn('uuid')\n @Field(type => ID)\n readonly id: string\n\n @VersionColumn()\n @Field({ nullable: true })\n version?: number = 1\n\n @ManyToOne(type => Domain)\n @Field({ nullable: true })\n domain?: Domain\n\n @RelationId((boardTemplate: BoardTemplate) => boardTemplate.domain)\n domainId?: string\n\n @Column()\n @Field({ nullable: true })\n name?: string\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n description?: string\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n state?: BoardTemplateStatus\n\n @Column({\n nullable: true,\n type:\n DATABASE_TYPE == 'mysql' || DATABASE_TYPE == 'mariadb'\n ? 'longtext'\n : DATABASE_TYPE == 'oracle'\n ? 'clob'\n : 'varchar'\n })\n @Field({ nullable: true })\n model?: string\n\n @Column({\n nullable: true,\n type:\n DATABASE_TYPE == 'mysql' || DATABASE_TYPE == 'mariadb'\n ? 'longtext'\n : DATABASE_TYPE == 'oracle'\n ? 'clob'\n : 'varchar'\n })\n @Field({ nullable: true })\n thumbnail?: string\n\n @CreateDateColumn()\n @Field({ nullable: true })\n createdAt?: Date\n\n @UpdateDateColumn()\n @Field({ nullable: true })\n updatedAt?: Date\n\n @ManyToOne(type => User, { nullable: true })\n @Field(type => User, { nullable: true })\n creator?: User\n\n @RelationId((boardTemplate: BoardTemplate) => boardTemplate.creator)\n creatorId?: string\n\n @ManyToOne(type => User, { nullable: true })\n @Field(type => User, { nullable: true })\n updater?: User\n\n @RelationId((boardTemplate: BoardTemplate) => boardTemplate.updater)\n updaterId?: string\n}\n"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.subscribers = exports.resolvers = exports.entities = void 0;
|
|
4
|
+
const board_template_1 = require("./board-template");
|
|
5
|
+
const board_template_query_1 = require("./board-template-query");
|
|
6
|
+
const board_template_mutation_1 = require("./board-template-mutation");
|
|
7
|
+
exports.entities = [board_template_1.BoardTemplate];
|
|
8
|
+
exports.resolvers = [board_template_query_1.BoardTemplateQuery, board_template_mutation_1.BoardTemplateMutation];
|
|
9
|
+
exports.subscribers = [];
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../server/service/board-template/index.ts"],"names":[],"mappings":";;;AAAA,qDAAgD;AAChD,iEAA2D;AAC3D,uEAAiE;AAEpD,QAAA,QAAQ,GAAG,CAAC,8BAAa,CAAC,CAAA;AAC1B,QAAA,SAAS,GAAG,CAAC,yCAAkB,EAAE,+CAAqB,CAAC,CAAA;AACvD,QAAA,WAAW,GAAG,EAAE,CAAA","sourcesContent":["import { BoardTemplate } from './board-template'\nimport { BoardTemplateQuery } from './board-template-query'\nimport { BoardTemplateMutation } from './board-template-mutation'\n\nexport const entities = [BoardTemplate]\nexport const resolvers = [BoardTemplateQuery, BoardTemplateMutation]\nexport const subscribers = []\n"]}
|
|
@@ -3,17 +3,20 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.schema = exports.subscribers = exports.entities = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
/* EXPORT ENTITY TYPES */
|
|
6
|
+
tslib_1.__exportStar(require("./board-template/board-template"), exports);
|
|
6
7
|
tslib_1.__exportStar(require("./theme/theme"), exports);
|
|
7
8
|
tslib_1.__exportStar(require("./board/board"), exports);
|
|
8
9
|
tslib_1.__exportStar(require("./group/group"), exports);
|
|
9
10
|
tslib_1.__exportStar(require("./play-group/play-group"), exports);
|
|
10
11
|
/* IMPORT ENTITIES AND RESOLVERS */
|
|
12
|
+
const board_template_1 = require("./board-template");
|
|
11
13
|
const theme_1 = require("./theme");
|
|
12
14
|
const board_1 = require("./board");
|
|
13
15
|
const group_1 = require("./group");
|
|
14
16
|
const play_group_1 = require("./play-group");
|
|
15
17
|
exports.entities = [
|
|
16
18
|
/* ENTITIES */
|
|
19
|
+
...board_template_1.entities,
|
|
17
20
|
...theme_1.entities,
|
|
18
21
|
...board_1.entities,
|
|
19
22
|
...group_1.entities,
|
|
@@ -21,6 +24,7 @@ exports.entities = [
|
|
|
21
24
|
];
|
|
22
25
|
exports.subscribers = [
|
|
23
26
|
/* SUBSCRIBERS */
|
|
27
|
+
...board_template_1.subscribers,
|
|
24
28
|
...theme_1.subscribers,
|
|
25
29
|
...board_1.subscribers,
|
|
26
30
|
...play_group_1.subscribers
|
|
@@ -28,6 +32,7 @@ exports.subscribers = [
|
|
|
28
32
|
exports.schema = {
|
|
29
33
|
resolverClasses: [
|
|
30
34
|
/* RESOLVER CLASSES */
|
|
35
|
+
...board_template_1.resolvers,
|
|
31
36
|
...theme_1.resolvers,
|
|
32
37
|
...board_1.resolvers,
|
|
33
38
|
...group_1.resolvers,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../server/service/index.ts"],"names":[],"mappings":";;;;AAAA,yBAAyB;AACzB,wDAA6B;AAC7B,wDAA6B;AAC7B,wDAA6B;AAC7B,kEAAuC;AAEvC,mCAAmC;AACnC,mCAAiH;AACjH,mCAAiH;AACjH,mCAAgF;AAChF,6CAIqB;AAER,QAAA,QAAQ,GAAG;IACtB,cAAc;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../server/service/index.ts"],"names":[],"mappings":";;;;AAAA,yBAAyB;AACzB,0EAA+C;AAC/C,wDAA6B;AAC7B,wDAA6B;AAC7B,wDAA6B;AAC7B,kEAAuC;AAEvC,mCAAmC;AACnC,qDAAkJ;AAClJ,mCAAiH;AACjH,mCAAiH;AACjH,mCAAgF;AAChF,6CAIqB;AAER,QAAA,QAAQ,GAAG;IACtB,cAAc;IACf,GAAG,yBAAqB;IACvB,GAAG,gBAAa;IAChB,GAAG,gBAAa;IAChB,GAAG,gBAAa;IAChB,GAAG,qBAAiB;CACrB,CAAA;AAEY,QAAA,WAAW,GAAG;IACzB,iBAAiB;IAClB,GAAG,4BAAwB;IAC1B,GAAG,mBAAgB;IACnB,GAAG,mBAAgB;IACnB,GAAG,wBAAoB;CACxB,CAAA;AAEY,QAAA,MAAM,GAAG;IACpB,eAAe,EAAE;QACf,sBAAsB;QACxB,GAAG,0BAAsB;QACvB,GAAG,iBAAc;QACjB,GAAG,iBAAc;QACjB,GAAG,iBAAc;QACjB,GAAG,sBAAkB;KACtB;CACF,CAAA","sourcesContent":["/* EXPORT ENTITY TYPES */\nexport * from './board-template/board-template'\nexport * from './theme/theme'\nexport * from './board/board'\nexport * from './group/group'\nexport * from './play-group/play-group'\n\n/* IMPORT ENTITIES AND RESOLVERS */\nimport { entities as BoardTemplateEntities, resolvers as BoardTemplateResolvers, subscribers as BoardTemplateSubscribers } from './board-template'\nimport { entities as ThemeEntities, resolvers as ThemeResolvers, subscribers as ThemeSubscribers } from './theme'\nimport { entities as BoardEntities, resolvers as BoardResolvers, subscribers as BoardSubscribers } from './board'\nimport { entities as GroupEntities, resolvers as GroupResolvers } from './group'\nimport {\n entities as PlayGroupEntities,\n resolvers as PlayGroupResolvers,\n subscribers as PlayGroupSubscribers\n} from './play-group'\n\nexport const entities = [\n /* ENTITIES */\n\t...BoardTemplateEntities,\n ...ThemeEntities,\n ...BoardEntities,\n ...GroupEntities,\n ...PlayGroupEntities\n]\n\nexport const subscribers = [\n /* SUBSCRIBERS */\n\t...BoardTemplateSubscribers,\n ...ThemeSubscribers,\n ...BoardSubscribers,\n ...PlayGroupSubscribers\n]\n\nexport const schema = {\n resolverClasses: [\n /* RESOLVER CLASSES */\n\t\t...BoardTemplateResolvers,\n ...ThemeResolvers,\n ...BoardResolvers,\n ...GroupResolvers,\n ...PlayGroupResolvers\n ]\n}\n"]}
|