@things-factory/document-template-base 6.1.84 → 6.1.89

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.
@@ -4,4 +4,5 @@ const tslib_1 = require("tslib");
4
4
  require("./routes");
5
5
  tslib_1.__exportStar(require("./constants"), exports);
6
6
  tslib_1.__exportStar(require("./controllers"), exports);
7
+ tslib_1.__exportStar(require("./service"), exports);
7
8
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../server/index.ts"],"names":[],"mappings":";;;AAAA,oBAAiB;AAEjB,sDAA2B;AAC3B,wDAA6B","sourcesContent":["import './routes'\n\nexport * from './constants'\nexport * from './controllers'\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../server/index.ts"],"names":[],"mappings":";;;AAAA,oBAAiB;AAEjB,sDAA2B;AAC3B,wDAA6B;AAC7B,oDAAyB","sourcesContent":["import './routes'\n\nexport * from './constants'\nexport * from './controllers'\nexport * from './service'\n"]}
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.subscribers = exports.schema = exports.entities = void 0;
4
+ const tslib_1 = require("tslib");
5
+ /* EXPORT ENTITY TYPES */
6
+ tslib_1.__exportStar(require("./template-file/template-file"), exports);
7
+ /* IMPORT ENTITIES AND RESOLVERS */
8
+ const template_file_1 = require("./template-file");
9
+ exports.entities = [
10
+ /* ENTITIES */
11
+ ...template_file_1.entities
12
+ ];
13
+ exports.schema = {
14
+ resolverClasses: [
15
+ /* RESOLVER CLASSES */
16
+ ...template_file_1.resolvers
17
+ ]
18
+ };
19
+ exports.subscribers = [
20
+ /* SUBSCRIBERS */
21
+ ];
22
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../server/service/index.ts"],"names":[],"mappings":";;;;AAAA,yBAAyB;AACzB,wEAA6C;AAE7C,mCAAmC;AACnC,mDAAsG;AAEzF,QAAA,QAAQ,GAAG;IACtB,cAAc;IACf,GAAG,wBAAoB;CACvB,CAAA;AAEY,QAAA,MAAM,GAAG;IACpB,eAAe,EAAE;QACf,sBAAsB;QACxB,GAAG,yBAAqB;KACvB;CACF,CAAA;AAEY,QAAA,WAAW,GAAG;AACzB,iBAAiB;CAClB,CAAA","sourcesContent":["/* EXPORT ENTITY TYPES */\nexport * from './template-file/template-file'\n\n/* IMPORT ENTITIES AND RESOLVERS */\nimport { entities as TemplateFileEntities, resolvers as TemplateFileResolvers } from './template-file'\n\nexport const entities = [\n /* ENTITIES */\n\t...TemplateFileEntities\n]\n\nexport const schema = {\n resolverClasses: [\n /* RESOLVER CLASSES */\n\t\t...TemplateFileResolvers\n ]\n}\n\nexport const subscribers = [\n /* SUBSCRIBERS */\n]\n"]}
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.resolvers = exports.entities = void 0;
4
+ const template_file_1 = require("./template-file");
5
+ const template_file_query_1 = require("./template-file-query");
6
+ const template_file_mutation_1 = require("./template-file-mutation");
7
+ exports.entities = [template_file_1.TemplateFile];
8
+ exports.resolvers = [template_file_query_1.TemplateFileQuery, template_file_mutation_1.TemplateFileMutation];
9
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../server/service/template-file/index.ts"],"names":[],"mappings":";;;AACA,mDAA8C;AAC9C,+DAAyD;AACzD,qEAA+D;AAElD,QAAA,QAAQ,GAAG,CAAC,4BAAY,CAAC,CAAA;AACzB,QAAA,SAAS,GAAG,CAAC,uCAAiB,EAAE,6CAAoB,CAAC,CAAA","sourcesContent":["\nimport { TemplateFile } from './template-file'\nimport { TemplateFileQuery } from './template-file-query'\nimport { TemplateFileMutation } from './template-file-mutation'\n\nexport const entities = [TemplateFile]\nexport const resolvers = [TemplateFileQuery, TemplateFileMutation]\n"]}
@@ -0,0 +1,112 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TemplateFileMutation = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const type_graphql_1 = require("type-graphql");
6
+ const template_file_1 = require("./template-file");
7
+ const template_file_type_1 = require("./template-file-type");
8
+ let TemplateFileMutation = class TemplateFileMutation {
9
+ async createTemplateFile(templateFile, context) {
10
+ const { domain, user, tx } = context.state;
11
+ return await tx.getRepository(template_file_1.TemplateFile).save(Object.assign(Object.assign({}, templateFile), { domain, creator: user, updater: user }));
12
+ }
13
+ async updateTemplateFile(id, patch, context) {
14
+ const { domain, user, tx } = context.state;
15
+ const repository = tx.getRepository(template_file_1.TemplateFile);
16
+ const templateFile = await repository.findOne({
17
+ where: { domain: { id: domain.id }, id },
18
+ relations: ['domain', 'updater', 'creator', 'attachment']
19
+ });
20
+ return await repository.save(Object.assign(Object.assign(Object.assign({}, templateFile), patch), { updater: user }));
21
+ }
22
+ async updateMultipleTemplateFile(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 templateFileRepo = tx.getRepository(template_file_1.TemplateFile);
28
+ if (_createRecords.length > 0) {
29
+ for (let i = 0; i < _createRecords.length; i++) {
30
+ const newRecord = _createRecords[i];
31
+ const result = await templateFileRepo.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 updRecord = _updateRecords[i];
38
+ const templateFile = await templateFileRepo.findOne({
39
+ where: { domain: { id: domain.id }, id: updRecord.id },
40
+ relations: ['domain', 'updater', 'creator', 'attachment']
41
+ });
42
+ const result = await templateFileRepo.save(Object.assign(Object.assign(Object.assign({}, templateFile), updRecord), { updater: user }));
43
+ results.push(Object.assign(Object.assign({}, result), { cuFlag: 'M' }));
44
+ }
45
+ }
46
+ return results;
47
+ }
48
+ async deleteTemplateFile(id, context) {
49
+ const { domain, tx, user } = context.state;
50
+ await tx.getRepository(template_file_1.TemplateFile).remove({ domain, id, updater: user });
51
+ return true;
52
+ }
53
+ async deleteTemplateFiles(ids, context) {
54
+ const { domain, tx, user } = context.state;
55
+ let delEntitis = ids.map(id => {
56
+ return { domain, id, updater: user };
57
+ });
58
+ await tx.getRepository(template_file_1.TemplateFile).remove(delEntitis);
59
+ return true;
60
+ }
61
+ };
62
+ tslib_1.__decorate([
63
+ (0, type_graphql_1.Directive)('@transaction'),
64
+ (0, type_graphql_1.Mutation)(returns => template_file_1.TemplateFile, { description: 'To create new TemplateFile' }),
65
+ tslib_1.__param(0, (0, type_graphql_1.Arg)('templateFile')),
66
+ tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
67
+ tslib_1.__metadata("design:type", Function),
68
+ tslib_1.__metadata("design:paramtypes", [template_file_type_1.NewTemplateFile, Object]),
69
+ tslib_1.__metadata("design:returntype", Promise)
70
+ ], TemplateFileMutation.prototype, "createTemplateFile", null);
71
+ tslib_1.__decorate([
72
+ (0, type_graphql_1.Directive)('@transaction'),
73
+ (0, type_graphql_1.Mutation)(returns => template_file_1.TemplateFile, { description: 'To modify TemplateFile information' }),
74
+ tslib_1.__param(0, (0, type_graphql_1.Arg)('id')),
75
+ tslib_1.__param(1, (0, type_graphql_1.Arg)('patch')),
76
+ tslib_1.__param(2, (0, type_graphql_1.Ctx)()),
77
+ tslib_1.__metadata("design:type", Function),
78
+ tslib_1.__metadata("design:paramtypes", [String, template_file_type_1.TemplateFilePatch, Object]),
79
+ tslib_1.__metadata("design:returntype", Promise)
80
+ ], TemplateFileMutation.prototype, "updateTemplateFile", null);
81
+ tslib_1.__decorate([
82
+ (0, type_graphql_1.Directive)('@transaction'),
83
+ (0, type_graphql_1.Mutation)(returns => [template_file_1.TemplateFile], { description: "To modify multiple TemplateFiles' information" }),
84
+ tslib_1.__param(0, (0, type_graphql_1.Arg)('patches', type => [template_file_type_1.TemplateFilePatch])),
85
+ tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
86
+ tslib_1.__metadata("design:type", Function),
87
+ tslib_1.__metadata("design:paramtypes", [Array, Object]),
88
+ tslib_1.__metadata("design:returntype", Promise)
89
+ ], TemplateFileMutation.prototype, "updateMultipleTemplateFile", null);
90
+ tslib_1.__decorate([
91
+ (0, type_graphql_1.Directive)('@transaction'),
92
+ (0, type_graphql_1.Mutation)(returns => Boolean, { description: 'To delete TemplateFile' }),
93
+ tslib_1.__param(0, (0, type_graphql_1.Arg)('id')),
94
+ tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
95
+ tslib_1.__metadata("design:type", Function),
96
+ tslib_1.__metadata("design:paramtypes", [String, Object]),
97
+ tslib_1.__metadata("design:returntype", Promise)
98
+ ], TemplateFileMutation.prototype, "deleteTemplateFile", null);
99
+ tslib_1.__decorate([
100
+ (0, type_graphql_1.Directive)('@transaction'),
101
+ (0, type_graphql_1.Mutation)(returns => Boolean, { description: 'To delete multiple templateFiles' }),
102
+ tslib_1.__param(0, (0, type_graphql_1.Arg)('ids', type => [String])),
103
+ tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
104
+ tslib_1.__metadata("design:type", Function),
105
+ tslib_1.__metadata("design:paramtypes", [Array, Object]),
106
+ tslib_1.__metadata("design:returntype", Promise)
107
+ ], TemplateFileMutation.prototype, "deleteTemplateFiles", null);
108
+ TemplateFileMutation = tslib_1.__decorate([
109
+ (0, type_graphql_1.Resolver)(template_file_1.TemplateFile)
110
+ ], TemplateFileMutation);
111
+ exports.TemplateFileMutation = TemplateFileMutation;
112
+ //# sourceMappingURL=template-file-mutation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"template-file-mutation.js","sourceRoot":"","sources":["../../../server/service/template-file/template-file-mutation.ts"],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utation, Arg, Ctx, Directive } from 'type-graphql'\nimport { TemplateFile } from './template-file'\nimport { NewTemplateFile, TemplateFilePatch } from './template-file-type'\n\n@Resolver(TemplateFile)\nexport class TemplateFileMutation {\n @Directive('@transaction')\n @Mutation(returns => TemplateFile, { description: 'To create new TemplateFile' })\n async createTemplateFile(@Arg('templateFile') templateFile: NewTemplateFile, @Ctx() context: any): Promise<TemplateFile> {\n const { domain, user, tx } = context.state\n\n return await tx.getRepository(TemplateFile).save({\n ...templateFile,\n domain,\n creator: user,\n updater: user\n })\n }\n\n @Directive('@transaction')\n @Mutation(returns => TemplateFile, { description: 'To modify TemplateFile information' })\n async updateTemplateFile(\n @Arg('id') id: string,\n @Arg('patch') patch: TemplateFilePatch,\n @Ctx() context: any\n ): Promise<TemplateFile> {\n const { domain, user, tx } = context.state\n\n const repository = tx.getRepository(TemplateFile)\n const templateFile = await repository.findOne(\n {\n where: { domain: { id: domain.id }, id },\n relations: ['domain','updater','creator','attachment']\n }\n )\n\n return await repository.save({\n ...templateFile,\n ...patch,\n updater: user\n })\n }\n\n @Directive('@transaction')\n @Mutation(returns => [TemplateFile], { description: \"To modify multiple TemplateFiles' information\" })\n async updateMultipleTemplateFile(\n @Arg('patches', type => [TemplateFilePatch]) patches: TemplateFilePatch[],\n @Ctx() context: any\n ): Promise<TemplateFile[]> {\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 templateFileRepo = tx.getRepository(TemplateFile)\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 templateFileRepo.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 updRecord = _updateRecords[i]\n const templateFile = await templateFileRepo.findOne({\n where: { domain: { id: domain.id }, id:updRecord.id },\n relations: ['domain','updater','creator','attachment']\n })\n \n const result = await templateFileRepo.save({\n ...templateFile,\n ...updRecord,\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 TemplateFile' })\n async deleteTemplateFile(@Arg('id') id: string, @Ctx() context: any): Promise<boolean> {\n const { domain, tx, user } = context.state\n await tx.getRepository(TemplateFile).remove({ domain, id, updater:user })\n return true\n }\n\n @Directive('@transaction')\n @Mutation(returns => Boolean, { description: 'To delete multiple templateFiles' })\n async deleteTemplateFiles(\n @Arg('ids', type => [String]) ids: string[],\n @Ctx() context: any\n ): Promise<boolean> {\n const { domain, tx, user } = context.state\n\n let delEntitis = ids.map(id => {\n return {domain,id,updater:user}\n })\n\n await tx.getRepository(TemplateFile).remove(delEntitis)\n return true\n }\n}\n"]}
@@ -0,0 +1,91 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TemplateFileQuery = 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 template_file_1 = require("./template-file");
8
+ const template_file_type_1 = require("./template-file-type");
9
+ const auth_base_1 = require("@things-factory/auth-base");
10
+ const shell_2 = require("@things-factory/shell");
11
+ const attachment_base_1 = require("@things-factory/attachment-base");
12
+ let TemplateFileQuery = class TemplateFileQuery {
13
+ async templateFile(id, context) {
14
+ const { domain } = context.state;
15
+ return await (0, shell_1.getRepository)(template_file_1.TemplateFile).findOne({
16
+ where: { domain: { id: domain.id }, id }
17
+ });
18
+ }
19
+ async templateFiles(params, context) {
20
+ const { domain } = context.state;
21
+ const queryBuilder = (0, shell_1.getQueryBuilderFromListParams)({
22
+ domain,
23
+ params,
24
+ repository: await (0, shell_1.getRepository)(template_file_1.TemplateFile),
25
+ searchables: ['name', 'description', 'note']
26
+ });
27
+ const [items, total] = await queryBuilder.getManyAndCount();
28
+ return { items, total };
29
+ }
30
+ async attachment(templateFile) {
31
+ return await (0, shell_1.getRepository)(attachment_base_1.Attachment).findOneBy({ id: templateFile.attachmentId });
32
+ }
33
+ async domain(templateFile) {
34
+ return await (0, shell_1.getRepository)(shell_2.Domain).findOneBy({ id: templateFile.domainId });
35
+ }
36
+ async creator(templateFile) {
37
+ return await (0, shell_1.getRepository)(auth_base_1.User).findOneBy({ id: templateFile.creatorId });
38
+ }
39
+ async updater(templateFile) {
40
+ return await (0, shell_1.getRepository)(auth_base_1.User).findOneBy({ id: templateFile.updaterId });
41
+ }
42
+ };
43
+ tslib_1.__decorate([
44
+ (0, type_graphql_1.Query)(returns => template_file_1.TemplateFile, { description: 'To fetch a TemplateFile' }),
45
+ tslib_1.__param(0, (0, type_graphql_1.Arg)('id')),
46
+ tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
47
+ tslib_1.__metadata("design:type", Function),
48
+ tslib_1.__metadata("design:paramtypes", [String, Object]),
49
+ tslib_1.__metadata("design:returntype", Promise)
50
+ ], TemplateFileQuery.prototype, "templateFile", null);
51
+ tslib_1.__decorate([
52
+ (0, type_graphql_1.Query)(returns => template_file_type_1.TemplateFileList, { description: 'To fetch multiple TemplateFiles' }),
53
+ tslib_1.__param(0, (0, type_graphql_1.Args)()),
54
+ tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
55
+ tslib_1.__metadata("design:type", Function),
56
+ tslib_1.__metadata("design:paramtypes", [shell_1.ListParam, Object]),
57
+ tslib_1.__metadata("design:returntype", Promise)
58
+ ], TemplateFileQuery.prototype, "templateFiles", null);
59
+ tslib_1.__decorate([
60
+ (0, type_graphql_1.FieldResolver)(type => attachment_base_1.Attachment),
61
+ tslib_1.__param(0, (0, type_graphql_1.Root)()),
62
+ tslib_1.__metadata("design:type", Function),
63
+ tslib_1.__metadata("design:paramtypes", [template_file_1.TemplateFile]),
64
+ tslib_1.__metadata("design:returntype", Promise)
65
+ ], TemplateFileQuery.prototype, "attachment", null);
66
+ tslib_1.__decorate([
67
+ (0, type_graphql_1.FieldResolver)(type => shell_2.Domain),
68
+ tslib_1.__param(0, (0, type_graphql_1.Root)()),
69
+ tslib_1.__metadata("design:type", Function),
70
+ tslib_1.__metadata("design:paramtypes", [template_file_1.TemplateFile]),
71
+ tslib_1.__metadata("design:returntype", Promise)
72
+ ], TemplateFileQuery.prototype, "domain", null);
73
+ tslib_1.__decorate([
74
+ (0, type_graphql_1.FieldResolver)(type => auth_base_1.User),
75
+ tslib_1.__param(0, (0, type_graphql_1.Root)()),
76
+ tslib_1.__metadata("design:type", Function),
77
+ tslib_1.__metadata("design:paramtypes", [template_file_1.TemplateFile]),
78
+ tslib_1.__metadata("design:returntype", Promise)
79
+ ], TemplateFileQuery.prototype, "creator", null);
80
+ tslib_1.__decorate([
81
+ (0, type_graphql_1.FieldResolver)(type => auth_base_1.User),
82
+ tslib_1.__param(0, (0, type_graphql_1.Root)()),
83
+ tslib_1.__metadata("design:type", Function),
84
+ tslib_1.__metadata("design:paramtypes", [template_file_1.TemplateFile]),
85
+ tslib_1.__metadata("design:returntype", Promise)
86
+ ], TemplateFileQuery.prototype, "updater", null);
87
+ TemplateFileQuery = tslib_1.__decorate([
88
+ (0, type_graphql_1.Resolver)(template_file_1.TemplateFile)
89
+ ], TemplateFileQuery);
90
+ exports.TemplateFileQuery = TemplateFileQuery;
91
+ //# sourceMappingURL=template-file-query.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"template-file-query.js","sourceRoot":"","sources":["../../../server/service/template-file/template-file-query.ts"],"names":[],"mappings":";;;;AACA,+CAA8F;AAC9F,iDAA+F;AAC/F,mDAA8C;AAC9C,6DAAuD;AAEvD,yDAAgD;AAChD,iDAA8C;AAC9C,qEAA4D;AAGrD,IAAM,iBAAiB,GAAvB,MAAM,iBAAiB;IAEtB,AAAN,KAAK,CAAC,YAAY,CAAY,EAAU,EAAS,OAAY;QAC3D,MA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3CY,8CAAiB","sourcesContent":["\nimport { Resolver, Query, FieldResolver, Root, Args, Arg, Ctx, Directive } from 'type-graphql'\nimport { ListParam, getRepository, getQueryBuilderFromListParams } from '@things-factory/shell'\nimport { TemplateFile } from './template-file'\nimport { TemplateFileList } from './template-file-type'\n\nimport { User } from '@things-factory/auth-base'\nimport { Domain } from '@things-factory/shell'\nimport { Attachment } from '@things-factory/attachment-base'\n\n@Resolver(TemplateFile)\nexport class TemplateFileQuery {\n @Query(returns => TemplateFile, { description: 'To fetch a TemplateFile' })\n async templateFile(@Arg('id') id: string, @Ctx() context: any): Promise<TemplateFile> {\n const { domain } = context.state\n return await getRepository(TemplateFile).findOne({\n where: { domain: { id: domain.id }, id }\n })\n }\n\n @Query(returns => TemplateFileList, { description: 'To fetch multiple TemplateFiles' })\n async templateFiles(@Args() params: ListParam, @Ctx() context: any): Promise<TemplateFileList> {\n const { domain } = context.state\n\n const queryBuilder = getQueryBuilderFromListParams({\n domain,\n params,\n repository: await getRepository(TemplateFile),\n searchables: ['name', 'description', 'note']\n })\n\n const [items, total] = await queryBuilder.getManyAndCount()\n return { items, total }\n }\n\n @FieldResolver(type => Attachment)\n async attachment(@Root() templateFile: TemplateFile): Promise<Attachment> {\n return await getRepository(Attachment).findOneBy({id:templateFile.attachmentId})\n } \n\n @FieldResolver(type => Domain)\n async domain(@Root() templateFile: TemplateFile): Promise<Domain> {\n return await getRepository(Domain).findOneBy({id:templateFile.domainId})\n }\n\n @FieldResolver(type => User)\n async creator(@Root() templateFile: TemplateFile): Promise<User> {\n return await getRepository(User).findOneBy({id:templateFile.creatorId})\n }\n\n @FieldResolver(type => User)\n async updater(@Root() templateFile: TemplateFile): Promise<User> {\n return await getRepository(User).findOneBy({id:templateFile.updaterId})\n }\n}\n"]}
@@ -0,0 +1,106 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TemplateFileList = exports.TemplateFilePatch = exports.NewTemplateFile = 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 template_file_1 = require("./template-file");
8
+ let NewTemplateFile = class NewTemplateFile {
9
+ };
10
+ tslib_1.__decorate([
11
+ (0, type_graphql_1.Field)({ nullable: false }),
12
+ tslib_1.__metadata("design:type", String)
13
+ ], NewTemplateFile.prototype, "name", void 0);
14
+ tslib_1.__decorate([
15
+ (0, type_graphql_1.Field)({ nullable: false }),
16
+ tslib_1.__metadata("design:type", String)
17
+ ], NewTemplateFile.prototype, "description", void 0);
18
+ tslib_1.__decorate([
19
+ (0, type_graphql_1.Field)({ nullable: true }),
20
+ tslib_1.__metadata("design:type", String)
21
+ ], NewTemplateFile.prototype, "jobType", void 0);
22
+ tslib_1.__decorate([
23
+ (0, type_graphql_1.Field)({ nullable: true }),
24
+ tslib_1.__metadata("design:type", String)
25
+ ], NewTemplateFile.prototype, "jobClass", void 0);
26
+ tslib_1.__decorate([
27
+ (0, type_graphql_1.Field)({ nullable: true }),
28
+ tslib_1.__metadata("design:type", String)
29
+ ], NewTemplateFile.prototype, "jobCategory", void 0);
30
+ tslib_1.__decorate([
31
+ (0, type_graphql_1.Field)({ nullable: true }),
32
+ tslib_1.__metadata("design:type", Boolean)
33
+ ], NewTemplateFile.prototype, "activeFlag", void 0);
34
+ tslib_1.__decorate([
35
+ (0, type_graphql_1.Field)({ nullable: true }),
36
+ tslib_1.__metadata("design:type", String)
37
+ ], NewTemplateFile.prototype, "note", void 0);
38
+ tslib_1.__decorate([
39
+ (0, type_graphql_1.Field)(type => shell_1.ObjectRef, { nullable: true }),
40
+ tslib_1.__metadata("design:type", shell_1.ObjectRef)
41
+ ], NewTemplateFile.prototype, "attachment", void 0);
42
+ NewTemplateFile = tslib_1.__decorate([
43
+ (0, type_graphql_1.InputType)()
44
+ ], NewTemplateFile);
45
+ exports.NewTemplateFile = NewTemplateFile;
46
+ let TemplateFilePatch = class TemplateFilePatch {
47
+ };
48
+ tslib_1.__decorate([
49
+ (0, type_graphql_1.Field)(type => type_graphql_1.ID, { nullable: true }),
50
+ tslib_1.__metadata("design:type", String)
51
+ ], TemplateFilePatch.prototype, "id", void 0);
52
+ tslib_1.__decorate([
53
+ (0, type_graphql_1.Field)({ nullable: true }),
54
+ tslib_1.__metadata("design:type", String)
55
+ ], TemplateFilePatch.prototype, "name", void 0);
56
+ tslib_1.__decorate([
57
+ (0, type_graphql_1.Field)({ nullable: true }),
58
+ tslib_1.__metadata("design:type", String)
59
+ ], TemplateFilePatch.prototype, "description", void 0);
60
+ tslib_1.__decorate([
61
+ (0, type_graphql_1.Field)({ nullable: true }),
62
+ tslib_1.__metadata("design:type", String)
63
+ ], TemplateFilePatch.prototype, "jobType", void 0);
64
+ tslib_1.__decorate([
65
+ (0, type_graphql_1.Field)({ nullable: true }),
66
+ tslib_1.__metadata("design:type", String)
67
+ ], TemplateFilePatch.prototype, "jobClass", void 0);
68
+ tslib_1.__decorate([
69
+ (0, type_graphql_1.Field)({ nullable: true }),
70
+ tslib_1.__metadata("design:type", String)
71
+ ], TemplateFilePatch.prototype, "jobCategory", void 0);
72
+ tslib_1.__decorate([
73
+ (0, type_graphql_1.Field)({ nullable: true }),
74
+ tslib_1.__metadata("design:type", Boolean)
75
+ ], TemplateFilePatch.prototype, "activeFlag", void 0);
76
+ tslib_1.__decorate([
77
+ (0, type_graphql_1.Field)({ nullable: true }),
78
+ tslib_1.__metadata("design:type", String)
79
+ ], TemplateFilePatch.prototype, "note", void 0);
80
+ tslib_1.__decorate([
81
+ (0, type_graphql_1.Field)(type => shell_1.ObjectRef, { nullable: true }),
82
+ tslib_1.__metadata("design:type", shell_1.ObjectRef)
83
+ ], TemplateFilePatch.prototype, "attachment", void 0);
84
+ tslib_1.__decorate([
85
+ (0, type_graphql_1.Field)(),
86
+ tslib_1.__metadata("design:type", String)
87
+ ], TemplateFilePatch.prototype, "cuFlag", void 0);
88
+ TemplateFilePatch = tslib_1.__decorate([
89
+ (0, type_graphql_1.InputType)()
90
+ ], TemplateFilePatch);
91
+ exports.TemplateFilePatch = TemplateFilePatch;
92
+ let TemplateFileList = class TemplateFileList {
93
+ };
94
+ tslib_1.__decorate([
95
+ (0, type_graphql_1.Field)(type => [template_file_1.TemplateFile]),
96
+ tslib_1.__metadata("design:type", Array)
97
+ ], TemplateFileList.prototype, "items", void 0);
98
+ tslib_1.__decorate([
99
+ (0, type_graphql_1.Field)(type => type_graphql_1.Int),
100
+ tslib_1.__metadata("design:type", Number)
101
+ ], TemplateFileList.prototype, "total", void 0);
102
+ TemplateFileList = tslib_1.__decorate([
103
+ (0, type_graphql_1.ObjectType)()
104
+ ], TemplateFileList);
105
+ exports.TemplateFileList = TemplateFileList;
106
+ //# sourceMappingURL=template-file-type.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"template-file-type.js","sourceRoot":"","sources":["../../../server/service/template-file/template-file-type.ts"],"names":[],"mappings":";;;;AACA,+CAAoE;AACpE,iDAAiD;AACjD,mDAA8C;AAGvC,IAAM,eAAe,GAArB,MAAM,eAAe;CAwB3B,CAAA;AAvBC;IAAC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;;6CACf;AAEZ;IAAC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;;oDACR;AAEnB;IAAC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;gDACV;AAEhB;IAAC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;iDACT;AAEjB;IAAC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;oDACN;AAEpB;IAAC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;mDACN;AAEpB;IAAC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;6CACb;AAEb;IAAC,IAAA,oBAAK,EAAC,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E,CAAC,CAAC,4BAAY,CAAC,CAAC;;+CACT;AAErB;IAAC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,kBAAG,CAAC;;+CACN;AALF,gBAAgB;IAD5B,IAAA,yBAAU,GAAE;GACA,gBAAgB,CAM5B;AANY,4CAAgB","sourcesContent":["\nimport { ObjectType, Field, InputType, Int, ID } from 'type-graphql'\nimport { ObjectRef } from '@things-factory/shell'\nimport { TemplateFile } from './template-file'\n\n@InputType()\nexport class NewTemplateFile {\n @Field({ nullable: false })\n name: string\n\n @Field({ nullable: false })\n description: string\n\n @Field({ nullable: true })\n jobType?: string\n\n @Field({ nullable: true })\n jobClass?: string\n\n @Field({ nullable: true })\n jobCategory?: string\n\n @Field({ nullable: true })\n activeFlag?: boolean\n\n @Field({ nullable: true })\n note?: string\n\n @Field(type => ObjectRef, { nullable: true })\n attachment?: ObjectRef\n}\n\n@InputType()\nexport class TemplateFilePatch {\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({ nullable: true })\n jobType?: string\n\n @Field({ nullable: true })\n jobClass?: string\n\n @Field({ nullable: true })\n jobCategory?: string\n\n @Field({ nullable: true })\n activeFlag?: boolean\n\n @Field({ nullable: true })\n note?: string\n\n @Field(type => ObjectRef, { nullable: true })\n attachment?: ObjectRef\n\n @Field()\n cuFlag: string\n}\n\n@ObjectType()\nexport class TemplateFileList {\n @Field(type => [TemplateFile])\n items: TemplateFile[]\n\n @Field(type => Int)\n total: number\n}\n"]}
@@ -0,0 +1,109 @@
1
+ "use strict";
2
+ var _a;
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.TemplateFile = void 0;
5
+ const tslib_1 = require("tslib");
6
+ const typeorm_1 = require("typeorm");
7
+ const type_graphql_1 = require("type-graphql");
8
+ const auth_base_1 = require("@things-factory/auth-base");
9
+ const shell_1 = require("@things-factory/shell");
10
+ const attachment_base_1 = require("@things-factory/attachment-base");
11
+ let TemplateFile = class TemplateFile {
12
+ };
13
+ tslib_1.__decorate([
14
+ (0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
15
+ (0, type_graphql_1.Field)(type => type_graphql_1.ID),
16
+ tslib_1.__metadata("design:type", String)
17
+ ], TemplateFile.prototype, "id", void 0);
18
+ tslib_1.__decorate([
19
+ (0, typeorm_1.Column)({ name: 'name', nullable: false }),
20
+ (0, type_graphql_1.Field)({ nullable: false }),
21
+ tslib_1.__metadata("design:type", String)
22
+ ], TemplateFile.prototype, "name", void 0);
23
+ tslib_1.__decorate([
24
+ (0, typeorm_1.Column)({ name: 'description', nullable: false }),
25
+ (0, type_graphql_1.Field)({ nullable: false }),
26
+ tslib_1.__metadata("design:type", String)
27
+ ], TemplateFile.prototype, "description", void 0);
28
+ tslib_1.__decorate([
29
+ (0, typeorm_1.Column)({ name: 'job_type', nullable: true }),
30
+ (0, type_graphql_1.Field)({ nullable: true }),
31
+ tslib_1.__metadata("design:type", String)
32
+ ], TemplateFile.prototype, "jobType", void 0);
33
+ tslib_1.__decorate([
34
+ (0, typeorm_1.Column)({ name: 'job_class', nullable: true }),
35
+ (0, type_graphql_1.Field)({ nullable: true }),
36
+ tslib_1.__metadata("design:type", String)
37
+ ], TemplateFile.prototype, "jobClass", void 0);
38
+ tslib_1.__decorate([
39
+ (0, typeorm_1.Column)({ name: 'job_category', nullable: true }),
40
+ (0, type_graphql_1.Field)({ nullable: true }),
41
+ tslib_1.__metadata("design:type", String)
42
+ ], TemplateFile.prototype, "jobCategory", void 0);
43
+ tslib_1.__decorate([
44
+ (0, typeorm_1.Column)({ name: 'active_flag', type: 'boolean', nullable: true }),
45
+ (0, type_graphql_1.Field)({ nullable: true }),
46
+ tslib_1.__metadata("design:type", Boolean)
47
+ ], TemplateFile.prototype, "activeFlag", void 0);
48
+ tslib_1.__decorate([
49
+ (0, typeorm_1.Column)({ name: 'note', nullable: true }),
50
+ (0, type_graphql_1.Field)({ nullable: true }),
51
+ tslib_1.__metadata("design:type", String)
52
+ ], TemplateFile.prototype, "note", void 0);
53
+ tslib_1.__decorate([
54
+ (0, typeorm_1.ManyToOne)(type => attachment_base_1.Attachment, { createForeignKeyConstraints: false, nullable: true }),
55
+ (0, type_graphql_1.Field)({ nullable: true }),
56
+ tslib_1.__metadata("design:type", typeof (_a = typeof attachment_base_1.Attachment !== "undefined" && attachment_base_1.Attachment) === "function" ? _a : Object)
57
+ ], TemplateFile.prototype, "attachment", void 0);
58
+ tslib_1.__decorate([
59
+ (0, typeorm_1.RelationId)((templateFile) => templateFile.attachment),
60
+ tslib_1.__metadata("design:type", String)
61
+ ], TemplateFile.prototype, "attachmentId", void 0);
62
+ tslib_1.__decorate([
63
+ (0, typeorm_1.ManyToOne)(type => shell_1.Domain, { createForeignKeyConstraints: false, nullable: false }),
64
+ (0, type_graphql_1.Field)({ nullable: false }),
65
+ tslib_1.__metadata("design:type", shell_1.Domain)
66
+ ], TemplateFile.prototype, "domain", void 0);
67
+ tslib_1.__decorate([
68
+ (0, typeorm_1.RelationId)((templateFile) => templateFile.domain),
69
+ tslib_1.__metadata("design:type", String)
70
+ ], TemplateFile.prototype, "domainId", void 0);
71
+ tslib_1.__decorate([
72
+ (0, typeorm_1.ManyToOne)(type => auth_base_1.User, { createForeignKeyConstraints: false, nullable: true }),
73
+ (0, type_graphql_1.Field)({ nullable: true }),
74
+ tslib_1.__metadata("design:type", auth_base_1.User)
75
+ ], TemplateFile.prototype, "creator", void 0);
76
+ tslib_1.__decorate([
77
+ (0, typeorm_1.RelationId)((templateFile) => templateFile.creator),
78
+ tslib_1.__metadata("design:type", String)
79
+ ], TemplateFile.prototype, "creatorId", void 0);
80
+ tslib_1.__decorate([
81
+ (0, typeorm_1.ManyToOne)(type => auth_base_1.User, { createForeignKeyConstraints: false, nullable: true }),
82
+ (0, type_graphql_1.Field)({ nullable: true }),
83
+ tslib_1.__metadata("design:type", auth_base_1.User)
84
+ ], TemplateFile.prototype, "updater", void 0);
85
+ tslib_1.__decorate([
86
+ (0, typeorm_1.RelationId)((templateFile) => templateFile.updater),
87
+ tslib_1.__metadata("design:type", String)
88
+ ], TemplateFile.prototype, "updaterId", void 0);
89
+ tslib_1.__decorate([
90
+ (0, typeorm_1.CreateDateColumn)(),
91
+ (0, type_graphql_1.Field)({ nullable: true }),
92
+ tslib_1.__metadata("design:type", Date)
93
+ ], TemplateFile.prototype, "createdAt", void 0);
94
+ tslib_1.__decorate([
95
+ (0, typeorm_1.UpdateDateColumn)(),
96
+ (0, type_graphql_1.Field)({ nullable: true }),
97
+ tslib_1.__metadata("design:type", Date)
98
+ ], TemplateFile.prototype, "updatedAt", void 0);
99
+ TemplateFile = tslib_1.__decorate([
100
+ (0, typeorm_1.Entity)('template_files'),
101
+ (0, typeorm_1.Index)('ix_template_file_0', (templateFile) => [templateFile.domain, templateFile.name], { unique: true }),
102
+ (0, typeorm_1.Index)('ix_template_file_1', (templateFile) => [templateFile.domain, templateFile.jobType]),
103
+ (0, typeorm_1.Index)('ix_template_file_2', (templateFile) => [templateFile.domain, templateFile.jobClass]),
104
+ (0, typeorm_1.Index)('ix_template_file_3', (templateFile) => [templateFile.domain, templateFile.jobCategory]),
105
+ (0, typeorm_1.Index)('ix_template_file_4', (templateFile) => [templateFile.domain, templateFile.attachment]),
106
+ (0, type_graphql_1.ObjectType)({ description: 'Entity for TemplateFile' })
107
+ ], TemplateFile);
108
+ exports.TemplateFile = TemplateFile;
109
+ //# sourceMappingURL=template-file.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"template-file.js","sourceRoot":"","sources":["../../../server/service/template-file/template-file.ts"],"names":[],"mappings":";;;;;AACA,qCAUgB;AAChB,+CAAoD;AAEpD,yDAAgD;AAChD,iDAA8C;AAC9C,qEAA4D;AASrD,IAAM,YAAY,GAAlB,MAAM,YAAY;CAoExB,CAAA;AAnEC;IAAC,IAAA,gCAAsB,EAAC,MAAM,CAAC;IAC9B,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAA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;AAElB;IAAC,IAAA,0BAAgB,GAAE;IAClB,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;sCACd,IAAI;+CAAA;AAEhB;IAAC,IAAA,0BAAgB,GAAE;IAClB,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;sCACd,IAAI;+CAAA;AAnEL,YAAY;IAPxB,IAAA,gBAAM,EAAC,gBAAgB,CAAC;IACxB,IAAA,eAAK,EAAC,oBAAoB,EAAE,CAAC,YAA0B,EAAE,EAAE,CAAC,CAAC,YAAY,CAAC,MAAM,EAAC,YAAY,CAAC,IAAI,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;IACtH,IAAA,eAAK,EAAC,oBAAoB,EAAE,CAAC,YAA0B,EAAE,EAAE,CAAC,CAAC,YAAY,CAAC,MAAM,EAAC,YAAY,CAAC,OAAO,CAAC,CAAC;IACvG,IAAA,eAAK,EAAC,oBAAoB,EAAE,CAAC,YAA0B,EAAE,EAAE,CAAC,CAAC,YAAY,CAAC,MAAM,EAAC,YAAY,CAAC,QAAQ,CAAC,CAAC;IACxG,IAAA,eAAK,EAAC,oBAAoB,EAAE,CAAC,YAA0B,EAAE,EAAE,CAAC,CAAC,YAAY,CAAC,MAAM,EAAC,YAAY,CAAC,WAAW,CAAC,CAAC;IAC3G,IAAA,eAAK,EAAC,oBAAoB,EAAE,CAAC,YAA0B,EAAE,EAAE,CAAC,CAAC,YAAY,CAAC,MAAM,EAAC,YAAY,CAAC,UAAU,CAAC,CAAC;IAC1G,IAAA,yBAAU,EAAC,EAAE,WAAW,EAAE,yBAAyB,EAAE,CAAC;GAC1C,YAAY,CAoExB;AApEY,oCAAY","sourcesContent":["\nimport {\n CreateDateColumn,\n UpdateDateColumn,\n Entity,\n Index,\n Column,\n RelationId,\n ManyToOne,\n OneToOne,\n PrimaryGeneratedColumn,\n} from 'typeorm'\nimport { ObjectType, Field, ID } from 'type-graphql'\n\nimport { User } from '@things-factory/auth-base'\nimport { Domain } from '@things-factory/shell'\nimport { Attachment } from '@things-factory/attachment-base'\n\n@Entity('template_files')\n@Index('ix_template_file_0', (templateFile: TemplateFile) => [templateFile.domain,templateFile.name], { unique: true })\n@Index('ix_template_file_1', (templateFile: TemplateFile) => [templateFile.domain,templateFile.jobType])\n@Index('ix_template_file_2', (templateFile: TemplateFile) => [templateFile.domain,templateFile.jobClass])\n@Index('ix_template_file_3', (templateFile: TemplateFile) => [templateFile.domain,templateFile.jobCategory])\n@Index('ix_template_file_4', (templateFile: TemplateFile) => [templateFile.domain,templateFile.attachment])\n@ObjectType({ description: 'Entity for TemplateFile' })\nexport class TemplateFile {\n @PrimaryGeneratedColumn('uuid')\n @Field(type => ID)\n readonly id: string\n\n @Column({ name:'name', nullable:false })\n @Field({ nullable:false })\n name: string\n\n @Column({ name:'description', nullable:false })\n @Field({ nullable:false })\n description: string\n\n @Column({ name:'job_type', nullable:true })\n @Field({ nullable:true })\n jobType?: string\n\n @Column({ name:'job_class', nullable:true })\n @Field({ nullable:true })\n jobClass?: string\n\n @Column({ name:'job_category', nullable:true })\n @Field({ nullable:true })\n jobCategory?: string\n\n @Column({ name:'active_flag', type:'boolean', nullable:true })\n @Field( { nullable:true })\n activeFlag?: boolean\n\n @Column({ name:'note', nullable:true })\n @Field({ nullable:true })\n note?: string\n\n @ManyToOne(type => Attachment, {createForeignKeyConstraints: false, nullable: true})\n @Field({ nullable: true})\n attachment: Attachment\n\n @RelationId((templateFile: TemplateFile) => templateFile.attachment)\n attachmentId?: string\n\n @ManyToOne(type => Domain, {createForeignKeyConstraints: false, nullable: false})\n @Field({ nullable: false })\n domain: Domain\n\n @RelationId((templateFile: TemplateFile) => templateFile.domain)\n domainId: string\n\n @ManyToOne(type => User, {createForeignKeyConstraints: false, nullable: true})\n @Field({ nullable: true })\n creator?: User\n\n @RelationId((templateFile: TemplateFile) => templateFile.creator)\n creatorId?: string\n\n @ManyToOne(type => User, {createForeignKeyConstraints: false, nullable: true})\n @Field({ nullable: true })\n updater?: User\n\n @RelationId((templateFile: TemplateFile) => templateFile.updater)\n updaterId?: string\n\n @CreateDateColumn()\n @Field({ nullable: true })\n createdAt?: Date\n\n @UpdateDateColumn()\n @Field({ nullable: true })\n updatedAt?: Date\n}\n"]}