@things-factory/pdf 7.0.33 → 7.0.37

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.
Files changed (107) hide show
  1. package/client/bootstrap.js +6 -0
  2. package/client/pages/pdf-release/pdf-release-importer.ts +90 -0
  3. package/client/pages/pdf-release/pdf-release-list-page.ts +398 -0
  4. package/client/pages/pdf-template/pdf-template-importer.ts +86 -0
  5. package/client/pages/pdf-template/pdf-template-list-page.ts +491 -0
  6. package/client/route.ts +11 -0
  7. package/client/tsconfig.json +13 -0
  8. package/dist-client/bootstrap.d.ts +1 -0
  9. package/dist-client/bootstrap.js +6 -0
  10. package/dist-client/bootstrap.js.map +1 -0
  11. package/dist-client/pages/pdf-release/pdf-release-importer.d.ts +23 -0
  12. package/dist-client/pages/pdf-release/pdf-release-importer.js +93 -0
  13. package/dist-client/pages/pdf-release/pdf-release-importer.js.map +1 -0
  14. package/dist-client/pages/pdf-release/pdf-release-list-page.d.ts +66 -0
  15. package/dist-client/pages/pdf-release/pdf-release-list-page.js +370 -0
  16. package/dist-client/pages/pdf-release/pdf-release-list-page.js.map +1 -0
  17. package/dist-client/pages/pdf-template/pdf-template-importer.d.ts +23 -0
  18. package/dist-client/pages/pdf-template/pdf-template-importer.js +93 -0
  19. package/dist-client/pages/pdf-template/pdf-template-importer.js.map +1 -0
  20. package/dist-client/pages/pdf-template/pdf-template-list-page.d.ts +66 -0
  21. package/dist-client/pages/pdf-template/pdf-template-list-page.js +464 -0
  22. package/dist-client/pages/pdf-template/pdf-template-list-page.js.map +1 -0
  23. package/dist-client/route.d.ts +1 -0
  24. package/dist-client/route.js +11 -0
  25. package/dist-client/route.js.map +1 -0
  26. package/dist-client/tsconfig.tsbuildinfo +1 -0
  27. package/dist-server/controller/pdf-service.d.ts +4 -0
  28. package/dist-server/controller/pdf-service.js +34 -0
  29. package/dist-server/controller/pdf-service.js.map +1 -0
  30. package/dist-server/index.d.ts +1 -0
  31. package/dist-server/index.js +2 -0
  32. package/dist-server/index.js.map +1 -1
  33. package/dist-server/routers/pdf-private-router.d.ts +1 -0
  34. package/dist-server/routers/pdf-private-router.js +72 -0
  35. package/dist-server/routers/pdf-private-router.js.map +1 -0
  36. package/dist-server/routers/pdf-public-router.d.ts +1 -0
  37. package/dist-server/routers/{pdf-router.js → pdf-public-router.js} +6 -6
  38. package/dist-server/routers/pdf-public-router.js.map +1 -0
  39. package/dist-server/routes.js +13 -2
  40. package/dist-server/routes.js.map +1 -1
  41. package/dist-server/service/index.d.ts +7 -0
  42. package/dist-server/service/index.js +31 -0
  43. package/dist-server/service/index.js.map +1 -0
  44. package/dist-server/service/pdf-generate/pdf-generate-resolver.d.ts +6 -0
  45. package/dist-server/service/pdf-generate/pdf-generate-resolver.js +88 -0
  46. package/dist-server/service/pdf-generate/pdf-generate-resolver.js.map +1 -0
  47. package/dist-server/service/pdf-release/index.d.ts +6 -0
  48. package/dist-server/service/pdf-release/index.js +10 -0
  49. package/dist-server/service/pdf-release/index.js.map +1 -0
  50. package/dist-server/service/pdf-release/pdf-release-mutation.d.ts +10 -0
  51. package/dist-server/service/pdf-release/pdf-release-mutation.js +127 -0
  52. package/dist-server/service/pdf-release/pdf-release-mutation.js.map +1 -0
  53. package/dist-server/service/pdf-release/pdf-release-query.d.ts +11 -0
  54. package/dist-server/service/pdf-release/pdf-release-query.js +79 -0
  55. package/dist-server/service/pdf-release/pdf-release-query.js.map +1 -0
  56. package/dist-server/service/pdf-release/pdf-release-type.d.ts +20 -0
  57. package/dist-server/service/pdf-release/pdf-release-type.js +77 -0
  58. package/dist-server/service/pdf-release/pdf-release-type.js.map +1 -0
  59. package/dist-server/service/pdf-release/pdf-release.d.ts +27 -0
  60. package/dist-server/service/pdf-release/pdf-release.js +117 -0
  61. package/dist-server/service/pdf-release/pdf-release.js.map +1 -0
  62. package/dist-server/service/pdf-template/index.d.ts +6 -0
  63. package/dist-server/service/pdf-template/index.js +10 -0
  64. package/dist-server/service/pdf-template/index.js.map +1 -0
  65. package/dist-server/service/pdf-template/pdf-template-mutation.d.ts +10 -0
  66. package/dist-server/service/pdf-template/pdf-template-mutation.js +127 -0
  67. package/dist-server/service/pdf-template/pdf-template-mutation.js.map +1 -0
  68. package/dist-server/service/pdf-template/pdf-template-query.d.ts +11 -0
  69. package/dist-server/service/pdf-template/pdf-template-query.js +79 -0
  70. package/dist-server/service/pdf-template/pdf-template-query.js.map +1 -0
  71. package/dist-server/service/pdf-template/pdf-template-type.d.ts +32 -0
  72. package/dist-server/service/pdf-template/pdf-template-type.js +125 -0
  73. package/dist-server/service/pdf-template/pdf-template-type.js.map +1 -0
  74. package/dist-server/service/pdf-template/pdf-template.d.ts +28 -0
  75. package/dist-server/service/pdf-template/pdf-template.js +125 -0
  76. package/dist-server/service/pdf-template/pdf-template.js.map +1 -0
  77. package/dist-server/tsconfig.tsbuildinfo +1 -1
  78. package/helps/pdf/pdf-release.md +160 -0
  79. package/helps/pdf/pdf-template.md +160 -0
  80. package/package.json +15 -8
  81. package/server/controller/pdf-service.ts +35 -0
  82. package/server/index.ts +2 -0
  83. package/server/routers/pdf-private-router.ts +85 -0
  84. package/server/routers/{pdf-router.ts → pdf-public-router.ts} +4 -4
  85. package/server/routes.ts +14 -2
  86. package/server/service/index.ts +38 -0
  87. package/server/service/pdf-generate/pdf-generate-resolver.ts +81 -0
  88. package/server/service/pdf-release/index.ts +7 -0
  89. package/server/service/pdf-release/pdf-release-mutation.ts +138 -0
  90. package/server/service/pdf-release/pdf-release-query.ts +51 -0
  91. package/server/service/pdf-release/pdf-release-type.ts +55 -0
  92. package/server/service/pdf-release/pdf-release.ts +103 -0
  93. package/server/service/pdf-template/index.ts +7 -0
  94. package/server/service/pdf-template/pdf-template-mutation.ts +138 -0
  95. package/server/service/pdf-template/pdf-template-query.ts +51 -0
  96. package/server/service/pdf-template/pdf-template-type.ts +87 -0
  97. package/server/service/pdf-template/pdf-template.ts +108 -0
  98. package/server/tsconfig.json +10 -0
  99. package/things-factory.config.js +8 -1
  100. package/translations/en.json +11 -0
  101. package/translations/ja.json +9 -0
  102. package/translations/ko.json +11 -0
  103. package/translations/ms.json +9 -0
  104. package/translations/zh.json +9 -0
  105. package/dist-server/routers/pdf-router.d.ts +0 -1
  106. package/dist-server/routers/pdf-router.js.map +0 -1
  107. package/tsconfig.json +0 -9
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pdf-release.js","sourceRoot":"","sources":["../../../server/service/pdf-release/pdf-release.ts"],"names":[],"mappings":";;;;AAAA,qCAUgB;AAChB,+CAA2E;AAE3E,iDAA8C;AAC9C,yDAAgD;AAChD,+DAA0D;AAE1D,IAAY,gBAGX;AAHD,WAAY,gBAAgB;IAC1B,2CAAuB,CAAA;IACvB,qCAAiB,CAAA;AACnB,CAAC,EAHW,gBAAgB,gCAAhB,gBAAgB,QAG3B;AAED,IAAA,+BAAgB,EAAC,gBAAgB,EAAE;IACjC,IAAI,EAAE,kBAAkB;IACxB,WAAW,EAAE,mCAAmC;CACjD,CAAC,CAAA;AAQK,IAAM,UAAU,GAAhB,MAAM,UAAU;CAqEtB,CAAA;AArEY,gCAAU;AAGZ;IAFR,IAAA,gCAAsB,EAAC,MAAM,CAAC;IAC9B,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,iBAAE,CAAC;;sCACC;AAInB;IAFC,IAAA,mBAAS,EAAC,IAAI,CAAC,EAAE,CAAC,cAAM,CAAC;IACzB,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;sCACjB,cAAM;0CAAA;AAGf;IADC,IAAA,oBAAU,EAAC,CAAC,UAAsB,EAAE,EAAE,CAAC,UAAU,CAAC,MAAM,CAAC;;4CACzC;AAIjB;IAFC,IAAA,gBAAM,GAAE;IACR,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;wCACb;AAIb;IAFC,IAAA,gBAAM,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IAC1B,IAA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,IAAI,CAAC,EAAE,CAAC,gBAAI,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IAC3C,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;sCAC9B,gBAAI;2CAAA;AAGd;IADC,IAAA,oBAAU,EAAC,CAAC,UAAsB,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,CAAC;;6CACzC;AAIlB;IAFC,IAAA,mBAAS,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IAC3C,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;sCAC9B,gBAAI;2CAAA;AAGd;IADC,IAAA,oBAAU,EAAC,CAAC,UAAsB,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,CAAC;;6CACzC;qBApEP,UAAU;IANtB,IAAA,gBAAM,GAAE;IACR,IAAA,eAAK,EAAC,kBAAkB,EAAE,CAAC,UAAsB,EAAE,EAAE,CAAC,CAAC,UAAU,CAAC,MAAM,EAAE,UAAU,CAAC,IAAI,CAAC,EAAE;QAC3F,KAAK,EAAE,sBAAsB;QAC7B,MAAM,EAAE,IAAI;KACb,CAAC;IACD,IAAA,yBAAU,EAAC,EAAE,WAAW,EAAE,uBAAuB,EAAE,CAAC;GACxC,UAAU,CAqEtB","sourcesContent":["import {\n CreateDateColumn,\n UpdateDateColumn,\n DeleteDateColumn,\n Entity,\n Index,\n Column,\n RelationId,\n ManyToOne,\n PrimaryGeneratedColumn\n} from 'typeorm'\nimport { ObjectType, Field, Int, ID, registerEnumType } from 'type-graphql'\n\nimport { Domain } from '@things-factory/shell'\nimport { User } from '@things-factory/auth-base'\nimport { PDFTemplate } from '../pdf-template/pdf-template'\n\nexport enum PDFReleaseStatus {\n published = 'published',\n failed = 'failed'\n}\n\nregisterEnumType(PDFReleaseStatus, {\n name: 'PDFReleaseStatus',\n description: 'state enumeration of a PDFRelease'\n})\n\n@Entity()\n@Index('ix_pdf_release_0', (pdfRelease: PDFRelease) => [pdfRelease.domain, pdfRelease.name], {\n where: '\"deleted_at\" IS NULL',\n unique: true\n})\n@ObjectType({ description: 'Entity for PDFRelease' })\nexport class PDFRelease {\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((pdfRelease: PDFRelease) => pdfRelease.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 active?: boolean\n\n @ManyToOne(type => PDFTemplate, { nullable: false })\n @Field(type => PDFTemplate)\n template?: PDFTemplate\n\n @RelationId((release: PDFRelease) => release.template)\n @Field()\n templateId?: string\n\n @Column()\n @Field({ nullable: true })\n filePath?: string\n\n @Column()\n @Field({ nullable: true })\n fileUrl?: string\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n state?: PDFReleaseStatus\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((pdfRelease: PDFRelease) => pdfRelease.creator)\n creatorId?: string\n\n @ManyToOne(type => User, { nullable: true })\n @Field(type => User, { nullable: true })\n updater?: User\n\n @RelationId((pdfRelease: PDFRelease) => pdfRelease.updater)\n updaterId?: string\n}\n"]}
@@ -0,0 +1,6 @@
1
+ import { PDFTemplate } from './pdf-template';
2
+ import { PDFTemplateQuery } from './pdf-template-query';
3
+ import { PDFTemplateMutation } from './pdf-template-mutation';
4
+ export declare const entities: (typeof PDFTemplate)[];
5
+ export declare const resolvers: (typeof PDFTemplateQuery | typeof PDFTemplateMutation)[];
6
+ export declare const subscribers: any[];
@@ -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 pdf_template_1 = require("./pdf-template");
5
+ const pdf_template_query_1 = require("./pdf-template-query");
6
+ const pdf_template_mutation_1 = require("./pdf-template-mutation");
7
+ exports.entities = [pdf_template_1.PDFTemplate];
8
+ exports.resolvers = [pdf_template_query_1.PDFTemplateQuery, pdf_template_mutation_1.PDFTemplateMutation];
9
+ exports.subscribers = [];
10
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../server/service/pdf-template/index.ts"],"names":[],"mappings":";;;AAAA,iDAA4C;AAC5C,6DAAuD;AACvD,mEAA6D;AAEhD,QAAA,QAAQ,GAAG,CAAC,0BAAW,CAAC,CAAA;AACxB,QAAA,SAAS,GAAG,CAAC,qCAAgB,EAAE,2CAAmB,CAAC,CAAA;AACnD,QAAA,WAAW,GAAG,EAAE,CAAA","sourcesContent":["import { PDFTemplate } from './pdf-template'\nimport { PDFTemplateQuery } from './pdf-template-query'\nimport { PDFTemplateMutation } from './pdf-template-mutation'\n\nexport const entities = [PDFTemplate]\nexport const resolvers = [PDFTemplateQuery, PDFTemplateMutation]\nexport const subscribers = []\n"]}
@@ -0,0 +1,10 @@
1
+ import { PDFTemplate } from './pdf-template';
2
+ import { NewPDFTemplate, PDFTemplatePatch } from './pdf-template-type';
3
+ export declare class PDFTemplateMutation {
4
+ createPDFTemplate(pdfTemplate: NewPDFTemplate, context: ResolverContext): Promise<PDFTemplate>;
5
+ updatePDFTemplate(id: string, patch: PDFTemplatePatch, context: ResolverContext): Promise<PDFTemplate>;
6
+ updateMultiplePDFTemplate(patches: PDFTemplatePatch[], context: ResolverContext): Promise<PDFTemplate[]>;
7
+ deletePDFTemplate(id: string, context: ResolverContext): Promise<boolean>;
8
+ deletePDFTemplates(ids: string[], context: ResolverContext): Promise<boolean>;
9
+ importPDFTemplates(pdfTemplates: PDFTemplatePatch[], context: ResolverContext): Promise<boolean>;
10
+ }
@@ -0,0 +1,127 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PDFTemplateMutation = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const type_graphql_1 = require("type-graphql");
6
+ const typeorm_1 = require("typeorm");
7
+ const pdf_template_1 = require("./pdf-template");
8
+ const pdf_template_type_1 = require("./pdf-template-type");
9
+ let PDFTemplateMutation = class PDFTemplateMutation {
10
+ async createPDFTemplate(pdfTemplate, context) {
11
+ const { domain, user, tx } = context.state;
12
+ const result = await tx.getRepository(pdf_template_1.PDFTemplate).save(Object.assign(Object.assign({}, pdfTemplate), { domain, creator: user, updater: user }));
13
+ return result;
14
+ }
15
+ async updatePDFTemplate(id, patch, context) {
16
+ const { domain, user, tx } = context.state;
17
+ const repository = tx.getRepository(pdf_template_1.PDFTemplate);
18
+ const pdfTemplate = await repository.findOne({
19
+ where: { domain: { id: domain.id }, id }
20
+ });
21
+ const result = await repository.save(Object.assign(Object.assign(Object.assign({}, pdfTemplate), patch), { updater: user }));
22
+ return result;
23
+ }
24
+ async updateMultiplePDFTemplate(patches, context) {
25
+ const { domain, user, tx } = context.state;
26
+ let results = [];
27
+ const _createRecords = patches.filter((patch) => patch.cuFlag.toUpperCase() === '+');
28
+ const _updateRecords = patches.filter((patch) => patch.cuFlag.toUpperCase() === 'M');
29
+ const pdfTemplateRepo = tx.getRepository(pdf_template_1.PDFTemplate);
30
+ if (_createRecords.length > 0) {
31
+ for (let i = 0; i < _createRecords.length; i++) {
32
+ const newRecord = _createRecords[i];
33
+ const result = await pdfTemplateRepo.save(Object.assign(Object.assign({}, newRecord), { domain, creator: user, updater: user }));
34
+ results.push(Object.assign(Object.assign({}, result), { cuFlag: '+' }));
35
+ }
36
+ }
37
+ if (_updateRecords.length > 0) {
38
+ for (let i = 0; i < _updateRecords.length; i++) {
39
+ const updateRecord = _updateRecords[i];
40
+ const pdfTemplate = await pdfTemplateRepo.findOneBy({ id: updateRecord.id });
41
+ const result = await pdfTemplateRepo.save(Object.assign(Object.assign(Object.assign({}, pdfTemplate), updateRecord), { updater: user }));
42
+ results.push(Object.assign(Object.assign({}, result), { cuFlag: 'M' }));
43
+ }
44
+ }
45
+ return results;
46
+ }
47
+ async deletePDFTemplate(id, context) {
48
+ const { domain, tx } = context.state;
49
+ await tx.getRepository(pdf_template_1.PDFTemplate).delete({ domain: { id: domain.id }, id });
50
+ return true;
51
+ }
52
+ async deletePDFTemplates(ids, context) {
53
+ const { domain, tx } = context.state;
54
+ await tx.getRepository(pdf_template_1.PDFTemplate).delete({
55
+ domain: { id: domain.id },
56
+ id: (0, typeorm_1.In)(ids)
57
+ });
58
+ return true;
59
+ }
60
+ async importPDFTemplates(pdfTemplates, context) {
61
+ const { domain, tx } = context.state;
62
+ await Promise.all(pdfTemplates.map(async (pdfTemplate) => {
63
+ const createdPDFTemplate = await tx.getRepository(pdf_template_1.PDFTemplate).save(Object.assign({ domain }, pdfTemplate));
64
+ }));
65
+ return true;
66
+ }
67
+ };
68
+ exports.PDFTemplateMutation = PDFTemplateMutation;
69
+ tslib_1.__decorate([
70
+ (0, type_graphql_1.Directive)('@transaction'),
71
+ (0, type_graphql_1.Mutation)(returns => pdf_template_1.PDFTemplate, { description: 'To create new PDFTemplate' }),
72
+ tslib_1.__param(0, (0, type_graphql_1.Arg)('pdfTemplate')),
73
+ tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
74
+ tslib_1.__metadata("design:type", Function),
75
+ tslib_1.__metadata("design:paramtypes", [pdf_template_type_1.NewPDFTemplate, Object]),
76
+ tslib_1.__metadata("design:returntype", Promise)
77
+ ], PDFTemplateMutation.prototype, "createPDFTemplate", null);
78
+ tslib_1.__decorate([
79
+ (0, type_graphql_1.Directive)('@transaction'),
80
+ (0, type_graphql_1.Mutation)(returns => pdf_template_1.PDFTemplate, { description: 'To modify PDFTemplate information' }),
81
+ tslib_1.__param(0, (0, type_graphql_1.Arg)('id')),
82
+ tslib_1.__param(1, (0, type_graphql_1.Arg)('patch')),
83
+ tslib_1.__param(2, (0, type_graphql_1.Ctx)()),
84
+ tslib_1.__metadata("design:type", Function),
85
+ tslib_1.__metadata("design:paramtypes", [String, pdf_template_type_1.PDFTemplatePatch, Object]),
86
+ tslib_1.__metadata("design:returntype", Promise)
87
+ ], PDFTemplateMutation.prototype, "updatePDFTemplate", null);
88
+ tslib_1.__decorate([
89
+ (0, type_graphql_1.Directive)('@transaction'),
90
+ (0, type_graphql_1.Mutation)(returns => [pdf_template_1.PDFTemplate], { description: "To modify multiple PDFTemplates' information" }),
91
+ tslib_1.__param(0, (0, type_graphql_1.Arg)('patches', type => [pdf_template_type_1.PDFTemplatePatch])),
92
+ tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
93
+ tslib_1.__metadata("design:type", Function),
94
+ tslib_1.__metadata("design:paramtypes", [Array, Object]),
95
+ tslib_1.__metadata("design:returntype", Promise)
96
+ ], PDFTemplateMutation.prototype, "updateMultiplePDFTemplate", null);
97
+ tslib_1.__decorate([
98
+ (0, type_graphql_1.Directive)('@transaction'),
99
+ (0, type_graphql_1.Mutation)(returns => Boolean, { description: 'To delete PDFTemplate' }),
100
+ tslib_1.__param(0, (0, type_graphql_1.Arg)('id')),
101
+ tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
102
+ tslib_1.__metadata("design:type", Function),
103
+ tslib_1.__metadata("design:paramtypes", [String, Object]),
104
+ tslib_1.__metadata("design:returntype", Promise)
105
+ ], PDFTemplateMutation.prototype, "deletePDFTemplate", null);
106
+ tslib_1.__decorate([
107
+ (0, type_graphql_1.Directive)('@transaction'),
108
+ (0, type_graphql_1.Mutation)(returns => Boolean, { description: 'To delete multiple PDFTemplates' }),
109
+ tslib_1.__param(0, (0, type_graphql_1.Arg)('ids', type => [String])),
110
+ tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
111
+ tslib_1.__metadata("design:type", Function),
112
+ tslib_1.__metadata("design:paramtypes", [Array, Object]),
113
+ tslib_1.__metadata("design:returntype", Promise)
114
+ ], PDFTemplateMutation.prototype, "deletePDFTemplates", null);
115
+ tslib_1.__decorate([
116
+ (0, type_graphql_1.Directive)('@transaction'),
117
+ (0, type_graphql_1.Mutation)(returns => Boolean, { description: 'To import multiple PDFTemplates' }),
118
+ tslib_1.__param(0, (0, type_graphql_1.Arg)('pdfTemplates', type => [pdf_template_type_1.PDFTemplatePatch])),
119
+ tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
120
+ tslib_1.__metadata("design:type", Function),
121
+ tslib_1.__metadata("design:paramtypes", [Array, Object]),
122
+ tslib_1.__metadata("design:returntype", Promise)
123
+ ], PDFTemplateMutation.prototype, "importPDFTemplates", null);
124
+ exports.PDFTemplateMutation = PDFTemplateMutation = tslib_1.__decorate([
125
+ (0, type_graphql_1.Resolver)(pdf_template_1.PDFTemplate)
126
+ ], PDFTemplateMutation);
127
+ //# sourceMappingURL=pdf-template-mutation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pdf-template-mutation.js","sourceRoot":"","sources":["../../../server/service/pdf-template/pdf-template-mutation.ts"],"names":[],"mappings":";;;;AAAA,+CAAsE;AACtE,qCAA4B;AAE5B,iDAA4C;AAC5C,2DAAsE;AAG/D,IAAM,mBAAmB,GAAzB,MAAM,mBAAmB;IAGxB,AAAN,KAAK,CAAC,iBAAiB,CACD,WAA2B,EACxC,OAAwB;QAE/B,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAE1C,MAAM,MAAM,GAAG,MAAM,EAAE,CAAC,aAAa,CAAC,0BAAW,CAAC,CAAC,IAAI,iCAClD,WAAW,KACd,MAAM,EACN,OAAO,EAAE,IAAI,EACb,OAAO,EAAE,IAAI,IAC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A,kBAAG,GAAE,CAAA;;;;6DAWP;8BAjIU,mBAAmB;IAD/B,IAAA,uBAAQ,EAAC,0BAAW,CAAC;GACT,mBAAmB,CAkI/B","sourcesContent":["import { Resolver, Mutation, Arg, Ctx, Directive } from 'type-graphql'\nimport { In } from 'typeorm'\n\nimport { PDFTemplate } from './pdf-template'\nimport { NewPDFTemplate, PDFTemplatePatch } from './pdf-template-type'\n\n@Resolver(PDFTemplate)\nexport class PDFTemplateMutation {\n @Directive('@transaction')\n @Mutation(returns => PDFTemplate, { description: 'To create new PDFTemplate' })\n async createPDFTemplate(\n @Arg('pdfTemplate') pdfTemplate: NewPDFTemplate,\n @Ctx() context: ResolverContext\n ): Promise<PDFTemplate> {\n const { domain, user, tx } = context.state\n\n const result = await tx.getRepository(PDFTemplate).save({\n ...pdfTemplate,\n domain,\n creator: user,\n updater: user\n })\n\n return result\n }\n\n @Directive('@transaction')\n @Mutation(returns => PDFTemplate, { description: 'To modify PDFTemplate information' })\n async updatePDFTemplate(\n @Arg('id') id: string,\n @Arg('patch') patch: PDFTemplatePatch,\n @Ctx() context: ResolverContext\n ): Promise<PDFTemplate> {\n const { domain, user, tx } = context.state\n\n const repository = tx.getRepository(PDFTemplate)\n const pdfTemplate = await repository.findOne({\n where: { domain: { id: domain.id }, id }\n })\n\n const result = await repository.save({\n ...pdfTemplate,\n ...patch,\n updater: user\n })\n\n return result\n }\n\n @Directive('@transaction')\n @Mutation(returns => [PDFTemplate], { description: \"To modify multiple PDFTemplates' information\" })\n async updateMultiplePDFTemplate(\n @Arg('patches', type => [PDFTemplatePatch]) patches: PDFTemplatePatch[],\n @Ctx() context: ResolverContext\n ): Promise<PDFTemplate[]> {\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 pdfTemplateRepo = tx.getRepository(PDFTemplate)\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 pdfTemplateRepo.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 pdfTemplate = await pdfTemplateRepo.findOneBy({ id: updateRecord.id })\n\n const result = await pdfTemplateRepo.save({\n ...pdfTemplate,\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 PDFTemplate' })\n async deletePDFTemplate(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<boolean> {\n const { domain, tx } = context.state\n\n await tx.getRepository(PDFTemplate).delete({ domain: { id: domain.id }, id })\n\n return true\n }\n\n @Directive('@transaction')\n @Mutation(returns => Boolean, { description: 'To delete multiple PDFTemplates' })\n async deletePDFTemplates(\n @Arg('ids', type => [String]) ids: string[],\n @Ctx() context: ResolverContext\n ): Promise<boolean> {\n const { domain, tx } = context.state\n\n await tx.getRepository(PDFTemplate).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 PDFTemplates' })\n async importPDFTemplates(\n @Arg('pdfTemplates', type => [PDFTemplatePatch]) pdfTemplates: PDFTemplatePatch[],\n @Ctx() context: ResolverContext\n ): Promise<boolean> {\n const { domain, tx } = context.state\n\n await Promise.all(\n pdfTemplates.map(async (pdfTemplate: PDFTemplatePatch) => {\n const createdPDFTemplate: PDFTemplate = await tx.getRepository(PDFTemplate).save({ domain, ...pdfTemplate })\n })\n )\n\n return true\n }\n}\n"]}
@@ -0,0 +1,11 @@
1
+ import { Domain, ListParam } from '@things-factory/shell';
2
+ import { User } from '@things-factory/auth-base';
3
+ import { PDFTemplate } from './pdf-template';
4
+ import { PDFTemplateList } from './pdf-template-type';
5
+ export declare class PDFTemplateQuery {
6
+ PDFTemplate(id: string, context: ResolverContext): Promise<PDFTemplate>;
7
+ PDFTemplates(params: ListParam, context: ResolverContext): Promise<PDFTemplateList>;
8
+ domain(pdfTemplate: PDFTemplate): Promise<Domain>;
9
+ updater(pdfTemplate: PDFTemplate): Promise<User>;
10
+ creator(pdfTemplate: PDFTemplate): Promise<User>;
11
+ }
@@ -0,0 +1,79 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PDFTemplateQuery = 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 pdf_template_1 = require("./pdf-template");
9
+ const pdf_template_type_1 = require("./pdf-template-type");
10
+ let PDFTemplateQuery = class PDFTemplateQuery {
11
+ async PDFTemplate(id, context) {
12
+ const { domain } = context.state;
13
+ return await (0, shell_1.getRepository)(pdf_template_1.PDFTemplate).findOne({
14
+ where: { domain: { id: domain.id }, id }
15
+ });
16
+ }
17
+ async PDFTemplates(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)(pdf_template_1.PDFTemplate),
23
+ searchables: ['name', 'description']
24
+ });
25
+ const [items, total] = await queryBuilder.getManyAndCount();
26
+ return { items, total };
27
+ }
28
+ async domain(pdfTemplate) {
29
+ return pdfTemplate.domainId && (await (0, shell_1.getRepository)(shell_1.Domain).findOneBy({ id: pdfTemplate.domainId }));
30
+ }
31
+ async updater(pdfTemplate) {
32
+ return pdfTemplate.updaterId && (await (0, shell_1.getRepository)(auth_base_1.User).findOneBy({ id: pdfTemplate.updaterId }));
33
+ }
34
+ async creator(pdfTemplate) {
35
+ return pdfTemplate.creatorId && (await (0, shell_1.getRepository)(auth_base_1.User).findOneBy({ id: pdfTemplate.creatorId }));
36
+ }
37
+ };
38
+ exports.PDFTemplateQuery = PDFTemplateQuery;
39
+ tslib_1.__decorate([
40
+ (0, type_graphql_1.Query)(returns => pdf_template_1.PDFTemplate, { nullable: true, description: 'To fetch a PDFTemplate' }),
41
+ tslib_1.__param(0, (0, type_graphql_1.Arg)('id')),
42
+ tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
43
+ tslib_1.__metadata("design:type", Function),
44
+ tslib_1.__metadata("design:paramtypes", [String, Object]),
45
+ tslib_1.__metadata("design:returntype", Promise)
46
+ ], PDFTemplateQuery.prototype, "PDFTemplate", null);
47
+ tslib_1.__decorate([
48
+ (0, type_graphql_1.Query)(returns => pdf_template_type_1.PDFTemplateList, { description: 'To fetch multiple PDFTemplates' }),
49
+ tslib_1.__param(0, (0, type_graphql_1.Args)(type => shell_1.ListParam)),
50
+ tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
51
+ tslib_1.__metadata("design:type", Function),
52
+ tslib_1.__metadata("design:paramtypes", [shell_1.ListParam, Object]),
53
+ tslib_1.__metadata("design:returntype", Promise)
54
+ ], PDFTemplateQuery.prototype, "PDFTemplates", null);
55
+ tslib_1.__decorate([
56
+ (0, type_graphql_1.FieldResolver)(type => shell_1.Domain),
57
+ tslib_1.__param(0, (0, type_graphql_1.Root)()),
58
+ tslib_1.__metadata("design:type", Function),
59
+ tslib_1.__metadata("design:paramtypes", [pdf_template_1.PDFTemplate]),
60
+ tslib_1.__metadata("design:returntype", Promise)
61
+ ], PDFTemplateQuery.prototype, "domain", null);
62
+ tslib_1.__decorate([
63
+ (0, type_graphql_1.FieldResolver)(type => auth_base_1.User),
64
+ tslib_1.__param(0, (0, type_graphql_1.Root)()),
65
+ tslib_1.__metadata("design:type", Function),
66
+ tslib_1.__metadata("design:paramtypes", [pdf_template_1.PDFTemplate]),
67
+ tslib_1.__metadata("design:returntype", Promise)
68
+ ], PDFTemplateQuery.prototype, "updater", null);
69
+ tslib_1.__decorate([
70
+ (0, type_graphql_1.FieldResolver)(type => auth_base_1.User),
71
+ tslib_1.__param(0, (0, type_graphql_1.Root)()),
72
+ tslib_1.__metadata("design:type", Function),
73
+ tslib_1.__metadata("design:paramtypes", [pdf_template_1.PDFTemplate]),
74
+ tslib_1.__metadata("design:returntype", Promise)
75
+ ], PDFTemplateQuery.prototype, "creator", null);
76
+ exports.PDFTemplateQuery = PDFTemplateQuery = tslib_1.__decorate([
77
+ (0, type_graphql_1.Resolver)(pdf_template_1.PDFTemplate)
78
+ ], PDFTemplateQuery);
79
+ //# sourceMappingURL=pdf-template-query.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pdf-template-query.js","sourceRoot":"","sources":["../../../server/service/pdf-template/pdf-template-query.ts"],"names":[],"mappings":";;;;AAAA,+CAA8F;AAC9F,iDAAuG;AACvG,yDAAgD;AAChD,iDAA4C;AAC5C,2DAAqD;AAG9C,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB;IAErB,AAAN,KAAK,CAAC,WAAW,CAAY,EAAU,EAAS,OAAwB;QACtE,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAEhC,OAAO,MAAM,IAAA,qBAAa,EAAC,0BAAW,CAAC,CAAC,OAAO,CAAC;YAC9C,KAAK,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,MAAM,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE;SACzC,CAAC,CAAA;IACJ,CAAC;IAGK,AAAN,KAAK,CAAC,YAAY,CACS,MAAiB,EACnC,OAAwB;QAE/B,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAEhC,MAAM,YAAY,GAAG,IAAA,qCAA6B,EAAC;YACjD,MAAM;YACN,MAAM;YACN,UAAU,EAAE,MAAM,IAAA,qBAAa,EAAC,0BAAW,CAAC;YAC5C,WAAW,EAAE,CAAC,MAAM,EAAE,aAAa,CAAC;SACrC,CAAC,CAAA;QAEF,MAAM,CA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IAAA,kBAAG,GAAE,CAAA;;6CAD2B,iBAAS;;oDAe3C;AAGK;IADL,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,cAAM,CAAC;IAChB,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAc,0BAAW;;8CAE5C;AAGK;IADL,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,CAAC;IACb,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAc,0BAAW;;+CAE7C;AAGK;IADL,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,CAAC;IACb,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAc,0BAAW;;+CAE7C;2BA1CU,gBAAgB;IAD5B,IAAA,uBAAQ,EAAC,0BAAW,CAAC;GACT,gBAAgB,CA2C5B","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 { PDFTemplate } from './pdf-template'\nimport { PDFTemplateList } from './pdf-template-type'\n\n@Resolver(PDFTemplate)\nexport class PDFTemplateQuery {\n @Query(returns => PDFTemplate!, { nullable: true, description: 'To fetch a PDFTemplate' })\n async PDFTemplate(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<PDFTemplate> {\n const { domain } = context.state\n\n return await getRepository(PDFTemplate).findOne({\n where: { domain: { id: domain.id }, id }\n })\n }\n\n @Query(returns => PDFTemplateList, { description: 'To fetch multiple PDFTemplates' })\n async PDFTemplates(\n @Args(type => ListParam) params: ListParam,\n @Ctx() context: ResolverContext\n ): Promise<PDFTemplateList> {\n const { domain } = context.state\n\n const queryBuilder = getQueryBuilderFromListParams({\n domain,\n params,\n repository: await getRepository(PDFTemplate),\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() pdfTemplate: PDFTemplate): Promise<Domain> {\n return pdfTemplate.domainId && (await getRepository(Domain).findOneBy({ id: pdfTemplate.domainId }))\n }\n\n @FieldResolver(type => User)\n async updater(@Root() pdfTemplate: PDFTemplate): Promise<User> {\n return pdfTemplate.updaterId && (await getRepository(User).findOneBy({ id: pdfTemplate.updaterId }))\n }\n\n @FieldResolver(type => User)\n async creator(@Root() pdfTemplate: PDFTemplate): Promise<User> {\n return pdfTemplate.creatorId && (await getRepository(User).findOneBy({ id: pdfTemplate.creatorId }))\n }\n}\n"]}
@@ -0,0 +1,32 @@
1
+ import { PDFTemplate, PDFTemplateStatus } from './pdf-template';
2
+ export declare class NewPDFTemplate {
3
+ name: string;
4
+ description?: string;
5
+ state?: PDFTemplateStatus;
6
+ active?: boolean;
7
+ content_template?: string;
8
+ header_template?: string;
9
+ footer_template?: string;
10
+ cover_template?: string;
11
+ last_template?: string;
12
+ page_size: string;
13
+ watermark: string;
14
+ }
15
+ export declare class PDFTemplatePatch {
16
+ id?: string;
17
+ name?: string;
18
+ description?: string;
19
+ state?: PDFTemplateStatus;
20
+ active?: boolean;
21
+ content_template?: string;
22
+ header_template?: string;
23
+ footer_template?: string;
24
+ cover_template?: string;
25
+ last_template?: string;
26
+ page_size?: string;
27
+ cuFlag?: string;
28
+ }
29
+ export declare class PDFTemplateList {
30
+ items: PDFTemplate[];
31
+ total: number;
32
+ }
@@ -0,0 +1,125 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PDFTemplateList = exports.PDFTemplatePatch = exports.NewPDFTemplate = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const type_graphql_1 = require("type-graphql");
6
+ const pdf_template_1 = require("./pdf-template");
7
+ let NewPDFTemplate = class NewPDFTemplate {
8
+ };
9
+ exports.NewPDFTemplate = NewPDFTemplate;
10
+ tslib_1.__decorate([
11
+ (0, type_graphql_1.Field)(),
12
+ tslib_1.__metadata("design:type", String)
13
+ ], NewPDFTemplate.prototype, "name", void 0);
14
+ tslib_1.__decorate([
15
+ (0, type_graphql_1.Field)({ nullable: true }),
16
+ tslib_1.__metadata("design:type", String)
17
+ ], NewPDFTemplate.prototype, "description", void 0);
18
+ tslib_1.__decorate([
19
+ (0, type_graphql_1.Field)(type => pdf_template_1.PDFTemplateStatus, { nullable: true }),
20
+ tslib_1.__metadata("design:type", String)
21
+ ], NewPDFTemplate.prototype, "state", void 0);
22
+ tslib_1.__decorate([
23
+ (0, type_graphql_1.Field)({ nullable: true }),
24
+ tslib_1.__metadata("design:type", Boolean)
25
+ ], NewPDFTemplate.prototype, "active", void 0);
26
+ tslib_1.__decorate([
27
+ (0, type_graphql_1.Field)({ nullable: true }),
28
+ tslib_1.__metadata("design:type", String)
29
+ ], NewPDFTemplate.prototype, "content_template", void 0);
30
+ tslib_1.__decorate([
31
+ (0, type_graphql_1.Field)({ nullable: true }),
32
+ tslib_1.__metadata("design:type", String)
33
+ ], NewPDFTemplate.prototype, "header_template", void 0);
34
+ tslib_1.__decorate([
35
+ (0, type_graphql_1.Field)({ nullable: true }),
36
+ tslib_1.__metadata("design:type", String)
37
+ ], NewPDFTemplate.prototype, "footer_template", void 0);
38
+ tslib_1.__decorate([
39
+ (0, type_graphql_1.Field)({ nullable: true }),
40
+ tslib_1.__metadata("design:type", String)
41
+ ], NewPDFTemplate.prototype, "cover_template", void 0);
42
+ tslib_1.__decorate([
43
+ (0, type_graphql_1.Field)({ nullable: true }),
44
+ tslib_1.__metadata("design:type", String)
45
+ ], NewPDFTemplate.prototype, "last_template", void 0);
46
+ tslib_1.__decorate([
47
+ (0, type_graphql_1.Field)({ nullable: true, defaultValue: 'A4' }),
48
+ tslib_1.__metadata("design:type", String)
49
+ ], NewPDFTemplate.prototype, "page_size", void 0);
50
+ tslib_1.__decorate([
51
+ (0, type_graphql_1.Field)({ nullable: true }),
52
+ tslib_1.__metadata("design:type", String)
53
+ ], NewPDFTemplate.prototype, "watermark", void 0);
54
+ exports.NewPDFTemplate = NewPDFTemplate = tslib_1.__decorate([
55
+ (0, type_graphql_1.InputType)()
56
+ ], NewPDFTemplate);
57
+ let PDFTemplatePatch = class PDFTemplatePatch {
58
+ };
59
+ exports.PDFTemplatePatch = PDFTemplatePatch;
60
+ tslib_1.__decorate([
61
+ (0, type_graphql_1.Field)(type => type_graphql_1.ID, { nullable: true }),
62
+ tslib_1.__metadata("design:type", String)
63
+ ], PDFTemplatePatch.prototype, "id", void 0);
64
+ tslib_1.__decorate([
65
+ (0, type_graphql_1.Field)({ nullable: true }),
66
+ tslib_1.__metadata("design:type", String)
67
+ ], PDFTemplatePatch.prototype, "name", void 0);
68
+ tslib_1.__decorate([
69
+ (0, type_graphql_1.Field)({ nullable: true }),
70
+ tslib_1.__metadata("design:type", String)
71
+ ], PDFTemplatePatch.prototype, "description", void 0);
72
+ tslib_1.__decorate([
73
+ (0, type_graphql_1.Field)(type => pdf_template_1.PDFTemplateStatus, { nullable: true }),
74
+ tslib_1.__metadata("design:type", String)
75
+ ], PDFTemplatePatch.prototype, "state", void 0);
76
+ tslib_1.__decorate([
77
+ (0, type_graphql_1.Field)({ nullable: true }),
78
+ tslib_1.__metadata("design:type", Boolean)
79
+ ], PDFTemplatePatch.prototype, "active", void 0);
80
+ tslib_1.__decorate([
81
+ (0, type_graphql_1.Field)({ nullable: true }),
82
+ tslib_1.__metadata("design:type", String)
83
+ ], PDFTemplatePatch.prototype, "content_template", void 0);
84
+ tslib_1.__decorate([
85
+ (0, type_graphql_1.Field)({ nullable: true }),
86
+ tslib_1.__metadata("design:type", String)
87
+ ], PDFTemplatePatch.prototype, "header_template", void 0);
88
+ tslib_1.__decorate([
89
+ (0, type_graphql_1.Field)({ nullable: true }),
90
+ tslib_1.__metadata("design:type", String)
91
+ ], PDFTemplatePatch.prototype, "footer_template", void 0);
92
+ tslib_1.__decorate([
93
+ (0, type_graphql_1.Field)({ nullable: true }),
94
+ tslib_1.__metadata("design:type", String)
95
+ ], PDFTemplatePatch.prototype, "cover_template", void 0);
96
+ tslib_1.__decorate([
97
+ (0, type_graphql_1.Field)({ nullable: true }),
98
+ tslib_1.__metadata("design:type", String)
99
+ ], PDFTemplatePatch.prototype, "last_template", void 0);
100
+ tslib_1.__decorate([
101
+ (0, type_graphql_1.Field)({ nullable: true, defaultValue: 'A4' }),
102
+ tslib_1.__metadata("design:type", String)
103
+ ], PDFTemplatePatch.prototype, "page_size", void 0);
104
+ tslib_1.__decorate([
105
+ (0, type_graphql_1.Field)({ nullable: true }),
106
+ tslib_1.__metadata("design:type", String)
107
+ ], PDFTemplatePatch.prototype, "cuFlag", void 0);
108
+ exports.PDFTemplatePatch = PDFTemplatePatch = tslib_1.__decorate([
109
+ (0, type_graphql_1.InputType)()
110
+ ], PDFTemplatePatch);
111
+ let PDFTemplateList = class PDFTemplateList {
112
+ };
113
+ exports.PDFTemplateList = PDFTemplateList;
114
+ tslib_1.__decorate([
115
+ (0, type_graphql_1.Field)(type => [pdf_template_1.PDFTemplate]),
116
+ tslib_1.__metadata("design:type", Array)
117
+ ], PDFTemplateList.prototype, "items", void 0);
118
+ tslib_1.__decorate([
119
+ (0, type_graphql_1.Field)(type => type_graphql_1.Int),
120
+ tslib_1.__metadata("design:type", Number)
121
+ ], PDFTemplateList.prototype, "total", void 0);
122
+ exports.PDFTemplateList = PDFTemplateList = tslib_1.__decorate([
123
+ (0, type_graphql_1.ObjectType)()
124
+ ], PDFTemplateList);
125
+ //# sourceMappingURL=pdf-template-type.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pdf-template-type.js","sourceRoot":"","sources":["../../../server/service/pdf-template/pdf-template-type.ts"],"names":[],"mappings":";;;;AAAA,+CAAoE;AAEpE,iDAA+D;AAGxD,IAAM,cAAc,GAApB,MAAM,cAAc;CAiC1B,CAAA;AAjCY,wCAAc;AAEzB;IADC,IAAA,oBAAK,GAAE;;4CACI;AAGZ;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;mDAC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EAAE,IAAI,EAAE,CAAC;;+CAC5B;AAGzB;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;gDACV;AAGhB;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;0DACD;AAGzB;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;yDACF;AAGxB;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;yDACF;AAGxB;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;wDACH;AAGvB;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;uDACJ;AAGtB;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC;;mDAC5B;AAGlB;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;gDACX;2BAnCJ,gBAAgB;IAD5B,IAAA,wBAAS,GAAE;GACC,gBAAgB,CAoC5B;AAGM,IAAM,eAAe,GAArB,MAAM,eAAe;CAM3B,CAAA;AANY,0CAAe;AAE1B;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,CAAC,0BAAW,CAAC,CAAC;;8CACT;AAGpB;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,kBAAG,CAAC;;8CACN;0BALF,eAAe;IAD3B,IAAA,yBAAU,GAAE;GACA,eAAe,CAM3B","sourcesContent":["import { ObjectType, Field, InputType, Int, ID } from 'type-graphql'\n\nimport { PDFTemplate, PDFTemplateStatus } from './pdf-template'\n\n@InputType()\nexport class NewPDFTemplate {\n @Field()\n name: string\n\n @Field({ nullable: true })\n description?: string\n\n @Field(type => PDFTemplateStatus, { nullable: true })\n state?: PDFTemplateStatus\n\n @Field({ nullable: true })\n active?: boolean\n\n @Field({ nullable: true })\n content_template?: string\n\n @Field({ nullable: true })\n header_template?: string\n\n @Field({ nullable: true })\n footer_template?: string\n\n @Field({ nullable: true })\n cover_template?: string\n\n @Field({ nullable: true })\n last_template?: string\n\n @Field({ nullable: true, defaultValue: 'A4' })\n page_size: string\n\n @Field({ nullable: true })\n watermark: string\n}\n\n@InputType()\nexport class PDFTemplatePatch {\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 => PDFTemplateStatus, { nullable: true })\n state?: PDFTemplateStatus\n\n @Field({ nullable: true })\n active?: boolean\n\n @Field({ nullable: true })\n content_template?: string\n\n @Field({ nullable: true })\n header_template?: string\n\n @Field({ nullable: true })\n footer_template?: string\n\n @Field({ nullable: true })\n cover_template?: string\n\n @Field({ nullable: true })\n last_template?: string\n\n @Field({ nullable: true, defaultValue: 'A4' })\n page_size?: string\n\n @Field({ nullable: true })\n cuFlag?: string\n}\n\n@ObjectType()\nexport class PDFTemplateList {\n @Field(type => [PDFTemplate])\n items: PDFTemplate[]\n\n @Field(type => Int)\n total: number\n}\n"]}
@@ -0,0 +1,28 @@
1
+ import { Domain } from '@things-factory/shell';
2
+ import { User } from '@things-factory/auth-base';
3
+ export declare enum PDFTemplateStatus {
4
+ draft = "draft",
5
+ released = "released"
6
+ }
7
+ export declare class PDFTemplate {
8
+ readonly id: string;
9
+ domain?: Domain;
10
+ domainId?: string;
11
+ name?: string;
12
+ description?: string;
13
+ active?: boolean;
14
+ state?: PDFTemplateStatus;
15
+ content_template?: string;
16
+ header_template?: string;
17
+ footer_template?: string;
18
+ cover_template?: string;
19
+ last_template?: string;
20
+ page_size?: string;
21
+ watermark?: string;
22
+ createdAt?: Date;
23
+ updatedAt?: Date;
24
+ creator?: User;
25
+ creatorId?: string;
26
+ updater?: User;
27
+ updaterId?: string;
28
+ }
@@ -0,0 +1,125 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PDFTemplate = exports.PDFTemplateStatus = 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 PDFTemplateStatus;
10
+ (function (PDFTemplateStatus) {
11
+ PDFTemplateStatus["draft"] = "draft";
12
+ PDFTemplateStatus["released"] = "released";
13
+ })(PDFTemplateStatus || (exports.PDFTemplateStatus = PDFTemplateStatus = {}));
14
+ (0, type_graphql_1.registerEnumType)(PDFTemplateStatus, {
15
+ name: 'PDFTemplateStatus',
16
+ description: 'state enumeration of a PDF Template'
17
+ });
18
+ let PDFTemplate = class PDFTemplate {
19
+ };
20
+ exports.PDFTemplate = PDFTemplate;
21
+ tslib_1.__decorate([
22
+ (0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
23
+ (0, type_graphql_1.Field)(type => type_graphql_1.ID),
24
+ tslib_1.__metadata("design:type", String)
25
+ ], PDFTemplate.prototype, "id", void 0);
26
+ tslib_1.__decorate([
27
+ (0, typeorm_1.ManyToOne)(type => shell_1.Domain),
28
+ (0, type_graphql_1.Field)({ nullable: true }),
29
+ tslib_1.__metadata("design:type", shell_1.Domain)
30
+ ], PDFTemplate.prototype, "domain", void 0);
31
+ tslib_1.__decorate([
32
+ (0, typeorm_1.RelationId)((pdfTemplate) => pdfTemplate.domain),
33
+ tslib_1.__metadata("design:type", String)
34
+ ], PDFTemplate.prototype, "domainId", void 0);
35
+ tslib_1.__decorate([
36
+ (0, typeorm_1.Column)(),
37
+ (0, type_graphql_1.Field)({ nullable: true }),
38
+ tslib_1.__metadata("design:type", String)
39
+ ], PDFTemplate.prototype, "name", void 0);
40
+ tslib_1.__decorate([
41
+ (0, typeorm_1.Column)({ nullable: true }),
42
+ (0, type_graphql_1.Field)({ nullable: true }),
43
+ tslib_1.__metadata("design:type", String)
44
+ ], PDFTemplate.prototype, "description", void 0);
45
+ tslib_1.__decorate([
46
+ (0, typeorm_1.Column)({ nullable: true }),
47
+ (0, type_graphql_1.Field)({ nullable: true }),
48
+ tslib_1.__metadata("design:type", Boolean)
49
+ ], PDFTemplate.prototype, "active", void 0);
50
+ tslib_1.__decorate([
51
+ (0, typeorm_1.Column)({ nullable: true }),
52
+ (0, type_graphql_1.Field)({ nullable: true }),
53
+ tslib_1.__metadata("design:type", String)
54
+ ], PDFTemplate.prototype, "state", void 0);
55
+ tslib_1.__decorate([
56
+ (0, typeorm_1.Column)({ type: 'text', nullable: true }),
57
+ (0, type_graphql_1.Field)({ nullable: true }),
58
+ tslib_1.__metadata("design:type", String)
59
+ ], PDFTemplate.prototype, "content_template", void 0);
60
+ tslib_1.__decorate([
61
+ (0, typeorm_1.Column)({ type: 'text', nullable: true }),
62
+ (0, type_graphql_1.Field)({ nullable: true }),
63
+ tslib_1.__metadata("design:type", String)
64
+ ], PDFTemplate.prototype, "header_template", void 0);
65
+ tslib_1.__decorate([
66
+ (0, typeorm_1.Column)({ type: 'text', nullable: true }),
67
+ (0, type_graphql_1.Field)({ nullable: true }),
68
+ tslib_1.__metadata("design:type", String)
69
+ ], PDFTemplate.prototype, "footer_template", void 0);
70
+ tslib_1.__decorate([
71
+ (0, typeorm_1.Column)({ type: 'text', nullable: true }),
72
+ (0, type_graphql_1.Field)({ nullable: true }),
73
+ tslib_1.__metadata("design:type", String)
74
+ ], PDFTemplate.prototype, "cover_template", void 0);
75
+ tslib_1.__decorate([
76
+ (0, typeorm_1.Column)({ type: 'text', nullable: true }),
77
+ (0, type_graphql_1.Field)({ nullable: true }),
78
+ tslib_1.__metadata("design:type", String)
79
+ ], PDFTemplate.prototype, "last_template", void 0);
80
+ tslib_1.__decorate([
81
+ (0, typeorm_1.Column)({ default: 'A4' }),
82
+ (0, type_graphql_1.Field)({ nullable: true, defaultValue: 'A4' }),
83
+ tslib_1.__metadata("design:type", String)
84
+ ], PDFTemplate.prototype, "page_size", void 0);
85
+ tslib_1.__decorate([
86
+ (0, typeorm_1.Column)({ type: 'text', nullable: true }),
87
+ (0, type_graphql_1.Field)({ nullable: true }),
88
+ tslib_1.__metadata("design:type", String)
89
+ ], PDFTemplate.prototype, "watermark", void 0);
90
+ tslib_1.__decorate([
91
+ (0, typeorm_1.CreateDateColumn)(),
92
+ (0, type_graphql_1.Field)({ nullable: true }),
93
+ tslib_1.__metadata("design:type", Date)
94
+ ], PDFTemplate.prototype, "createdAt", void 0);
95
+ tslib_1.__decorate([
96
+ (0, typeorm_1.UpdateDateColumn)(),
97
+ (0, type_graphql_1.Field)({ nullable: true }),
98
+ tslib_1.__metadata("design:type", Date)
99
+ ], PDFTemplate.prototype, "updatedAt", void 0);
100
+ tslib_1.__decorate([
101
+ (0, typeorm_1.ManyToOne)(type => auth_base_1.User, { nullable: true }),
102
+ (0, type_graphql_1.Field)(type => auth_base_1.User, { nullable: true }),
103
+ tslib_1.__metadata("design:type", auth_base_1.User)
104
+ ], PDFTemplate.prototype, "creator", void 0);
105
+ tslib_1.__decorate([
106
+ (0, typeorm_1.RelationId)((pdfTemplate) => pdfTemplate.creator),
107
+ tslib_1.__metadata("design:type", String)
108
+ ], PDFTemplate.prototype, "creatorId", void 0);
109
+ tslib_1.__decorate([
110
+ (0, typeorm_1.ManyToOne)(type => auth_base_1.User, { nullable: true }),
111
+ (0, type_graphql_1.Field)(type => auth_base_1.User, { nullable: true }),
112
+ tslib_1.__metadata("design:type", auth_base_1.User)
113
+ ], PDFTemplate.prototype, "updater", void 0);
114
+ tslib_1.__decorate([
115
+ (0, typeorm_1.RelationId)((pdfTemplate) => pdfTemplate.updater),
116
+ tslib_1.__metadata("design:type", String)
117
+ ], PDFTemplate.prototype, "updaterId", void 0);
118
+ exports.PDFTemplate = PDFTemplate = tslib_1.__decorate([
119
+ (0, typeorm_1.Entity)(),
120
+ (0, typeorm_1.Index)('ix_pdf_template_0', (pdfTemplate) => [pdfTemplate.domain, pdfTemplate.name], {
121
+ unique: true
122
+ }),
123
+ (0, type_graphql_1.ObjectType)({ description: 'Entity for PDFTemplate' })
124
+ ], PDFTemplate);
125
+ //# sourceMappingURL=pdf-template.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pdf-template.js","sourceRoot":"","sources":["../../../server/service/pdf-template/pdf-template.ts"],"names":[],"mappings":";;;;AAAA,qCASgB;AAChB,+CAA2E;AAE3E,iDAA8C;AAC9C,yDAAgD;AAEhD,IAAY,iBAGX;AAHD,WAAY,iBAAiB;IAC3B,oCAAe,CAAA;IACf,0CAAqB,CAAA;AACvB,CAAC,EAHW,iBAAiB,iCAAjB,iBAAiB,QAG5B;AAED,IAAA,+BAAgB,EAAC,iBAAiB,EAAE;IAClC,IAAI,EAAE,mBAAmB;IACzB,WAAW,EAAE,qCAAqC;CACnD,CAAC,CAAA;AAOK,IAAM,WAAW,GAAjB,MAAM,WAAW;CA6EvB,CAAA;AA7EY,kCAAW;AAGb;IAFR,IAAA,gCAAsB,EAAC,MAAM,CAAC;IAC9B,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,iBAAE,CAAC;;uCACC;AAInB;IAFC,IAAA,mBAAS,EAAC,IAAI,CAAC,EAAE,CAAC,cAAM,CAAC;IACzB,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;sCACjB,cAAM;2CAAA;AAGf;IADC,IAAA,oBAAU,EAAC,CAAC,WAAwB,EAAE,EAAE,CAAC,WAAW,CAAC,MAAM,CAAC;;6CAC5C;AAIjB;IAFC,IAAA,gBAAM,GAAE;IACR,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;yCACb;AAIb;IAFC,IAAA,gBAAM,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IAC1B,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;gDACN;AAIpB;IAFC,IAAA,gBAAM,EAAC,EAAE,QAAQ,E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AC;IACD,IAAA,yBAAU,EAAC,EAAE,WAAW,EAAE,wBAAwB,EAAE,CAAC;GACzC,WAAW,CA6EvB","sourcesContent":["import {\n CreateDateColumn,\n UpdateDateColumn,\n Entity,\n Index,\n Column,\n RelationId,\n ManyToOne,\n PrimaryGeneratedColumn\n} from 'typeorm'\nimport { ObjectType, Field, Int, ID, registerEnumType } from 'type-graphql'\n\nimport { Domain } from '@things-factory/shell'\nimport { User } from '@things-factory/auth-base'\n\nexport enum PDFTemplateStatus {\n draft = 'draft',\n released = 'released'\n}\n\nregisterEnumType(PDFTemplateStatus, {\n name: 'PDFTemplateStatus',\n description: 'state enumeration of a PDF Template'\n})\n\n@Entity()\n@Index('ix_pdf_template_0', (pdfTemplate: PDFTemplate) => [pdfTemplate.domain, pdfTemplate.name], {\n unique: true\n})\n@ObjectType({ description: 'Entity for PDFTemplate' })\nexport class PDFTemplate {\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((pdfTemplate: PDFTemplate) => pdfTemplate.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 active?: boolean\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n state?: PDFTemplateStatus\n\n @Column({ type: 'text', nullable: true })\n @Field({ nullable: true })\n content_template?: string\n\n @Column({ type: 'text', nullable: true })\n @Field({ nullable: true })\n header_template?: string\n\n @Column({ type: 'text', nullable: true })\n @Field({ nullable: true })\n footer_template?: string\n\n @Column({ type: 'text', nullable: true })\n @Field({ nullable: true })\n cover_template?: string\n\n @Column({ type: 'text', nullable: true })\n @Field({ nullable: true })\n last_template?: string\n\n @Column({ default: 'A4' })\n @Field({ nullable: true, defaultValue: 'A4' })\n page_size?: string\n\n @Column({ type: 'text', nullable: true })\n @Field({ nullable: true })\n watermark?: string\n\n @CreateDateColumn()\n @Field({ nullable: true })\n createdAt?: Date\n\n @UpdateDateColumn()\n @Field({ nullable: true })\n updatedAt?: Date\n\n @ManyToOne(type => User, { nullable: true })\n @Field(type => User, { nullable: true })\n creator?: User\n\n @RelationId((pdfTemplate: PDFTemplate) => pdfTemplate.creator)\n creatorId?: string\n\n @ManyToOne(type => User, { nullable: true })\n @Field(type => User, { nullable: true })\n updater?: User\n\n @RelationId((pdfTemplate: PDFTemplate) => pdfTemplate.updater)\n updaterId?: string\n}\n"]}