@things-factory/board-service 6.1.22 → 6.1.27

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.
@@ -3,27 +3,32 @@ 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("./share/share"), exports);
6
7
  tslib_1.__exportStar(require("./board/board"), exports);
7
8
  tslib_1.__exportStar(require("./group/group"), exports);
8
9
  tslib_1.__exportStar(require("./play-group/play-group"), exports);
9
10
  /* IMPORT ENTITIES AND RESOLVERS */
11
+ const share_1 = require("./share");
10
12
  const board_1 = require("./board");
11
13
  const group_1 = require("./group");
12
14
  const play_group_1 = require("./play-group");
13
15
  exports.entities = [
14
16
  /* ENTITIES */
17
+ ...share_1.entities,
15
18
  ...board_1.entities,
16
19
  ...group_1.entities,
17
20
  ...play_group_1.entities
18
21
  ];
19
22
  exports.subscribers = [
20
23
  /* SUBSCRIBERS */
24
+ ...share_1.subscribers,
21
25
  ...board_1.subscribers,
22
26
  ...play_group_1.subscribers
23
27
  ];
24
28
  exports.schema = {
25
29
  resolverClasses: [
26
30
  /* RESOLVER CLASSES */
31
+ ...share_1.resolvers,
27
32
  ...board_1.resolvers,
28
33
  ...group_1.resolvers,
29
34
  ...play_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,kEAAuC;AAEvC,mCAAmC;AACnC,mCAAiH;AACjH,mCAAgF;AAChF,6CAIqB;AAER,QAAA,QAAQ,GAAG;IACtB,cAAc;IACd,GAAG,gBAAa;IAChB,GAAG,gBAAa;IAChB,GAAG,qBAAiB;CACrB,CAAA;AAEY,QAAA,WAAW,GAAG;IACzB,iBAAiB;IACjB,GAAG,mBAAgB;IACnB,GAAG,wBAAoB;CACxB,CAAA;AAEY,QAAA,MAAM,GAAG;IACpB,eAAe,EAAE;QACf,sBAAsB;QACtB,GAAG,iBAAc;QACjB,GAAG,iBAAc;QACjB,GAAG,sBAAkB;KACtB;CACF,CAAA","sourcesContent":["/* EXPORT ENTITY TYPES */\nexport * from './board/board'\nexport * from './group/group'\nexport * from './play-group/play-group'\n\n/* IMPORT ENTITIES AND RESOLVERS */\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 ...BoardEntities,\n ...GroupEntities,\n ...PlayGroupEntities\n]\n\nexport const subscribers = [\n /* SUBSCRIBERS */\n ...BoardSubscribers,\n ...PlayGroupSubscribers\n]\n\nexport const schema = {\n resolverClasses: [\n /* RESOLVER CLASSES */\n ...BoardResolvers,\n ...GroupResolvers,\n ...PlayGroupResolvers\n ]\n}\n"]}
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;IACd,GAAG,gBAAa;IAChB,GAAG,gBAAa;IAChB,GAAG,gBAAa;IAChB,GAAG,qBAAiB;CACrB,CAAA;AAEY,QAAA,WAAW,GAAG;IACzB,iBAAiB;IACjB,GAAG,mBAAgB;IACnB,GAAG,mBAAgB;IACnB,GAAG,wBAAoB;CACxB,CAAA;AAEY,QAAA,MAAM,GAAG;IACpB,eAAe,EAAE;QACf,sBAAsB;QACtB,GAAG,iBAAc;QACjB,GAAG,iBAAc;QACjB,GAAG,iBAAc;QACjB,GAAG,sBAAkB;KACtB;CACF,CAAA","sourcesContent":["/* EXPORT ENTITY TYPES */\nexport * from './share/share'\nexport * from './board/board'\nexport * from './group/group'\nexport * from './play-group/play-group'\n\n/* IMPORT ENTITIES AND RESOLVERS */\nimport { entities as ShareEntities, resolvers as ShareResolvers, subscribers as ShareSubscribers } from './share'\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 ...ShareEntities,\n ...BoardEntities,\n ...GroupEntities,\n ...PlayGroupEntities\n]\n\nexport const subscribers = [\n /* SUBSCRIBERS */\n ...ShareSubscribers,\n ...BoardSubscribers,\n ...PlayGroupSubscribers\n]\n\nexport const schema = {\n resolverClasses: [\n /* RESOLVER CLASSES */\n ...ShareResolvers,\n ...BoardResolvers,\n ...GroupResolvers,\n ...PlayGroupResolvers\n ]\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 share_1 = require("./share");
5
+ const share_query_1 = require("./share-query");
6
+ const share_mutation_1 = require("./share-mutation");
7
+ exports.entities = [share_1.Share];
8
+ exports.resolvers = [share_query_1.ShareQuery, share_mutation_1.ShareMutation];
9
+ exports.subscribers = [];
10
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../server/service/share/index.ts"],"names":[],"mappings":";;;AAAA,mCAA+B;AAC/B,+CAA0C;AAC1C,qDAAgD;AAEnC,QAAA,QAAQ,GAAG,CAAC,aAAK,CAAC,CAAA;AAClB,QAAA,SAAS,GAAG,CAAC,wBAAU,EAAE,8BAAa,CAAC,CAAA;AACvC,QAAA,WAAW,GAAG,EAAE,CAAA","sourcesContent":["import { Share } from './share'\nimport { ShareQuery } from './share-query'\nimport { ShareMutation } from './share-mutation'\n\nexport const entities = [Share]\nexport const resolvers = [ShareQuery, ShareMutation]\nexport const subscribers = []\n"]}
@@ -0,0 +1,125 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ShareMutation = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const type_graphql_1 = require("type-graphql");
6
+ const typeorm_1 = require("typeorm");
7
+ const share_1 = require("./share");
8
+ const share_type_1 = require("./share-type");
9
+ let ShareMutation = class ShareMutation {
10
+ async createShare(share, context) {
11
+ const { domain, user, tx } = context.state;
12
+ return await tx.getRepository(share_1.Share).save(Object.assign(Object.assign({}, share), { domain, creator: user, updater: user }));
13
+ }
14
+ async updateShare(id, patch, context) {
15
+ const { domain, user, tx } = context.state;
16
+ const repository = tx.getRepository(share_1.Share);
17
+ const share = await repository.findOne({
18
+ where: { domain: { id: domain.id }, id }
19
+ });
20
+ return await repository.save(Object.assign(Object.assign(Object.assign({}, share), patch), { updater: user }));
21
+ }
22
+ async updateMultipleShare(patches, context) {
23
+ const { domain, user, tx } = context.state;
24
+ let results = [];
25
+ const _createRecords = patches.filter((patch) => patch.cuFlag.toUpperCase() === '+');
26
+ const _updateRecords = patches.filter((patch) => patch.cuFlag.toUpperCase() === 'M');
27
+ const shareRepo = tx.getRepository(share_1.Share);
28
+ if (_createRecords.length > 0) {
29
+ for (let i = 0; i < _createRecords.length; i++) {
30
+ const newRecord = _createRecords[i];
31
+ const result = await shareRepo.save(Object.assign(Object.assign({}, newRecord), { domain, creator: user, updater: user }));
32
+ results.push(Object.assign(Object.assign({}, result), { cuFlag: '+' }));
33
+ }
34
+ }
35
+ if (_updateRecords.length > 0) {
36
+ for (let i = 0; i < _updateRecords.length; i++) {
37
+ const updateRecord = _updateRecords[i];
38
+ const share = await shareRepo.findOneBy({ id: updateRecord.id });
39
+ const result = await shareRepo.save(Object.assign(Object.assign(Object.assign({}, share), updateRecord), { updater: user }));
40
+ results.push(Object.assign(Object.assign({}, result), { cuFlag: 'M' }));
41
+ }
42
+ }
43
+ return results;
44
+ }
45
+ async deleteShare(id, context) {
46
+ const { domain, tx } = context.state;
47
+ await tx.getRepository(share_1.Share).delete({ domain: { id: domain.id }, id });
48
+ return true;
49
+ }
50
+ async deleteShares(ids, context) {
51
+ const { domain, tx } = context.state;
52
+ await tx.getRepository(share_1.Share).delete({
53
+ domain: { id: domain.id },
54
+ id: (0, typeorm_1.In)(ids)
55
+ });
56
+ return true;
57
+ }
58
+ async importShares(shares, context) {
59
+ const { domain, tx } = context.state;
60
+ await Promise.all(shares.map(async (share) => {
61
+ const createdShare = await tx.getRepository(share_1.Share).save(Object.assign({ domain }, share));
62
+ }));
63
+ return true;
64
+ }
65
+ };
66
+ tslib_1.__decorate([
67
+ (0, type_graphql_1.Directive)('@transaction'),
68
+ (0, type_graphql_1.Mutation)(returns => share_1.Share, { description: 'To create new Share' }),
69
+ tslib_1.__param(0, (0, type_graphql_1.Arg)('share')),
70
+ tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
71
+ tslib_1.__metadata("design:type", Function),
72
+ tslib_1.__metadata("design:paramtypes", [share_type_1.NewShare, Object]),
73
+ tslib_1.__metadata("design:returntype", Promise)
74
+ ], ShareMutation.prototype, "createShare", null);
75
+ tslib_1.__decorate([
76
+ (0, type_graphql_1.Directive)('@transaction'),
77
+ (0, type_graphql_1.Mutation)(returns => share_1.Share, { description: 'To modify Share information' }),
78
+ tslib_1.__param(0, (0, type_graphql_1.Arg)('id')),
79
+ tslib_1.__param(1, (0, type_graphql_1.Arg)('patch')),
80
+ tslib_1.__param(2, (0, type_graphql_1.Ctx)()),
81
+ tslib_1.__metadata("design:type", Function),
82
+ tslib_1.__metadata("design:paramtypes", [String, share_type_1.SharePatch, Object]),
83
+ tslib_1.__metadata("design:returntype", Promise)
84
+ ], ShareMutation.prototype, "updateShare", null);
85
+ tslib_1.__decorate([
86
+ (0, type_graphql_1.Directive)('@transaction'),
87
+ (0, type_graphql_1.Mutation)(returns => [share_1.Share], { description: "To modify multiple Shares' information" }),
88
+ tslib_1.__param(0, (0, type_graphql_1.Arg)('patches', type => [share_type_1.SharePatch])),
89
+ tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
90
+ tslib_1.__metadata("design:type", Function),
91
+ tslib_1.__metadata("design:paramtypes", [Array, Object]),
92
+ tslib_1.__metadata("design:returntype", Promise)
93
+ ], ShareMutation.prototype, "updateMultipleShare", null);
94
+ tslib_1.__decorate([
95
+ (0, type_graphql_1.Directive)('@transaction'),
96
+ (0, type_graphql_1.Mutation)(returns => Boolean, { description: 'To delete Share' }),
97
+ tslib_1.__param(0, (0, type_graphql_1.Arg)('id')),
98
+ tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
99
+ tslib_1.__metadata("design:type", Function),
100
+ tslib_1.__metadata("design:paramtypes", [String, Object]),
101
+ tslib_1.__metadata("design:returntype", Promise)
102
+ ], ShareMutation.prototype, "deleteShare", null);
103
+ tslib_1.__decorate([
104
+ (0, type_graphql_1.Directive)('@transaction'),
105
+ (0, type_graphql_1.Mutation)(returns => Boolean, { description: 'To delete multiple Shares' }),
106
+ tslib_1.__param(0, (0, type_graphql_1.Arg)('ids', type => [String])),
107
+ tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
108
+ tslib_1.__metadata("design:type", Function),
109
+ tslib_1.__metadata("design:paramtypes", [Array, Object]),
110
+ tslib_1.__metadata("design:returntype", Promise)
111
+ ], ShareMutation.prototype, "deleteShares", null);
112
+ tslib_1.__decorate([
113
+ (0, type_graphql_1.Directive)('@transaction'),
114
+ (0, type_graphql_1.Mutation)(returns => Boolean, { description: 'To import multiple Shares' }),
115
+ tslib_1.__param(0, (0, type_graphql_1.Arg)('shares', type => [share_type_1.SharePatch])),
116
+ tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
117
+ tslib_1.__metadata("design:type", Function),
118
+ tslib_1.__metadata("design:paramtypes", [Array, Object]),
119
+ tslib_1.__metadata("design:returntype", Promise)
120
+ ], ShareMutation.prototype, "importShares", null);
121
+ ShareMutation = tslib_1.__decorate([
122
+ (0, type_graphql_1.Resolver)(share_1.Share)
123
+ ], ShareMutation);
124
+ exports.ShareMutation = ShareMutation;
125
+ //# sourceMappingURL=share-mutation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"share-mutation.js","sourceRoot":"","sources":["../../../server/service/share/share-mutation.ts"],"names":[],"mappings":";;;;AAAA,+CAAsE;AACtE,qCAA4B;AAI5B,mCAA+B;AAC/B,6CAAmD;AAG5C,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,aAAK,CAAC,CAAC,IAAI,iCACpC,KAAK,KACR,MAAM,EACN,OAAO,EAAE,IAAI,EACb,OAAO,EAAE,IAAI,IACb,CAAA;IACJ,CAAC;IAIK,AAAN,KAAK,CAAC,WAAW,CACJ,EAAU,EACP,KAAiB,EACxB,OAAwB;QAE/B,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAE1C,MAAM,UAAU,GAAG,EAAE,CAAC,aAAa,CAAC,aAAK,CAAC,CAAA;QAC1C,MAAM,KAAK,GAAG,MAAM,UAAU,CAAC,OAAO,CAAC;YACrC,KAAK,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,MAAM,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE;SACzC,CAAC,CAAA;QAEF,OAAO,MAAM,UAAU,CAAC,IAAI,+CACvB,KAAK,GACL,KAAK,KACR,OAAO,EAAE,IAAI,IACb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E,CAAA;;;;gDAM9C;AAIK;IAFL,IAAA,wBAAS,EAAC,cAAc,CAAC;IACzB,IAAA,uBAAQ,EAAC,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,WAAW,EAAE,2BAA2B,EAAE,CAAC;IACvD,mBAAA,IAAA,kBAAG,EAAC,KAAK,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAA;IAAiB,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;iDASrE;AAIK;IAFL,IAAA,wBAAS,EAAC,cAAc,CAAC;IACzB,IAAA,uBAAQ,EAAC,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,WAAW,EAAE,2BAA2B,EAAE,CAAC;IAExE,mBAAA,IAAA,kBAAG,EAAC,QAAQ,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,uBAAU,CAAC,CAAC,CAAA;IACnC,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;iDAWP;AAvHU,aAAa;IADzB,IAAA,uBAAQ,EAAC,aAAK,CAAC;GACH,aAAa,CAwHzB;AAxHY,sCAAa","sourcesContent":["import { Resolver, Mutation, Arg, Ctx, Directive } from 'type-graphql'\nimport { In } from 'typeorm'\n\nimport { createAttachment, deleteAttachmentsByRef } from '@things-factory/attachment-base'\n\nimport { Share } from './share'\nimport { NewShare, SharePatch } from './share-type'\n\n@Resolver(Share)\nexport class ShareMutation {\n @Directive('@transaction')\n @Mutation(returns => Share, { description: 'To create new Share' })\n async createShare(@Arg('share') share: NewShare, @Ctx() context: ResolverContext): Promise<Share> {\n const { domain, user, tx } = context.state\n\n return await tx.getRepository(Share).save({\n ...share,\n domain,\n creator: user,\n updater: user\n })\n }\n\n @Directive('@transaction')\n @Mutation(returns => Share, { description: 'To modify Share information' })\n async updateShare(\n @Arg('id') id: string,\n @Arg('patch') patch: SharePatch,\n @Ctx() context: ResolverContext\n ): Promise<Share> {\n const { domain, user, tx } = context.state\n\n const repository = tx.getRepository(Share)\n const share = await repository.findOne({\n where: { domain: { id: domain.id }, id }\n })\n\n return await repository.save({\n ...share,\n ...patch,\n updater: user\n })\n }\n\n @Directive('@transaction')\n @Mutation(returns => [Share], { description: \"To modify multiple Shares' information\" })\n async updateMultipleShare(\n @Arg('patches', type => [SharePatch]) patches: SharePatch[],\n @Ctx() context: ResolverContext\n ): Promise<Share[]> {\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 shareRepo = tx.getRepository(Share)\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 shareRepo.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 share = await shareRepo.findOneBy({ id: updateRecord.id })\n\n const result = await shareRepo.save({\n ...share,\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: 'To delete Share' })\n async deleteShare(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<boolean> {\n const { domain, tx } = context.state\n\n await tx.getRepository(Share).delete({ domain: { id: domain.id }, id })\n\n return true\n }\n\n @Directive('@transaction')\n @Mutation(returns => Boolean, { description: 'To delete multiple Shares' })\n async deleteShares(@Arg('ids', type => [String]) ids: string[], @Ctx() context: ResolverContext): Promise<boolean> {\n const { domain, tx } = context.state\n\n await tx.getRepository(Share).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: 'To import multiple Shares' })\n async importShares(\n @Arg('shares', type => [SharePatch]) shares: SharePatch[],\n @Ctx() context: ResolverContext\n ): Promise<boolean> {\n const { domain, tx } = context.state\n\n await Promise.all(\n shares.map(async (share: SharePatch) => {\n const createdShare: Share = await tx.getRepository(Share).save({ domain, ...share })\n })\n )\n\n return true\n }\n}\n"]}
@@ -0,0 +1,79 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ShareQuery = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const type_graphql_1 = require("type-graphql");
6
+ const shell_1 = require("@things-factory/shell");
7
+ const auth_base_1 = require("@things-factory/auth-base");
8
+ const share_1 = require("./share");
9
+ const share_type_1 = require("./share-type");
10
+ let ShareQuery = class ShareQuery {
11
+ async share(id, context) {
12
+ const { domain } = context.state;
13
+ return await (0, shell_1.getRepository)(share_1.Share).findOne({
14
+ where: { domain: { id: domain.id }, id }
15
+ });
16
+ }
17
+ async shares(params, context) {
18
+ const { domain } = context.state;
19
+ const queryBuilder = (0, shell_1.getQueryBuilderFromListParams)({
20
+ domain,
21
+ params,
22
+ repository: await (0, shell_1.getRepository)(share_1.Share),
23
+ searchables: ['name', 'description']
24
+ });
25
+ const [items, total] = await queryBuilder.getManyAndCount();
26
+ return { items, total };
27
+ }
28
+ async domain(share) {
29
+ return share.domainId && (await (0, shell_1.getRepository)(shell_1.Domain).findOneBy({ id: share.domainId }));
30
+ }
31
+ async updater(share) {
32
+ return share.updaterId && (await (0, shell_1.getRepository)(auth_base_1.User).findOneBy({ id: share.updaterId }));
33
+ }
34
+ async creator(share) {
35
+ return share.creatorId && (await (0, shell_1.getRepository)(auth_base_1.User).findOneBy({ id: share.creatorId }));
36
+ }
37
+ };
38
+ tslib_1.__decorate([
39
+ (0, type_graphql_1.Query)(returns => share_1.Share, { nullable: true, description: 'To fetch a Share' }),
40
+ tslib_1.__param(0, (0, type_graphql_1.Arg)('id')),
41
+ tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
42
+ tslib_1.__metadata("design:type", Function),
43
+ tslib_1.__metadata("design:paramtypes", [String, Object]),
44
+ tslib_1.__metadata("design:returntype", Promise)
45
+ ], ShareQuery.prototype, "share", null);
46
+ tslib_1.__decorate([
47
+ (0, type_graphql_1.Query)(returns => share_type_1.ShareList, { description: 'To fetch multiple Shares' }),
48
+ tslib_1.__param(0, (0, type_graphql_1.Args)()),
49
+ tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
50
+ tslib_1.__metadata("design:type", Function),
51
+ tslib_1.__metadata("design:paramtypes", [shell_1.ListParam, Object]),
52
+ tslib_1.__metadata("design:returntype", Promise)
53
+ ], ShareQuery.prototype, "shares", null);
54
+ tslib_1.__decorate([
55
+ (0, type_graphql_1.FieldResolver)(type => shell_1.Domain),
56
+ tslib_1.__param(0, (0, type_graphql_1.Root)()),
57
+ tslib_1.__metadata("design:type", Function),
58
+ tslib_1.__metadata("design:paramtypes", [share_1.Share]),
59
+ tslib_1.__metadata("design:returntype", Promise)
60
+ ], ShareQuery.prototype, "domain", null);
61
+ tslib_1.__decorate([
62
+ (0, type_graphql_1.FieldResolver)(type => auth_base_1.User),
63
+ tslib_1.__param(0, (0, type_graphql_1.Root)()),
64
+ tslib_1.__metadata("design:type", Function),
65
+ tslib_1.__metadata("design:paramtypes", [share_1.Share]),
66
+ tslib_1.__metadata("design:returntype", Promise)
67
+ ], ShareQuery.prototype, "updater", null);
68
+ tslib_1.__decorate([
69
+ (0, type_graphql_1.FieldResolver)(type => auth_base_1.User),
70
+ tslib_1.__param(0, (0, type_graphql_1.Root)()),
71
+ tslib_1.__metadata("design:type", Function),
72
+ tslib_1.__metadata("design:paramtypes", [share_1.Share]),
73
+ tslib_1.__metadata("design:returntype", Promise)
74
+ ], ShareQuery.prototype, "creator", null);
75
+ ShareQuery = tslib_1.__decorate([
76
+ (0, type_graphql_1.Resolver)(share_1.Share)
77
+ ], ShareQuery);
78
+ exports.ShareQuery = ShareQuery;
79
+ //# sourceMappingURL=share-query.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"share-query.js","sourceRoot":"","sources":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CAwCtB;AAxCY,gCAAU","sourcesContent":["import { Resolver, Query, FieldResolver, Root, Args, Arg, Ctx, Directive } from 'type-graphql'\nimport { Domain, getQueryBuilderFromListParams, getRepository, ListParam } from '@things-factory/shell'\nimport { User } from '@things-factory/auth-base'\nimport { Share } from './share'\nimport { ShareList } from './share-type'\n\n@Resolver(Share)\nexport class ShareQuery {\n @Query(returns => Share!, { nullable: true, description: 'To fetch a Share' })\n async share(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<Share> {\n const { domain } = context.state\n\n return await getRepository(Share).findOne({\n where: { domain: { id: domain.id }, id }\n })\n }\n\n @Query(returns => ShareList, { description: 'To fetch multiple Shares' })\n async shares(@Args() params: ListParam, @Ctx() context: ResolverContext): Promise<ShareList> {\n const { domain } = context.state\n\n const queryBuilder = getQueryBuilderFromListParams({\n domain,\n params,\n repository: await getRepository(Share),\n searchables: ['name', 'description']\n })\n\n const [items, total] = await queryBuilder.getManyAndCount()\n\n return { items, total }\n }\n\n @FieldResolver(type => Domain)\n async domain(@Root() share: Share): Promise<Domain> {\n return share.domainId && (await getRepository(Domain).findOneBy({ id: share.domainId }))\n }\n\n @FieldResolver(type => User)\n async updater(@Root() share: Share): Promise<User> {\n return share.updaterId && (await getRepository(User).findOneBy({ id: share.updaterId }))\n }\n\n @FieldResolver(type => User)\n async creator(@Root() share: Share): Promise<User> {\n return share.creatorId && (await getRepository(User).findOneBy({ id: share.creatorId }))\n }\n}\n"]}
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ShareList = exports.SharePatch = exports.NewShare = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const type_graphql_1 = require("type-graphql");
6
+ const shell_1 = require("@things-factory/shell");
7
+ const share_1 = require("./share");
8
+ let NewShare = class NewShare {
9
+ };
10
+ tslib_1.__decorate([
11
+ (0, type_graphql_1.Field)(),
12
+ tslib_1.__metadata("design:type", String)
13
+ ], NewShare.prototype, "name", void 0);
14
+ tslib_1.__decorate([
15
+ (0, type_graphql_1.Field)({ nullable: true }),
16
+ tslib_1.__metadata("design:type", String)
17
+ ], NewShare.prototype, "description", void 0);
18
+ tslib_1.__decorate([
19
+ (0, type_graphql_1.Field)(type => shell_1.ScalarObject, { nullable: true }),
20
+ tslib_1.__metadata("design:type", Object)
21
+ ], NewShare.prototype, "value", void 0);
22
+ NewShare = tslib_1.__decorate([
23
+ (0, type_graphql_1.InputType)()
24
+ ], NewShare);
25
+ exports.NewShare = NewShare;
26
+ let SharePatch = class SharePatch {
27
+ };
28
+ tslib_1.__decorate([
29
+ (0, type_graphql_1.Field)(type => type_graphql_1.ID, { nullable: true }),
30
+ tslib_1.__metadata("design:type", String)
31
+ ], SharePatch.prototype, "id", void 0);
32
+ tslib_1.__decorate([
33
+ (0, type_graphql_1.Field)({ nullable: true }),
34
+ tslib_1.__metadata("design:type", String)
35
+ ], SharePatch.prototype, "name", void 0);
36
+ tslib_1.__decorate([
37
+ (0, type_graphql_1.Field)({ nullable: true }),
38
+ tslib_1.__metadata("design:type", String)
39
+ ], SharePatch.prototype, "description", void 0);
40
+ tslib_1.__decorate([
41
+ (0, type_graphql_1.Field)(type => shell_1.ScalarObject, { nullable: true }),
42
+ tslib_1.__metadata("design:type", Object)
43
+ ], SharePatch.prototype, "value", void 0);
44
+ tslib_1.__decorate([
45
+ (0, type_graphql_1.Field)({ nullable: true }),
46
+ tslib_1.__metadata("design:type", String)
47
+ ], SharePatch.prototype, "cuFlag", void 0);
48
+ SharePatch = tslib_1.__decorate([
49
+ (0, type_graphql_1.InputType)()
50
+ ], SharePatch);
51
+ exports.SharePatch = SharePatch;
52
+ let ShareList = class ShareList {
53
+ };
54
+ tslib_1.__decorate([
55
+ (0, type_graphql_1.Field)(type => [share_1.Share]),
56
+ tslib_1.__metadata("design:type", Array)
57
+ ], ShareList.prototype, "items", void 0);
58
+ tslib_1.__decorate([
59
+ (0, type_graphql_1.Field)(type => type_graphql_1.Int),
60
+ tslib_1.__metadata("design:type", Number)
61
+ ], ShareList.prototype, "total", void 0);
62
+ ShareList = tslib_1.__decorate([
63
+ (0, type_graphql_1.ObjectType)()
64
+ ], ShareList);
65
+ exports.ShareList = ShareList;
66
+ //# sourceMappingURL=share-type.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"share-type.js","sourceRoot":"","sources":["../../../server/service/share/share-type.ts"],"names":[],"mappings":";;;;AAAA,+CAAoE;AAEpE,iDAAoD;AACpD,mCAA+B;AAGxB,IAAM,QAAQ,GAAd,MAAM,QAAQ;CASpB,CAAA;AARC;IAAC,IAAA,oBAAK,GAAE;;sCACI;AAEZ;IAAC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;6CACN;AAEpB;IAAC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,oBAAY,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;uCACrC;AARA,QAAQ;IADpB,IAAA,wBAAS,GAAE;GACC,QAAQ,CASpB;AATY,4BAAQ;AAYd,IAAM,UAAU,GAAhB,MAAM,UAAU;CAetB,CAAA;AAdC;IAAC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,iBAAE,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;sCAC3B;AAEX;IAAC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;wCACb;AAEb;IAAC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;+CACN;AAEpB;IAAC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,oBAAY,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;yCACrC;AAEX;IAAC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;0CACX;AAdJ,UAAU;IADtB,IAAA,wBAAS,GAAE;GACC,UAAU,CAetB;AAfY,gCAAU;AAkBhB,IAAM,SAAS,GAAf,MAAM,SAAS;CAMrB,CAAA;AALC;IAAC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,CAAC,aAAK,CAAC,CAAC;;wCACT;AAEd;IAAC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,kBAAG,CAAC;;wCACN;AALF,SAAS;IADrB,IAAA,yBAAU,GAAE;GACA,SAAS,CAMrB;AANY,8BAAS","sourcesContent":["import { ObjectType, Field, InputType, Int, ID } from 'type-graphql'\n\nimport { ScalarObject } from '@things-factory/shell'\nimport { Share } from './share'\n\n@InputType()\nexport class NewShare {\n @Field()\n name: string\n\n @Field({ nullable: true })\n description?: string\n\n @Field(type => ScalarObject, { nullable: true })\n value?: any\n}\n\n@InputType()\nexport class SharePatch {\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 => ScalarObject, { nullable: true })\n value?: any\n\n @Field({ nullable: true })\n cuFlag?: string\n}\n\n@ObjectType()\nexport class ShareList {\n @Field(type => [Share])\n items: Share[]\n\n @Field(type => Int)\n total: number\n}\n"]}
@@ -0,0 +1,96 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Share = 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
+ var ShareTypes = {
10
+ Legend: {
11
+ name: 'Legend',
12
+ propType: 'legend'
13
+ }
14
+ };
15
+ let Share = class Share {
16
+ static registerShareType(shareType) {
17
+ ShareTypes[shareType.name] = shareType;
18
+ }
19
+ static getShareType(name) {
20
+ return ShareTypes[name];
21
+ }
22
+ };
23
+ tslib_1.__decorate([
24
+ (0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
25
+ (0, type_graphql_1.Field)(type => type_graphql_1.ID),
26
+ tslib_1.__metadata("design:type", String)
27
+ ], Share.prototype, "id", void 0);
28
+ tslib_1.__decorate([
29
+ (0, typeorm_1.ManyToOne)(type => shell_1.Domain),
30
+ (0, type_graphql_1.Field)({ nullable: true }),
31
+ tslib_1.__metadata("design:type", shell_1.Domain)
32
+ ], Share.prototype, "domain", void 0);
33
+ tslib_1.__decorate([
34
+ (0, typeorm_1.RelationId)((share) => share.domain),
35
+ tslib_1.__metadata("design:type", String)
36
+ ], Share.prototype, "domainId", void 0);
37
+ tslib_1.__decorate([
38
+ (0, typeorm_1.Column)(),
39
+ (0, type_graphql_1.Field)({ nullable: true }),
40
+ tslib_1.__metadata("design:type", String)
41
+ ], Share.prototype, "name", void 0);
42
+ tslib_1.__decorate([
43
+ (0, typeorm_1.Column)({ nullable: true }),
44
+ (0, type_graphql_1.Field)({ nullable: true }),
45
+ tslib_1.__metadata("design:type", String)
46
+ ], Share.prototype, "description", void 0);
47
+ tslib_1.__decorate([
48
+ (0, typeorm_1.Column)({ nullable: true }),
49
+ (0, type_graphql_1.Field)({ nullable: true }),
50
+ tslib_1.__metadata("design:type", String)
51
+ ], Share.prototype, "type", void 0);
52
+ tslib_1.__decorate([
53
+ (0, typeorm_1.Column)('simple-json', { nullable: true }),
54
+ (0, type_graphql_1.Field)(type => shell_1.ScalarObject, { nullable: true }),
55
+ tslib_1.__metadata("design:type", Object)
56
+ ], Share.prototype, "value", void 0);
57
+ tslib_1.__decorate([
58
+ (0, typeorm_1.CreateDateColumn)(),
59
+ (0, type_graphql_1.Field)({ nullable: true }),
60
+ tslib_1.__metadata("design:type", Date)
61
+ ], Share.prototype, "createdAt", void 0);
62
+ tslib_1.__decorate([
63
+ (0, typeorm_1.UpdateDateColumn)(),
64
+ (0, type_graphql_1.Field)({ nullable: true }),
65
+ tslib_1.__metadata("design:type", Date)
66
+ ], Share.prototype, "updatedAt", void 0);
67
+ tslib_1.__decorate([
68
+ (0, typeorm_1.DeleteDateColumn)(),
69
+ (0, type_graphql_1.Field)({ nullable: true }),
70
+ tslib_1.__metadata("design:type", Date)
71
+ ], Share.prototype, "deletedAt", void 0);
72
+ tslib_1.__decorate([
73
+ (0, typeorm_1.ManyToOne)(type => auth_base_1.User, { nullable: true }),
74
+ (0, type_graphql_1.Field)(type => auth_base_1.User, { nullable: true }),
75
+ tslib_1.__metadata("design:type", auth_base_1.User)
76
+ ], Share.prototype, "creator", void 0);
77
+ tslib_1.__decorate([
78
+ (0, typeorm_1.RelationId)((share) => share.creator),
79
+ tslib_1.__metadata("design:type", String)
80
+ ], Share.prototype, "creatorId", void 0);
81
+ tslib_1.__decorate([
82
+ (0, typeorm_1.ManyToOne)(type => auth_base_1.User, { nullable: true }),
83
+ (0, type_graphql_1.Field)(type => auth_base_1.User, { nullable: true }),
84
+ tslib_1.__metadata("design:type", auth_base_1.User)
85
+ ], Share.prototype, "updater", void 0);
86
+ tslib_1.__decorate([
87
+ (0, typeorm_1.RelationId)((share) => share.updater),
88
+ tslib_1.__metadata("design:type", String)
89
+ ], Share.prototype, "updaterId", void 0);
90
+ Share = tslib_1.__decorate([
91
+ (0, typeorm_1.Entity)(),
92
+ (0, typeorm_1.Index)('ix_share_0', (share) => [share.domain, share.name, share.deletedAt], { unique: true }),
93
+ (0, type_graphql_1.ObjectType)({ description: 'Entity for Share' })
94
+ ], Share);
95
+ exports.Share = Share;
96
+ //# sourceMappingURL=share.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"share.js","sourceRoot":"","sources":["../../../server/service/share/share.ts"],"names":[],"mappings":";;;;AAAA,qCAUgB;AAChB,+CAAoD;AAEpD,iDAA4D;AAC5D,yDAAgD;AAOhD,IAAI,UAAU,GAAkC;IAC9C,MAAM,EAAE;QACN,IAAI,EAAE,QAAQ;QACd,QAAQ,EAAE,QAAQ;KACnB;CACF,CAAA;AAKM,IAAM,KAAK,GAAX,MAAM,KAAK;IAChB,MAAM,CAAC,iBAAiB,CAAC,SAAoB;QAC3C,UAAU,CAAC,SAAS,CAAC,I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\n Column,\n RelationId,\n ManyToOne,\n PrimaryGeneratedColumn\n} from 'typeorm'\nimport { ObjectType, Field, ID } from 'type-graphql'\n\nimport { Domain, ScalarObject } from '@things-factory/shell'\nimport { User } from '@things-factory/auth-base'\n\nexport interface ShareType {\n name: string\n propType: string\n}\n\nvar ShareTypes: { [name: string]: ShareType } = {\n Legend: {\n name: 'Legend',\n propType: 'legend'\n }\n}\n\n@Entity()\n@Index('ix_share_0', (share: Share) => [share.domain, share.name, share.deletedAt], { unique: true })\n@ObjectType({ description: 'Entity for Share' })\nexport class Share {\n static registerShareType(shareType: ShareType) {\n ShareTypes[shareType.name] = shareType\n }\n\n static getShareType(name: string) {\n return ShareTypes[name]\n }\n\n @PrimaryGeneratedColumn('uuid')\n @Field(type => ID)\n readonly id: string\n\n @ManyToOne(type => Domain)\n @Field({ nullable: true })\n domain?: Domain\n\n @RelationId((share: Share) => share.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 type?: string\n\n @Column('simple-json', { nullable: true })\n @Field(type => ScalarObject, { nullable: true })\n value?: any\n\n @CreateDateColumn()\n @Field({ nullable: true })\n createdAt?: Date\n\n @UpdateDateColumn()\n @Field({ nullable: true })\n updatedAt?: Date\n\n @DeleteDateColumn()\n @Field({ nullable: true })\n deletedAt?: Date\n\n @ManyToOne(type => User, { nullable: true })\n @Field(type => User, { nullable: true })\n creator?: User\n\n @RelationId((share: Share) => share.creator)\n creatorId?: string\n\n @ManyToOne(type => User, { nullable: true })\n @Field(type => User, { nullable: true })\n updater?: User\n\n @RelationId((share: Share) => share.updater)\n updaterId?: string\n}\n"]}