@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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"play-group-query.js","sourceRoot":"","sources":["../../../server/service/play-group/play-group-query.ts"],"names":[],"mappings":";;;;AAAA,+CAAmF;AAEnF,yDAAgD;AAChD,iDAAuG;AAEvG,
|
|
1
|
+
{"version":3,"file":"play-group-query.js","sourceRoot":"","sources":["../../../server/service/play-group/play-group-query.ts"],"names":[],"mappings":";;;;AAAA,+CAAmF;AAEnF,yDAAgD;AAChD,iDAAuG;AAEvG,gDAAyC;AACzC,mDAA2C;AAC3C,6DAAoD;AAG7C,IAAM,cAAc,GAApB,MAAM,cAAc;IAEnB,AAAN,KAAK,CAAC,SAAS,CAAY,EAAU,EAAS,OAAwB;QACpE,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAEhC,OAAO,MAAM,IAAA,qBAAa,EAAC,yBAAS,CAAC,CAAC,OAAO,CAAC;YAC5C,KAAK,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,MAAM,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE;SACzC,CAAC,CAAA;IACJ,CAAC;IAGK,AAAN,KAAK,CAAC,eAAe,CAAc,IAAY,EAAS,OAAwB;QAC9E,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAEhC,OAAO,MAAM,IAAA,qBAAa,EAAC,yBAAS,CAAC,CAAC,OAAO,CAAC;YAC5C,KAAK,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,MAAM,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE;SAC3C,CAAC,CAAA;IACJ,CAAC;IAGK,AAAN,KAAK,CAAC,UAAU,CACW,MAAiB,EACnC,OAAwB;QAE/B,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAEhC,MAAM,YAAY,GAAG,IAAA,qCAA6B,EAAC;YACjD,UAAU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mBAAA,IAAA,mBAAI,EAAC,IAAI,CAAC,EAAE,CAAC,iBAAS,CAAC,CAAA;IACvB,mBAAA,IAAA,kBAAG,GAAE,CAAA;;6CAD2B,iBAAS;;gDAe3C;AAKK;IAHL,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,CAAC,gBAAK,CAAC,EAAE;QAC9B,WAAW,EAAE,yFAAyF;KACvG,CAAC;IACY,mBAAA,IAAA,mBAAI,GAAE,CAAA;;;;4CA0BnB;AAGK;IADL,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,cAAM,EAAE,EAAE,WAAW,EAAE,qDAAqD,EAAE,CAAC;IACxF,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAY,yBAAS;;4CAExC;AAGK;IADL,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,EAAE,EAAE,WAAW,EAAE,oDAAoD,EAAE,CAAC;IACpF,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAY,yBAAS;;6CAEzC;AAGK;IADL,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,EAAE,EAAE,WAAW,EAAE,+CAA+C,EAAE,CAAC;IAC/E,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAY,yBAAS;;6CAEzC;yBAlFU,cAAc;IAD1B,IAAA,uBAAQ,EAAC,yBAAS,CAAC;GACP,cAAc,CAmF1B","sourcesContent":["import { Arg, Args, Ctx, FieldResolver, Query, Resolver, Root } from 'type-graphql'\n\nimport { User } from '@things-factory/auth-base'\nimport { Domain, getQueryBuilderFromListParams, getRepository, ListParam } from '@things-factory/shell'\n\nimport { Board } from '../board/board.js'\nimport { PlayGroup } from './play-group.js'\nimport { PlayGroupList } from './play-group-type.js'\n\n@Resolver(PlayGroup)\nexport class PlayGroupQuery {\n @Query(returns => PlayGroup, { nullable: true, description: 'Finds a single play group by its ID.' })\n async playGroup(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<PlayGroup> {\n const { domain } = context.state\n\n return await getRepository(PlayGroup).findOne({\n where: { domain: { id: domain.id }, id }\n })\n }\n\n @Query(returns => PlayGroup, { nullable: true, description: 'Finds a single play group by its name.' })\n async playGroupByName(@Arg('name') name: string, @Ctx() context: ResolverContext): Promise<PlayGroup> {\n const { domain } = context.state\n\n return await getRepository(PlayGroup).findOne({\n where: { domain: { id: domain.id }, name }\n })\n }\n\n @Query(returns => PlayGroupList, { description: 'Retrieves a paginated list of play groups.' })\n async playGroups(\n @Args(type => ListParam) params: ListParam,\n @Ctx() context: ResolverContext\n ): Promise<PlayGroupList> {\n const { domain } = context.state\n\n const queryBuilder = getQueryBuilderFromListParams({\n repository: getRepository(PlayGroup),\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 => [Board], {\n description: 'Resolves the ordered list of boards for a play group, sorted by the custom order array.'\n })\n async boards(@Root() playGroup) {\n const { order = [], boards = [] } = await getRepository(PlayGroup).findOne({\n where: { id: playGroup.id },\n relations: ['boards']\n })\n\n return boards.sort((a, b) => {\n // 배열 A에 포함된 아이디의 순서를 가져옵니다.\n const indexOfOrder = (order || []).indexOf(a.id)\n const indexOfBoards = (order || []).indexOf(b.id)\n\n // 두 아이디의 순서를 비교하여 정렬합니다.\n if (indexOfOrder === -1 && indexOfBoards === -1) {\n // 두 아이디 모두 배열 A에 없는 경우, 그대로 유지합니다.\n return 0\n } else if (indexOfOrder === -1) {\n // 아이디 A만 배열 A에 없는 경우, 아이디 B를 먼저 정렬합니다.\n return 1\n } else if (indexOfBoards === -1) {\n // 아이디 B만 배열 A에 없는 경우, 아이디 A를 먼저 정렬합니다.\n return -1\n } else {\n // 두 아이디 모두 배열 A에 있는 경우, 배열 A의 아이디 순서대로 정렬합니다.\n return indexOfOrder - indexOfBoards\n }\n })\n }\n\n @FieldResolver(type => Domain, { description: 'Resolves the domain associated with the play group.' })\n async domain(@Root() playGroup: PlayGroup) {\n return await getRepository(Domain).findOneBy({ id: playGroup.domainId })\n }\n\n @FieldResolver(type => User, { description: 'Resolves the user who last updated the play group.' })\n async updater(@Root() playGroup: PlayGroup): Promise<User> {\n return await getRepository(User).findOneBy({ id: playGroup.updaterId })\n }\n\n @FieldResolver(type => User, { description: 'Resolves the user who created the play group.' })\n async creator(@Root() playGroup: PlayGroup): Promise<User> {\n return await getRepository(User).findOneBy({ id: playGroup.creatorId })\n }\n}\n"]}
|
|
@@ -5,7 +5,7 @@ const tslib_1 = require("tslib");
|
|
|
5
5
|
const type_graphql_1 = require("type-graphql");
|
|
6
6
|
const graphql_yoga_1 = require("graphql-yoga");
|
|
7
7
|
const shell_1 = require("@things-factory/shell");
|
|
8
|
-
const
|
|
8
|
+
const play_group_js_1 = require("./play-group.js");
|
|
9
9
|
let PlayGroupSubscription = class PlayGroupSubscription {
|
|
10
10
|
playGroup(payload, id) {
|
|
11
11
|
return payload.playGroup;
|
|
@@ -14,15 +14,15 @@ let PlayGroupSubscription = class PlayGroupSubscription {
|
|
|
14
14
|
exports.PlayGroupSubscription = PlayGroupSubscription;
|
|
15
15
|
tslib_1.__decorate([
|
|
16
16
|
(0, type_graphql_1.Subscription)({
|
|
17
|
+
description: 'Subscribes to real-time updates for a specific play group.',
|
|
17
18
|
subscribe: ({ args, context, info }) => {
|
|
18
|
-
var _a;
|
|
19
19
|
const { domain, user } = context.state;
|
|
20
20
|
const { id } = args;
|
|
21
|
-
const subdomain = domain
|
|
21
|
+
const subdomain = domain?.subdomain;
|
|
22
22
|
if (!domain) {
|
|
23
23
|
throw new Error('domain required');
|
|
24
24
|
}
|
|
25
|
-
if (!
|
|
25
|
+
if (!user.domains?.find(d => d.subdomain === subdomain) && !process.superUserGranted(domain, user)) {
|
|
26
26
|
throw new Error(`domain(${subdomain}) is not working for user(${user.email}).`);
|
|
27
27
|
}
|
|
28
28
|
return (0, graphql_yoga_1.pipe)(shell_1.pubsub.subscribe('play-group'), (0, graphql_yoga_1.filter)((payload) => {
|
|
@@ -41,9 +41,9 @@ tslib_1.__decorate([
|
|
|
41
41
|
tslib_1.__param(1, (0, type_graphql_1.Arg)('id')),
|
|
42
42
|
tslib_1.__metadata("design:type", Function),
|
|
43
43
|
tslib_1.__metadata("design:paramtypes", [Object, String]),
|
|
44
|
-
tslib_1.__metadata("design:returntype",
|
|
44
|
+
tslib_1.__metadata("design:returntype", play_group_js_1.PlayGroup)
|
|
45
45
|
], PlayGroupSubscription.prototype, "playGroup", null);
|
|
46
46
|
exports.PlayGroupSubscription = PlayGroupSubscription = tslib_1.__decorate([
|
|
47
|
-
(0, type_graphql_1.Resolver)(
|
|
47
|
+
(0, type_graphql_1.Resolver)(play_group_js_1.PlayGroup)
|
|
48
48
|
], PlayGroupSubscription);
|
|
49
49
|
//# sourceMappingURL=play-group-subscription.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"play-group-subscription.js","sourceRoot":"","sources":["../../../server/service/play-group/play-group-subscription.ts"],"names":[],"mappings":";;;;AAAA,+CAAgE;AAChE,+CAA2C;AAC3C,iDAA8C;AAC9C,
|
|
1
|
+
{"version":3,"file":"play-group-subscription.js","sourceRoot":"","sources":["../../../server/service/play-group/play-group-subscription.ts"],"names":[],"mappings":";;;;AAAA,+CAAgE;AAChE,+CAA2C;AAC3C,iDAA8C;AAC9C,mDAA2C;AAGpC,IAAM,qBAAqB,GAA3B,MAAM,qBAAqB;IAkChC,SAAS,CAAS,OAAiC,EAAa,EAAU;QACxE,OAAO,OAAO,CAAC,SAAS,CAAA;IAC1B,CAAC;CACF,CAAA;AArCY,sDAAqB;AAkChC;IAjCC,IAAA,2BAAY,EAAC;QACZ,WAAW,EAAE,4DAA4D;QACzE,SAAS,EAAE,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,EAAE;YACrC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;YACtC,MAAM,EAAE,EAAE,EAAE,GAAG,IAAI,CAAA;YACnB,MAAM,SAAS,GAAG,MAAM,EAAE,SAAS,CAAA;YAEnC,IAAI,CAAC,MAAM,EAAE,CAAC;gBACZ,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAA;YACpC,CAAC;YAED,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,KAAK,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,gBAAgB,CAAC,MAAM,EAAE,IAAI,CAAC,EAAE,CAAC;gBACnG,MAAM,IAAI,KAAK,CAAC,UAAU,SAAS,6BAA6B,IAAI,CAAC,KAAK,IAAI,CAAC,CAAA;YACjF,CAAC;YAED,OAAO,IAAA,mBAAI,EACT,cAAM,CAAC,SAAS,CAAC,YAAY,CAAC,EAC9B,IAAA,qBAAM,EAAC,CAAC,OAAiC,EAAE,EAAE;gBAC3C,MAAM,EAAE,EAAE,EAAE,WAAW,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC,SAAS,CAAA;gBAEvD,IAAI,QAAQ,KAAK,MAAM,CAAC,EAAE,EAAE,CAAC;oBAC3B,OAAO,KAAK,CAAA;gBACd,CAAC;gBAED,IAAI,EAAE,KAAK,WAAW,EAAE,CAAC;oBACvB,OAAO,KAAK,CAAA;gBACd,CAAC;gBAED,OAAO,IAAI,CAAA;YACb,CAAC,CAAC,CACH,CAAA;QACH,CAAC;KACF,CAAC;IACS,mBAAA,IAAA,mBAAI,GAAE,CAAA;IAAqC,mBAAA,IAAA,kBAAG,EAAC,IAAI,CAAC,CAAA;;;4CAAc,yBAAS;sDAErF;gCApCU,qBAAqB;IADjC,IAAA,uBAAQ,EAAC,yBAAS,CAAC;GACP,qBAAqB,CAqCjC","sourcesContent":["import { Resolver, Subscription, Root, Arg } from 'type-graphql'\nimport { filter, pipe } from 'graphql-yoga'\nimport { pubsub } from '@things-factory/shell'\nimport { PlayGroup } from './play-group.js'\n\n@Resolver(PlayGroup)\nexport class PlayGroupSubscription {\n @Subscription({\n description: 'Subscribes to real-time updates for a specific play group.',\n subscribe: ({ args, context, info }) => {\n const { domain, user } = context.state\n const { id } = args\n const subdomain = domain?.subdomain\n\n if (!domain) {\n throw new Error('domain required')\n }\n\n if (!user.domains?.find(d => d.subdomain === subdomain) && !process.superUserGranted(domain, user)) {\n throw new Error(`domain(${subdomain}) is not working for user(${user.email}).`)\n }\n\n return pipe(\n pubsub.subscribe('play-group'),\n filter((payload: { playGroup: PlayGroup }) => {\n const { id: playGroupId, domainId } = payload.playGroup\n\n if (domainId !== domain.id) {\n return false\n }\n\n if (id !== playGroupId) {\n return false\n }\n\n return true\n })\n )\n }\n })\n playGroup(@Root() payload: { playGroup: PlayGroup }, @Arg('id') id: string): PlayGroup {\n return payload.playGroup\n }\n}\n"]}
|
|
@@ -3,47 +3,47 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.PlayGroupList = exports.PlayGroupPatch = exports.NewPlayGroup = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const type_graphql_1 = require("type-graphql");
|
|
6
|
-
const
|
|
6
|
+
const play_group_js_1 = require("./play-group.js");
|
|
7
7
|
let NewPlayGroup = class NewPlayGroup {
|
|
8
8
|
};
|
|
9
9
|
exports.NewPlayGroup = NewPlayGroup;
|
|
10
10
|
tslib_1.__decorate([
|
|
11
|
-
(0, type_graphql_1.Field)(),
|
|
11
|
+
(0, type_graphql_1.Field)({ description: 'The name of the new play group.' }),
|
|
12
12
|
tslib_1.__metadata("design:type", String)
|
|
13
13
|
], NewPlayGroup.prototype, "name", void 0);
|
|
14
14
|
tslib_1.__decorate([
|
|
15
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
|
15
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'A detailed description for the new play group.' }),
|
|
16
16
|
tslib_1.__metadata("design:type", String)
|
|
17
17
|
], NewPlayGroup.prototype, "description", void 0);
|
|
18
18
|
exports.NewPlayGroup = NewPlayGroup = tslib_1.__decorate([
|
|
19
|
-
(0, type_graphql_1.InputType)()
|
|
19
|
+
(0, type_graphql_1.InputType)({ description: 'Input for creating a new play group.' })
|
|
20
20
|
], NewPlayGroup);
|
|
21
21
|
let PlayGroupPatch = class PlayGroupPatch {
|
|
22
22
|
};
|
|
23
23
|
exports.PlayGroupPatch = PlayGroupPatch;
|
|
24
24
|
tslib_1.__decorate([
|
|
25
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
|
25
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'The new name for the play group.' }),
|
|
26
26
|
tslib_1.__metadata("design:type", String)
|
|
27
27
|
], PlayGroupPatch.prototype, "name", void 0);
|
|
28
28
|
tslib_1.__decorate([
|
|
29
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
|
29
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'The new description for the play group.' }),
|
|
30
30
|
tslib_1.__metadata("design:type", String)
|
|
31
31
|
], PlayGroupPatch.prototype, "description", void 0);
|
|
32
32
|
exports.PlayGroupPatch = PlayGroupPatch = tslib_1.__decorate([
|
|
33
|
-
(0, type_graphql_1.InputType)()
|
|
33
|
+
(0, type_graphql_1.InputType)({ description: 'Input for updating (patching) an existing play group.' })
|
|
34
34
|
], PlayGroupPatch);
|
|
35
35
|
let PlayGroupList = class PlayGroupList {
|
|
36
36
|
};
|
|
37
37
|
exports.PlayGroupList = PlayGroupList;
|
|
38
38
|
tslib_1.__decorate([
|
|
39
|
-
(0, type_graphql_1.Field)(type => [
|
|
39
|
+
(0, type_graphql_1.Field)(type => [play_group_js_1.PlayGroup], { description: 'The list of play group items.' }),
|
|
40
40
|
tslib_1.__metadata("design:type", Array)
|
|
41
41
|
], PlayGroupList.prototype, "items", void 0);
|
|
42
42
|
tslib_1.__decorate([
|
|
43
|
-
(0, type_graphql_1.Field)(type => type_graphql_1.Int),
|
|
43
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.Int, { description: 'The total number of play groups.' }),
|
|
44
44
|
tslib_1.__metadata("design:type", Number)
|
|
45
45
|
], PlayGroupList.prototype, "total", void 0);
|
|
46
46
|
exports.PlayGroupList = PlayGroupList = tslib_1.__decorate([
|
|
47
|
-
(0, type_graphql_1.ObjectType)()
|
|
47
|
+
(0, type_graphql_1.ObjectType)({ description: 'A paginated list of play groups.' })
|
|
48
48
|
], PlayGroupList);
|
|
49
49
|
//# sourceMappingURL=play-group-type.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"play-group-type.js","sourceRoot":"","sources":["../../../server/service/play-group/play-group-type.ts"],"names":[],"mappings":";;;;AAAA,+CAAsF;AAEtF,
|
|
1
|
+
{"version":3,"file":"play-group-type.js","sourceRoot":"","sources":["../../../server/service/play-group/play-group-type.ts"],"names":[],"mappings":";;;;AAAA,+CAAsF;AAEtF,mDAA2C;AAGpC,IAAM,YAAY,GAAlB,MAAM,YAAY;CAMxB,CAAA;AANY,oCAAY;AAEvB;IADC,IAAA,oBAAK,EAAC,EAAE,WAAW,EAAE,iCAAiC,EAAE,CAAC;;0CAC9C;AAGZ;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,gDAAgD,EAAE,CAAC;;iDACrE;uBALT,YAAY;IADxB,IAAA,wBAAS,EAAC,EAAE,WAAW,EAAE,sCAAsC,EAAE,CAAC;GACtD,YAAY,CAMxB;AAGM,IAAM,cAAc,GAApB,MAAM,cAAc;CAM1B,CAAA;AANY,wCAAc;AAEzB;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,kCAAkC,EAAE,CAAC;;4CAC/D;AAGZ;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,yCAAyC,EAAE,CAAC;;mDAC9D;yBALT,cAAc;IAD1B,IAAA,wBAAS,EAAC,EAAE,WAAW,EAAE,uDAAuD,EAAE,CAAC;GACvE,cAAc,CAM1B;AAGM,IAAM,aAAa,GAAnB,MAAM,aAAa;CAMzB,CAAA;AANY,sCAAa;AAExB;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,CAAC,yBAAS,CAAC,EAAE,EAAE,WAAW,EAAE,+BAA+B,EAAE,CAAC;;4CAC3D;AAGlB;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,kBAAG,EAAE,EAAE,WAAW,EAAE,kCAAkC,EAAE,CAAC;;4CAC3D;wBALF,aAAa;IADzB,IAAA,yBAAU,EAAC,EAAE,WAAW,EAAE,kCAAkC,EAAE,CAAC;GACnD,aAAa,CAMzB","sourcesContent":["import { ObjectType, Field, InputType, Int, ID, registerEnumType } from 'type-graphql'\n\nimport { PlayGroup } from './play-group.js'\n\n@InputType({ description: 'Input for creating a new play group.' })\nexport class NewPlayGroup {\n @Field({ description: 'The name of the new play group.' })\n name: string\n\n @Field({ nullable: true, description: 'A detailed description for the new play group.' })\n description?: string\n}\n\n@InputType({ description: 'Input for updating (patching) an existing play group.' })\nexport class PlayGroupPatch {\n @Field({ nullable: true, description: 'The new name for the play group.' })\n name: string\n\n @Field({ nullable: true, description: 'The new description for the play group.' })\n description?: string\n}\n\n@ObjectType({ description: 'A paginated list of play groups.' })\nexport class PlayGroupList {\n @Field(type => [PlayGroup], { description: 'The list of play group items.' })\n items: PlayGroup[]\n\n @Field(type => Int, { description: 'The total number of play groups.' })\n total: number\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { User } from '@things-factory/auth-base';
|
|
2
2
|
import { Domain } from '@things-factory/shell';
|
|
3
|
-
import { Board } from '../board/board';
|
|
3
|
+
import { Board } from '../board/board.js';
|
|
4
4
|
export declare class PlayGroup {
|
|
5
5
|
readonly id: string;
|
|
6
6
|
domain?: Domain;
|
|
@@ -8,7 +8,7 @@ export declare class PlayGroup {
|
|
|
8
8
|
name: string;
|
|
9
9
|
description?: string;
|
|
10
10
|
boards: Board[];
|
|
11
|
-
order
|
|
11
|
+
order?: string[];
|
|
12
12
|
createdAt?: Date;
|
|
13
13
|
updatedAt?: Date;
|
|
14
14
|
creator?: User;
|
|
@@ -6,18 +6,18 @@ const type_graphql_1 = require("type-graphql");
|
|
|
6
6
|
const typeorm_1 = require("typeorm");
|
|
7
7
|
const auth_base_1 = require("@things-factory/auth-base");
|
|
8
8
|
const shell_1 = require("@things-factory/shell");
|
|
9
|
-
const
|
|
9
|
+
const board_js_1 = require("../board/board.js");
|
|
10
10
|
let PlayGroup = class PlayGroup {
|
|
11
11
|
};
|
|
12
12
|
exports.PlayGroup = PlayGroup;
|
|
13
13
|
tslib_1.__decorate([
|
|
14
14
|
(0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
|
|
15
|
-
(0, type_graphql_1.Field)(type => type_graphql_1.ID),
|
|
15
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.ID, { description: 'Unique identifier for the play group.' }),
|
|
16
16
|
tslib_1.__metadata("design:type", String)
|
|
17
17
|
], PlayGroup.prototype, "id", void 0);
|
|
18
18
|
tslib_1.__decorate([
|
|
19
19
|
(0, typeorm_1.ManyToOne)(type => shell_1.Domain),
|
|
20
|
-
(0, type_graphql_1.Field)(type => shell_1.Domain, { nullable: true }),
|
|
20
|
+
(0, type_graphql_1.Field)(type => shell_1.Domain, { nullable: true, description: 'The domain to which this play group belongs.' }),
|
|
21
21
|
tslib_1.__metadata("design:type", shell_1.Domain)
|
|
22
22
|
], PlayGroup.prototype, "domain", void 0);
|
|
23
23
|
tslib_1.__decorate([
|
|
@@ -26,39 +26,43 @@ tslib_1.__decorate([
|
|
|
26
26
|
], PlayGroup.prototype, "domainId", void 0);
|
|
27
27
|
tslib_1.__decorate([
|
|
28
28
|
(0, typeorm_1.Column)(),
|
|
29
|
-
(0, type_graphql_1.Field)(),
|
|
29
|
+
(0, type_graphql_1.Field)({ description: 'The name of the play group.' }),
|
|
30
30
|
tslib_1.__metadata("design:type", String)
|
|
31
31
|
], PlayGroup.prototype, "name", void 0);
|
|
32
32
|
tslib_1.__decorate([
|
|
33
33
|
(0, typeorm_1.Column)({
|
|
34
34
|
nullable: true
|
|
35
35
|
}),
|
|
36
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
|
36
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'A detailed description of the play group.' }),
|
|
37
37
|
tslib_1.__metadata("design:type", String)
|
|
38
38
|
], PlayGroup.prototype, "description", void 0);
|
|
39
39
|
tslib_1.__decorate([
|
|
40
|
-
(0, typeorm_1.ManyToMany)(type =>
|
|
40
|
+
(0, typeorm_1.ManyToMany)(type => board_js_1.Board, board => board.playGroups),
|
|
41
41
|
(0, typeorm_1.JoinTable)({ name: 'play_groups_boards' }),
|
|
42
|
-
(0, type_graphql_1.Field)(type => [
|
|
42
|
+
(0, type_graphql_1.Field)(type => [board_js_1.Board], { nullable: true, description: 'The list of boards included in this play group.' }),
|
|
43
43
|
tslib_1.__metadata("design:type", Array)
|
|
44
44
|
], PlayGroup.prototype, "boards", void 0);
|
|
45
45
|
tslib_1.__decorate([
|
|
46
46
|
(0, typeorm_1.Column)('simple-json', { nullable: true }),
|
|
47
|
-
|
|
47
|
+
(0, type_graphql_1.Field)(type => [String], {
|
|
48
|
+
nullable: true,
|
|
49
|
+
description: 'An array of board IDs, defining the specific playback order of boards within the group.'
|
|
50
|
+
}),
|
|
51
|
+
tslib_1.__metadata("design:type", Array)
|
|
48
52
|
], PlayGroup.prototype, "order", void 0);
|
|
49
53
|
tslib_1.__decorate([
|
|
50
54
|
(0, typeorm_1.CreateDateColumn)(),
|
|
51
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
|
55
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'The timestamp when the play group was created.' }),
|
|
52
56
|
tslib_1.__metadata("design:type", Date)
|
|
53
57
|
], PlayGroup.prototype, "createdAt", void 0);
|
|
54
58
|
tslib_1.__decorate([
|
|
55
59
|
(0, typeorm_1.UpdateDateColumn)(),
|
|
56
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
|
60
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'The timestamp when the play group was last updated.' }),
|
|
57
61
|
tslib_1.__metadata("design:type", Date)
|
|
58
62
|
], PlayGroup.prototype, "updatedAt", void 0);
|
|
59
63
|
tslib_1.__decorate([
|
|
60
64
|
(0, typeorm_1.ManyToOne)(type => auth_base_1.User, { nullable: true }),
|
|
61
|
-
(0, type_graphql_1.Field)(type => auth_base_1.User, { nullable: true }),
|
|
65
|
+
(0, type_graphql_1.Field)(type => auth_base_1.User, { nullable: true, description: 'The user who created the play group.' }),
|
|
62
66
|
tslib_1.__metadata("design:type", auth_base_1.User)
|
|
63
67
|
], PlayGroup.prototype, "creator", void 0);
|
|
64
68
|
tslib_1.__decorate([
|
|
@@ -67,7 +71,7 @@ tslib_1.__decorate([
|
|
|
67
71
|
], PlayGroup.prototype, "creatorId", void 0);
|
|
68
72
|
tslib_1.__decorate([
|
|
69
73
|
(0, typeorm_1.ManyToOne)(type => auth_base_1.User, { nullable: true }),
|
|
70
|
-
(0, type_graphql_1.Field)(type => auth_base_1.User, { nullable: true }),
|
|
74
|
+
(0, type_graphql_1.Field)(type => auth_base_1.User, { nullable: true, description: 'The user who last updated the play group.' }),
|
|
71
75
|
tslib_1.__metadata("design:type", auth_base_1.User)
|
|
72
76
|
], PlayGroup.prototype, "updater", void 0);
|
|
73
77
|
tslib_1.__decorate([
|
|
@@ -77,6 +81,6 @@ tslib_1.__decorate([
|
|
|
77
81
|
exports.PlayGroup = PlayGroup = tslib_1.__decorate([
|
|
78
82
|
(0, typeorm_1.Entity)(),
|
|
79
83
|
(0, typeorm_1.Index)('ix_play_group_0', (playGroup) => [playGroup.domain, playGroup.name], { unique: true }),
|
|
80
|
-
(0, type_graphql_1.ObjectType)({ description: '
|
|
84
|
+
(0, type_graphql_1.ObjectType)({ description: 'A group of boards that can be played in a sequence or collection.' })
|
|
81
85
|
], PlayGroup);
|
|
82
86
|
//# sourceMappingURL=play-group.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"play-group.js","sourceRoot":"","sources":["../../../server/service/play-group/play-group.ts"],"names":[],"mappings":";;;;AAAA,+CAAoD;AACpD,qCAWgB;AAEhB,yDAAgD;AAChD,
|
|
1
|
+
{"version":3,"file":"play-group.js","sourceRoot":"","sources":["../../../server/service/play-group/play-group.ts"],"names":[],"mappings":";;;;AAAA,+CAAoD;AACpD,qCAWgB;AAEhB,yDAAgD;AAChD,iDAA4D;AAE5D,gDAAyC;AAKlC,IAAM,SAAS,GAAf,MAAM,SAAS;CAuDrB,CAAA;AAvDY,8BAAS;AAGX;IAFR,IAAA,gCAAsB,EAAC,MAAM,CAAC;IAC9B,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,iBAAE,EAAE,EAAE,WAAW,EAAE,uCAAuC,EAAE,CAAC;;qCACzD;AAInB;IAFC,IAAA,mBAAS,EAAC,IAAI,CAAC,EAAE,CAAC,cAAM,CAAC;IACzB,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,cAAM,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,8CAA8C,EAAE,CAAC;sCAC9F,cAAM;yCAAA;AAGf;IADC,IAAA,oBAAU,EAAC,CAAC,SAAoB,EAAE,EAAE,CAAC,SAAS,CAAC,MAAM,CAAC;;2CACtC;AAIjB;IAFC,IAAA,gBAAM,GAAE;IACR,IAAA,oBAAK,EAAC,EAAE,WAAW,EAAE,6BAA6B,EAAE,CAAC;;uCAC1C;AAMZ;IAJC,IAAA,gBAAM,EAAC;QACN,QAAQ,EAAE,IAAI;KACf,CAAC;IACD,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,2CAA2C,EAAE,CAAC;;8CAChE;AAKpB;IAHC,IAAA,oBAAU,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAK,EAAE,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C,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,2CAA2C,EAAE,CAAC;sCACxF,gBAAI;0CAAA;AAGd;IADC,IAAA,oBAAU,EAAC,CAAC,SAAoB,EAAE,EAAE,CAAC,SAAS,CAAC,OAAO,CAAC;;4CACtC;oBAtDP,SAAS;IAHrB,IAAA,gBAAM,GAAE;IACR,IAAA,eAAK,EAAC,iBAAiB,EAAE,CAAC,SAAoB,EAAE,EAAE,CAAC,CAAC,SAAS,CAAC,MAAM,EAAE,SAAS,CAAC,IAAI,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;IACxG,IAAA,yBAAU,EAAC,EAAE,WAAW,EAAE,mEAAmE,EAAE,CAAC;GACpF,SAAS,CAuDrB","sourcesContent":["import { Field, ID, ObjectType } from 'type-graphql'\nimport {\n Column,\n CreateDateColumn,\n Entity,\n Index,\n JoinTable,\n ManyToMany,\n ManyToOne,\n PrimaryGeneratedColumn,\n RelationId,\n UpdateDateColumn\n} from 'typeorm'\n\nimport { User } from '@things-factory/auth-base'\nimport { Domain, ScalarObject } from '@things-factory/shell'\n\nimport { Board } from '../board/board.js'\n\n@Entity()\n@Index('ix_play_group_0', (playGroup: PlayGroup) => [playGroup.domain, playGroup.name], { unique: true })\n@ObjectType({ description: 'A group of boards that can be played in a sequence or collection.' })\nexport class PlayGroup {\n @PrimaryGeneratedColumn('uuid')\n @Field(type => ID, { description: 'Unique identifier for the play group.' })\n readonly id: string\n\n @ManyToOne(type => Domain)\n @Field(type => Domain, { nullable: true, description: 'The domain to which this play group belongs.' })\n domain?: Domain\n\n @RelationId((playGroup: PlayGroup) => playGroup.domain)\n domainId?: string\n\n @Column()\n @Field({ description: 'The name of the play group.' })\n name: string\n\n @Column({\n nullable: true\n })\n @Field({ nullable: true, description: 'A detailed description of the play group.' })\n description?: string\n\n @ManyToMany(type => Board, board => board.playGroups)\n @JoinTable({ name: 'play_groups_boards' })\n @Field(type => [Board], { nullable: true, description: 'The list of boards included in this play group.' })\n boards: Board[]\n\n @Column('simple-json', { nullable: true })\n @Field(type => [String], {\n nullable: true,\n description: 'An array of board IDs, defining the specific playback order of boards within the group.'\n })\n order?: string[]\n\n @CreateDateColumn()\n @Field({ nullable: true, description: 'The timestamp when the play group was created.' })\n createdAt?: Date\n\n @UpdateDateColumn()\n @Field({ nullable: true, description: 'The timestamp when the play group was last updated.' })\n updatedAt?: Date\n\n @ManyToOne(type => User, { nullable: true })\n @Field(type => User, { nullable: true, description: 'The user who created the play group.' })\n creator?: User\n\n @RelationId((playGroup: PlayGroup) => playGroup.creator)\n creatorId?: string\n\n @ManyToOne(type => User, { nullable: true })\n @Field(type => User, { nullable: true, description: 'The user who last updated the play group.' })\n updater?: User\n\n @RelationId((playGroup: PlayGroup) => playGroup.updater)\n updaterId?: string\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Theme } from './theme';
|
|
2
|
-
import { ThemeQuery } from './theme-query';
|
|
3
|
-
import { ThemeMutation } from './theme-mutation';
|
|
1
|
+
import { Theme } from './theme.js';
|
|
2
|
+
import { ThemeQuery } from './theme-query.js';
|
|
3
|
+
import { ThemeMutation } from './theme-mutation.js';
|
|
4
4
|
export declare const entities: (typeof Theme)[];
|
|
5
5
|
export declare const resolvers: (typeof ThemeQuery | typeof ThemeMutation)[];
|
|
6
6
|
export declare const subscribers: any[];
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.subscribers = exports.resolvers = exports.entities = void 0;
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
exports.entities = [
|
|
8
|
-
exports.resolvers = [
|
|
4
|
+
const theme_js_1 = require("./theme.js");
|
|
5
|
+
const theme_query_js_1 = require("./theme-query.js");
|
|
6
|
+
const theme_mutation_js_1 = require("./theme-mutation.js");
|
|
7
|
+
exports.entities = [theme_js_1.Theme];
|
|
8
|
+
exports.resolvers = [theme_query_js_1.ThemeQuery, theme_mutation_js_1.ThemeMutation];
|
|
9
9
|
exports.subscribers = [];
|
|
10
10
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../server/service/theme/index.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../server/service/theme/index.ts"],"names":[],"mappings":";;;AAAA,yCAAkC;AAClC,qDAA6C;AAC7C,2DAAmD;AAEtC,QAAA,QAAQ,GAAG,CAAC,gBAAK,CAAC,CAAA;AAClB,QAAA,SAAS,GAAG,CAAC,2BAAU,EAAE,iCAAa,CAAC,CAAA;AACvC,QAAA,WAAW,GAAG,EAAE,CAAA","sourcesContent":["import { Theme } from './theme.js'\nimport { ThemeQuery } from './theme-query.js'\nimport { ThemeMutation } from './theme-mutation.js'\n\nexport const entities = [Theme]\nexport const resolvers = [ThemeQuery, ThemeMutation]\nexport const subscribers = []\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Theme } from './theme';
|
|
2
|
-
import { NewTheme, ThemePatch } from './theme-type';
|
|
1
|
+
import { Theme } from './theme.js';
|
|
2
|
+
import { NewTheme, ThemePatch } from './theme-type.js';
|
|
3
3
|
export declare class ThemeMutation {
|
|
4
4
|
createTheme(theme: NewTheme, context: ResolverContext): Promise<Theme>;
|
|
5
5
|
updateTheme(id: string, patch: ThemePatch, context: ResolverContext): Promise<Theme>;
|
|
@@ -4,52 +4,70 @@ exports.ThemeMutation = void 0;
|
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const type_graphql_1 = require("type-graphql");
|
|
6
6
|
const typeorm_1 = require("typeorm");
|
|
7
|
-
const
|
|
8
|
-
const
|
|
7
|
+
const theme_js_1 = require("./theme.js");
|
|
8
|
+
const theme_type_js_1 = require("./theme-type.js");
|
|
9
9
|
let ThemeMutation = class ThemeMutation {
|
|
10
10
|
async createTheme(theme, context) {
|
|
11
11
|
const { domain, user, tx } = context.state;
|
|
12
|
-
return await tx.getRepository(
|
|
12
|
+
return await tx.getRepository(theme_js_1.Theme).save({
|
|
13
|
+
...theme,
|
|
14
|
+
domain,
|
|
15
|
+
creator: user,
|
|
16
|
+
updater: user
|
|
17
|
+
});
|
|
13
18
|
}
|
|
14
19
|
async updateTheme(id, patch, context) {
|
|
15
20
|
const { domain, user, tx } = context.state;
|
|
16
|
-
const repository = tx.getRepository(
|
|
21
|
+
const repository = tx.getRepository(theme_js_1.Theme);
|
|
17
22
|
const theme = await repository.findOne({
|
|
18
23
|
where: { domain: { id: domain.id }, id }
|
|
19
24
|
});
|
|
20
|
-
return await repository.save(
|
|
25
|
+
return await repository.save({
|
|
26
|
+
...theme,
|
|
27
|
+
...patch,
|
|
28
|
+
updater: user
|
|
29
|
+
});
|
|
21
30
|
}
|
|
22
31
|
async updateMultipleTheme(patches, context) {
|
|
23
32
|
const { domain, user, tx } = context.state;
|
|
24
33
|
let results = [];
|
|
25
34
|
const _createRecords = patches.filter((patch) => patch.cuFlag.toUpperCase() === '+');
|
|
26
35
|
const _updateRecords = patches.filter((patch) => patch.cuFlag.toUpperCase() === 'M');
|
|
27
|
-
const themeRepo = tx.getRepository(
|
|
36
|
+
const themeRepo = tx.getRepository(theme_js_1.Theme);
|
|
28
37
|
if (_createRecords.length > 0) {
|
|
29
38
|
for (let i = 0; i < _createRecords.length; i++) {
|
|
30
39
|
const newRecord = _createRecords[i];
|
|
31
|
-
const result = await themeRepo.save(
|
|
32
|
-
|
|
40
|
+
const result = await themeRepo.save({
|
|
41
|
+
...newRecord,
|
|
42
|
+
domain,
|
|
43
|
+
creator: user,
|
|
44
|
+
updater: user
|
|
45
|
+
});
|
|
46
|
+
results.push({ ...result, cuFlag: '+' });
|
|
33
47
|
}
|
|
34
48
|
}
|
|
35
49
|
if (_updateRecords.length > 0) {
|
|
36
50
|
for (let i = 0; i < _updateRecords.length; i++) {
|
|
37
51
|
const updateRecord = _updateRecords[i];
|
|
38
52
|
const theme = await themeRepo.findOneBy({ id: updateRecord.id });
|
|
39
|
-
const result = await themeRepo.save(
|
|
40
|
-
|
|
53
|
+
const result = await themeRepo.save({
|
|
54
|
+
...theme,
|
|
55
|
+
...updateRecord,
|
|
56
|
+
updater: user
|
|
57
|
+
});
|
|
58
|
+
results.push({ ...result, cuFlag: 'M' });
|
|
41
59
|
}
|
|
42
60
|
}
|
|
43
61
|
return results;
|
|
44
62
|
}
|
|
45
63
|
async deleteTheme(id, context) {
|
|
46
64
|
const { domain, tx } = context.state;
|
|
47
|
-
await tx.getRepository(
|
|
65
|
+
await tx.getRepository(theme_js_1.Theme).delete({ domain: { id: domain.id }, id });
|
|
48
66
|
return true;
|
|
49
67
|
}
|
|
50
68
|
async deleteThemes(ids, context) {
|
|
51
69
|
const { domain, tx } = context.state;
|
|
52
|
-
await tx.getRepository(
|
|
70
|
+
await tx.getRepository(theme_js_1.Theme).delete({
|
|
53
71
|
domain: { id: domain.id },
|
|
54
72
|
id: (0, typeorm_1.In)(ids)
|
|
55
73
|
});
|
|
@@ -58,7 +76,7 @@ let ThemeMutation = class ThemeMutation {
|
|
|
58
76
|
async importThemes(themes, context) {
|
|
59
77
|
const { domain, tx } = context.state;
|
|
60
78
|
await Promise.all(themes.map(async (theme) => {
|
|
61
|
-
const createdTheme = await tx.getRepository(
|
|
79
|
+
const createdTheme = await tx.getRepository(theme_js_1.Theme).save({ domain, ...theme });
|
|
62
80
|
}));
|
|
63
81
|
return true;
|
|
64
82
|
}
|
|
@@ -66,27 +84,29 @@ let ThemeMutation = class ThemeMutation {
|
|
|
66
84
|
exports.ThemeMutation = ThemeMutation;
|
|
67
85
|
tslib_1.__decorate([
|
|
68
86
|
(0, type_graphql_1.Directive)('@transaction'),
|
|
69
|
-
(0, type_graphql_1.Mutation)(returns =>
|
|
87
|
+
(0, type_graphql_1.Mutation)(returns => theme_js_1.Theme, { description: 'Creates a new theme.' }),
|
|
70
88
|
tslib_1.__param(0, (0, type_graphql_1.Arg)('theme')),
|
|
71
89
|
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
|
72
90
|
tslib_1.__metadata("design:type", Function),
|
|
73
|
-
tslib_1.__metadata("design:paramtypes", [
|
|
91
|
+
tslib_1.__metadata("design:paramtypes", [theme_type_js_1.NewTheme, Object]),
|
|
74
92
|
tslib_1.__metadata("design:returntype", Promise)
|
|
75
93
|
], ThemeMutation.prototype, "createTheme", null);
|
|
76
94
|
tslib_1.__decorate([
|
|
77
95
|
(0, type_graphql_1.Directive)('@transaction'),
|
|
78
|
-
(0, type_graphql_1.Mutation)(returns =>
|
|
96
|
+
(0, type_graphql_1.Mutation)(returns => theme_js_1.Theme, { description: 'Updates an existing theme.' }),
|
|
79
97
|
tslib_1.__param(0, (0, type_graphql_1.Arg)('id')),
|
|
80
98
|
tslib_1.__param(1, (0, type_graphql_1.Arg)('patch')),
|
|
81
99
|
tslib_1.__param(2, (0, type_graphql_1.Ctx)()),
|
|
82
100
|
tslib_1.__metadata("design:type", Function),
|
|
83
|
-
tslib_1.__metadata("design:paramtypes", [String,
|
|
101
|
+
tslib_1.__metadata("design:paramtypes", [String, theme_type_js_1.ThemePatch, Object]),
|
|
84
102
|
tslib_1.__metadata("design:returntype", Promise)
|
|
85
103
|
], ThemeMutation.prototype, "updateTheme", null);
|
|
86
104
|
tslib_1.__decorate([
|
|
87
105
|
(0, type_graphql_1.Directive)('@transaction'),
|
|
88
|
-
(0, type_graphql_1.Mutation)(returns => [
|
|
89
|
-
|
|
106
|
+
(0, type_graphql_1.Mutation)(returns => [theme_js_1.Theme], {
|
|
107
|
+
description: 'Updates multiple themes at once. Can create or update themes based on the cuFlag.'
|
|
108
|
+
}),
|
|
109
|
+
tslib_1.__param(0, (0, type_graphql_1.Arg)('patches', type => [theme_type_js_1.ThemePatch])),
|
|
90
110
|
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
|
91
111
|
tslib_1.__metadata("design:type", Function),
|
|
92
112
|
tslib_1.__metadata("design:paramtypes", [Array, Object]),
|
|
@@ -94,7 +114,7 @@ tslib_1.__decorate([
|
|
|
94
114
|
], ThemeMutation.prototype, "updateMultipleTheme", null);
|
|
95
115
|
tslib_1.__decorate([
|
|
96
116
|
(0, type_graphql_1.Directive)('@transaction'),
|
|
97
|
-
(0, type_graphql_1.Mutation)(returns => Boolean, { description: '
|
|
117
|
+
(0, type_graphql_1.Mutation)(returns => Boolean, { description: 'Deletes a single theme by its ID.' }),
|
|
98
118
|
tslib_1.__param(0, (0, type_graphql_1.Arg)('id')),
|
|
99
119
|
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
|
100
120
|
tslib_1.__metadata("design:type", Function),
|
|
@@ -103,7 +123,7 @@ tslib_1.__decorate([
|
|
|
103
123
|
], ThemeMutation.prototype, "deleteTheme", null);
|
|
104
124
|
tslib_1.__decorate([
|
|
105
125
|
(0, type_graphql_1.Directive)('@transaction'),
|
|
106
|
-
(0, type_graphql_1.Mutation)(returns => Boolean, { description: '
|
|
126
|
+
(0, type_graphql_1.Mutation)(returns => Boolean, { description: 'Deletes multiple themes by their IDs.' }),
|
|
107
127
|
tslib_1.__param(0, (0, type_graphql_1.Arg)('ids', type => [String])),
|
|
108
128
|
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
|
109
129
|
tslib_1.__metadata("design:type", Function),
|
|
@@ -112,14 +132,14 @@ tslib_1.__decorate([
|
|
|
112
132
|
], ThemeMutation.prototype, "deleteThemes", null);
|
|
113
133
|
tslib_1.__decorate([
|
|
114
134
|
(0, type_graphql_1.Directive)('@transaction'),
|
|
115
|
-
(0, type_graphql_1.Mutation)(returns => Boolean, { description: '
|
|
116
|
-
tslib_1.__param(0, (0, type_graphql_1.Arg)('themes', type => [
|
|
135
|
+
(0, type_graphql_1.Mutation)(returns => Boolean, { description: 'Imports multiple themes.' }),
|
|
136
|
+
tslib_1.__param(0, (0, type_graphql_1.Arg)('themes', type => [theme_type_js_1.ThemePatch])),
|
|
117
137
|
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
|
118
138
|
tslib_1.__metadata("design:type", Function),
|
|
119
139
|
tslib_1.__metadata("design:paramtypes", [Array, Object]),
|
|
120
140
|
tslib_1.__metadata("design:returntype", Promise)
|
|
121
141
|
], ThemeMutation.prototype, "importThemes", null);
|
|
122
142
|
exports.ThemeMutation = ThemeMutation = tslib_1.__decorate([
|
|
123
|
-
(0, type_graphql_1.Resolver)(
|
|
143
|
+
(0, type_graphql_1.Resolver)(theme_js_1.Theme)
|
|
124
144
|
], ThemeMutation);
|
|
125
145
|
//# sourceMappingURL=theme-mutation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme-mutation.js","sourceRoot":"","sources":["../../../server/service/theme/theme-mutation.ts"],"names":[],"mappings":";;;;AAAA,+CAAsE;AACtE,qCAA4B;AAE5B,
|
|
1
|
+
{"version":3,"file":"theme-mutation.js","sourceRoot":"","sources":["../../../server/service/theme/theme-mutation.ts"],"names":[],"mappings":";;;;AAAA,+CAAsE;AACtE,qCAA4B;AAE5B,yCAAkC;AAClC,mDAAsD;AAG/C,IAAM,aAAa,GAAnB,MAAM,aAAa;IAGlB,AAAN,KAAK,CAAC,WAAW,CAAe,KAAe,EAAS,OAAwB;QAC9E,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAE1C,OAAO,MAAM,EAAE,CAAC,aAAa,CAAC,gBAAK,CAAC,CAAC,IAAI,CAAC;YACxC,GAAG,KAAK;YACR,MAAM;YACN,OAAO,EAAE,IAAI;YACb,OAAO,EAAE,IAAI;SACd,CAAC,CAAA;IACJ,CAAC;IAIK,AAAN,KAAK,CAAC,WAAW,CACJ,EAAU,EACP,KAAiB,EACxB,OAAwB;QAE/B,MAAM,EAAE,MAAM,EAAE,IAAI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AAC;GACH,aAAa,CA0HzB","sourcesContent":["import { Resolver, Mutation, Arg, Ctx, Directive } from 'type-graphql'\nimport { In } from 'typeorm'\n\nimport { Theme } from './theme.js'\nimport { NewTheme, ThemePatch } from './theme-type.js'\n\n@Resolver(Theme)\nexport class ThemeMutation {\n @Directive('@transaction')\n @Mutation(returns => Theme, { description: 'Creates a new theme.' })\n async createTheme(@Arg('theme') theme: NewTheme, @Ctx() context: ResolverContext): Promise<Theme> {\n const { domain, user, tx } = context.state\n\n return await tx.getRepository(Theme).save({\n ...theme,\n domain,\n creator: user,\n updater: user\n })\n }\n\n @Directive('@transaction')\n @Mutation(returns => Theme, { description: 'Updates an existing theme.' })\n async updateTheme(\n @Arg('id') id: string,\n @Arg('patch') patch: ThemePatch,\n @Ctx() context: ResolverContext\n ): Promise<Theme> {\n const { domain, user, tx } = context.state\n\n const repository = tx.getRepository(Theme)\n const theme = await repository.findOne({\n where: { domain: { id: domain.id }, id }\n })\n\n return await repository.save({\n ...theme,\n ...patch,\n updater: user\n })\n }\n\n @Directive('@transaction')\n @Mutation(returns => [Theme], {\n description: 'Updates multiple themes at once. Can create or update themes based on the cuFlag.'\n })\n async updateMultipleTheme(\n @Arg('patches', type => [ThemePatch]) patches: ThemePatch[],\n @Ctx() context: ResolverContext\n ): Promise<Theme[]> {\n const { domain, user, tx } = context.state\n\n let results = []\n const _createRecords = patches.filter((patch: any) => patch.cuFlag.toUpperCase() === '+')\n const _updateRecords = patches.filter((patch: any) => patch.cuFlag.toUpperCase() === 'M')\n const themeRepo = tx.getRepository(Theme)\n\n if (_createRecords.length > 0) {\n for (let i = 0; i < _createRecords.length; i++) {\n const newRecord = _createRecords[i]\n\n const result = await themeRepo.save({\n ...newRecord,\n domain,\n creator: user,\n updater: user\n })\n\n results.push({ ...result, cuFlag: '+' })\n }\n }\n\n if (_updateRecords.length > 0) {\n for (let i = 0; i < _updateRecords.length; i++) {\n const updateRecord = _updateRecords[i]\n const theme = await themeRepo.findOneBy({ id: updateRecord.id })\n\n const result = await themeRepo.save({\n ...theme,\n ...updateRecord,\n updater: user\n })\n\n results.push({ ...result, cuFlag: 'M' })\n }\n }\n\n return results\n }\n\n @Directive('@transaction')\n @Mutation(returns => Boolean, { description: 'Deletes a single theme by its ID.' })\n async deleteTheme(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<boolean> {\n const { domain, tx } = context.state\n\n await tx.getRepository(Theme).delete({ domain: { id: domain.id }, id })\n\n return true\n }\n\n @Directive('@transaction')\n @Mutation(returns => Boolean, { description: 'Deletes multiple themes by their IDs.' })\n async deleteThemes(@Arg('ids', type => [String]) ids: string[], @Ctx() context: ResolverContext): Promise<boolean> {\n const { domain, tx } = context.state\n\n await tx.getRepository(Theme).delete({\n domain: { id: domain.id },\n id: In(ids)\n })\n\n return true\n }\n\n @Directive('@transaction')\n @Mutation(returns => Boolean, { description: 'Imports multiple themes.' })\n async importThemes(\n @Arg('themes', type => [ThemePatch]) themes: ThemePatch[],\n @Ctx() context: ResolverContext\n ): Promise<boolean> {\n const { domain, tx } = context.state\n\n await Promise.all(\n themes.map(async (theme: ThemePatch) => {\n const createdTheme: Theme = await tx.getRepository(Theme).save({ domain, ...theme })\n })\n )\n\n return true\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 { Theme } from './theme';
|
|
4
|
-
import { ThemeList } from './theme-type';
|
|
3
|
+
import { Theme } from './theme.js';
|
|
4
|
+
import { ThemeList } from './theme-type.js';
|
|
5
5
|
export declare class ThemeQuery {
|
|
6
6
|
theme(id: string, context: ResolverContext): Promise<Theme>;
|
|
7
7
|
themes(params: ListParam, context: ResolverContext): Promise<ThemeList>;
|