@things-factory/document-template-base 7.0.1-beta.8 → 7.0.1-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist-server/constants/index.d.ts +1 -0
- package/dist-server/constants/template-type.d.ts +18 -0
- package/dist-server/controllers/index.d.ts +1 -0
- package/dist-server/controllers/report-to-html.d.ts +20 -0
- package/dist-server/controllers/report-to-html.js +4 -5
- package/dist-server/controllers/report-to-html.js.map +1 -1
- package/dist-server/index.d.ts +4 -0
- package/dist-server/migrations/index.d.ts +1 -0
- package/dist-server/routes.d.ts +1 -0
- package/dist-server/service/doc-template/doc-template-mutation.d.ts +9 -0
- package/dist-server/service/doc-template/doc-template-mutation.js +2 -2
- package/dist-server/service/doc-template/doc-template-mutation.js.map +1 -1
- package/dist-server/service/doc-template/doc-template-query.d.ts +12 -0
- package/dist-server/service/doc-template/doc-template-query.js +3 -3
- package/dist-server/service/doc-template/doc-template-query.js.map +1 -1
- package/dist-server/service/doc-template/doc-template-type.d.ts +29 -0
- package/dist-server/service/doc-template/doc-template-type.js +6 -6
- package/dist-server/service/doc-template/doc-template-type.js.map +1 -1
- package/dist-server/service/doc-template/doc-template.d.ts +22 -0
- package/dist-server/service/doc-template/doc-template.js +4 -4
- package/dist-server/service/doc-template/doc-template.js.map +1 -1
- package/dist-server/service/doc-template/index.d.ts +5 -0
- package/dist-server/service/index.d.ts +7 -0
- package/dist-server/service/template-file/index.d.ts +5 -0
- package/dist-server/service/template-file/template-file-mutation.d.ts +9 -0
- package/dist-server/service/template-file/template-file-mutation.js +2 -2
- package/dist-server/service/template-file/template-file-mutation.js.map +1 -1
- package/dist-server/service/template-file/template-file-query.d.ts +14 -0
- package/dist-server/service/template-file/template-file-query.js +3 -3
- package/dist-server/service/template-file/template-file-query.js.map +1 -1
- package/dist-server/service/template-file/template-file-type.d.ts +28 -0
- package/dist-server/service/template-file/template-file-type.js +6 -6
- package/dist-server/service/template-file/template-file-type.js.map +1 -1
- package/dist-server/service/template-file/template-file.d.ts +23 -0
- package/dist-server/service/template-file/template-file.js +5 -6
- package/dist-server/service/template-file/template-file.js.map +1 -1
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/package.json +5 -5
- package/server/service/doc-template/doc-template-query.ts +6 -7
- package/server/service/doc-template/doc-template.ts +26 -27
- package/server/service/template-file/template-file-query.ts +8 -9
- package/server/service/template-file/template-file.ts +27 -28
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './template-type';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export declare const TEMPLATE_TYPES: {
|
|
2
|
+
GRN_TEMPLATE: {
|
|
3
|
+
name: string;
|
|
4
|
+
value: string;
|
|
5
|
+
};
|
|
6
|
+
DO_TEMPLATE: {
|
|
7
|
+
name: string;
|
|
8
|
+
value: string;
|
|
9
|
+
};
|
|
10
|
+
CO_TEMPLATE: {
|
|
11
|
+
name: string;
|
|
12
|
+
value: string;
|
|
13
|
+
};
|
|
14
|
+
INVOICE_TEMPLATE: {
|
|
15
|
+
name: string;
|
|
16
|
+
value: string;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './report-to-html';
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import fs from 'fs';
|
|
2
|
+
type report2htmlInput = {
|
|
3
|
+
reportFile: String | fs.ReadStream;
|
|
4
|
+
data: Object;
|
|
5
|
+
isFile?: Boolean;
|
|
6
|
+
};
|
|
7
|
+
export declare function report2html({ reportFile, data, isFile }: report2htmlInput): Promise<string>;
|
|
8
|
+
export declare function reportPath2html({ reportFilePath, data }: {
|
|
9
|
+
reportFilePath: any;
|
|
10
|
+
data?: {};
|
|
11
|
+
}): Promise<string>;
|
|
12
|
+
export declare function reportUrl2html({ reportUrl, data }: {
|
|
13
|
+
reportUrl: any;
|
|
14
|
+
data?: {};
|
|
15
|
+
}): Promise<string>;
|
|
16
|
+
export declare function reportString2html({ reportTemplateString, data }: {
|
|
17
|
+
reportTemplateString: any;
|
|
18
|
+
data?: {};
|
|
19
|
+
}): Promise<string>;
|
|
20
|
+
export {};
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.report2html = report2html;
|
|
4
|
+
exports.reportPath2html = reportPath2html;
|
|
5
|
+
exports.reportUrl2html = reportUrl2html;
|
|
6
|
+
exports.reportString2html = reportString2html;
|
|
4
7
|
const tslib_1 = require("tslib");
|
|
5
8
|
const env_1 = require("@things-factory/env");
|
|
6
9
|
const form_data_1 = tslib_1.__importDefault(require("form-data"));
|
|
@@ -19,20 +22,16 @@ async function report2html({ reportFile, data = {}, isFile }) {
|
|
|
19
22
|
});
|
|
20
23
|
return await response.text();
|
|
21
24
|
}
|
|
22
|
-
exports.report2html = report2html;
|
|
23
25
|
async function reportPath2html({ reportFilePath, data = {} }) {
|
|
24
26
|
const reportFileStream = fs_1.default.createReadStream(reportFilePath);
|
|
25
27
|
return await report2html({ reportFile: reportFileStream, data, isFile: true });
|
|
26
28
|
}
|
|
27
|
-
exports.reportPath2html = reportPath2html;
|
|
28
29
|
async function reportUrl2html({ reportUrl, data = {} }) {
|
|
29
30
|
const response = await (0, node_fetch_1.default)(reportUrl);
|
|
30
31
|
const xml = await response.text();
|
|
31
32
|
return await report2html({ reportFile: xml, data });
|
|
32
33
|
}
|
|
33
|
-
exports.reportUrl2html = reportUrl2html;
|
|
34
34
|
async function reportString2html({ reportTemplateString, data = {} }) {
|
|
35
35
|
return await report2html({ reportFile: reportTemplateString, data });
|
|
36
36
|
}
|
|
37
|
-
exports.reportString2html = reportString2html;
|
|
38
37
|
//# sourceMappingURL=report-to-html.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"report-to-html.js","sourceRoot":"","sources":["../../server/controllers/report-to-html.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":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EvC,MAAM,GAAG,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAA;IAEjC,OAAO,MAAM,WAAW,CAAC,EAAE,UAAU,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC,CAAA;AACrD,CAAC;AAEM,KAAK,UAAU,iBAAiB,CAAC,EAAE,oBAAoB,EAAE,IAAI,GAAG,EAAE,EAAE;IACzE,OAAO,MAAM,WAAW,CAAC,EAAE,UAAU,EAAE,oBAAoB,EAAE,IAAI,EAAE,CAAC,CAAA;AACtE,CAAC","sourcesContent":["import { config } from '@things-factory/env'\nimport FormData from 'form-data'\nimport fs from 'fs'\nimport fetch from 'node-fetch'\n\nconst REPORT_API_URL = config.get('reportApiUrl', 'http://localhost:8888/rest/report/show_html')\n\ntype report2htmlInput = {\n reportFile: String | fs.ReadStream\n data: Object\n isFile?: Boolean\n}\n\nexport async function report2html({ reportFile, data = {}, isFile }: report2htmlInput) {\n const formData = new FormData()\n\n formData.append('template', reportFile)\n formData.append('jsonString', JSON.stringify(data))\n if (isFile) formData.append('isFile', isFile)\n\n const response = await fetch(REPORT_API_URL, {\n method: 'POST',\n body: formData\n })\n\n return await response.text()\n}\n\nexport async function reportPath2html({ reportFilePath, data = {} }) {\n const reportFileStream = fs.createReadStream(reportFilePath)\n\n return await report2html({ reportFile: reportFileStream, data, isFile: true })\n}\n\nexport async function reportUrl2html({ reportUrl, data = {} }) {\n const response = await fetch(reportUrl)\n\n const xml = await response.text()\n\n return await report2html({ reportFile: xml, data })\n}\n\nexport async function reportString2html({ reportTemplateString, data = {} }) {\n return await report2html({ reportFile: reportTemplateString, data })\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare var migrations: any[];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { DocTemplate } from './doc-template';
|
|
2
|
+
import { NewDocTemplate, DocTemplatePatch } from './doc-template-type';
|
|
3
|
+
export declare class DocTemplateMutation {
|
|
4
|
+
createDocTemplate(docTemplate: NewDocTemplate, context: any): Promise<DocTemplate>;
|
|
5
|
+
updateDocTemplate(id: string, patch: DocTemplatePatch, context: any): Promise<DocTemplate>;
|
|
6
|
+
updateMultipleDocTemplate(patches: DocTemplatePatch[], context: any): Promise<DocTemplate[]>;
|
|
7
|
+
deleteDocTemplate(id: string, context: any): Promise<boolean>;
|
|
8
|
+
deleteDocTemplates(ids: string[], context: any): Promise<boolean>;
|
|
9
|
+
}
|
|
@@ -59,6 +59,7 @@ let DocTemplateMutation = class DocTemplateMutation {
|
|
|
59
59
|
return true;
|
|
60
60
|
}
|
|
61
61
|
};
|
|
62
|
+
exports.DocTemplateMutation = DocTemplateMutation;
|
|
62
63
|
tslib_1.__decorate([
|
|
63
64
|
(0, type_graphql_1.Directive)('@transaction'),
|
|
64
65
|
(0, type_graphql_1.Mutation)(returns => doc_template_1.DocTemplate, { description: 'To create new DocTemplate' }),
|
|
@@ -105,8 +106,7 @@ tslib_1.__decorate([
|
|
|
105
106
|
tslib_1.__metadata("design:paramtypes", [Array, Object]),
|
|
106
107
|
tslib_1.__metadata("design:returntype", Promise)
|
|
107
108
|
], DocTemplateMutation.prototype, "deleteDocTemplates", null);
|
|
108
|
-
DocTemplateMutation = tslib_1.__decorate([
|
|
109
|
+
exports.DocTemplateMutation = DocTemplateMutation = tslib_1.__decorate([
|
|
109
110
|
(0, type_graphql_1.Resolver)(doc_template_1.DocTemplate)
|
|
110
111
|
], DocTemplateMutation);
|
|
111
|
-
exports.DocTemplateMutation = DocTemplateMutation;
|
|
112
112
|
//# sourceMappingURL=doc-template-mutation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"doc-template-mutation.js","sourceRoot":"","sources":["../../../server/service/doc-template/doc-template-mutation.ts"],"names":[],"mappings":";;;;AACA,+CAAsE;AAEtE,iDAA4C;AAC5C,2DAAsE;AAK/D,IAAM,mBAAmB,GAAzB,MAAM,mBAAmB;IAGxB,AAAN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AAE,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,WAAW,EAAE,KAAK,GAAG,CAAC,CAAA;QACzF,MAAM,eAAe,GAAG,EAAE,CAAC,aAAa,CAAC,0BAAW,CAAC,CAAA;QAErD,IAAI,cAAc,CAAC,MAAM,GAAG,CAAC,EAAE;
|
|
1
|
+
{"version":3,"file":"doc-template-mutation.js","sourceRoot":"","sources":["../../../server/service/doc-template/doc-template-mutation.ts"],"names":[],"mappings":";;;;AACA,+CAAsE;AAEtE,iDAA4C;AAC5C,2DAAsE;AAK/D,IAAM,mBAAmB,GAAzB,MAAM,mBAAmB;IAGxB,AAAN,KAAK,CAAC,iBAAiB,CAAqB,WAA2B,EAAS,OAAY;QAC1F,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAE1C,OAAO,MAAM,EAAE,CAAC,aAAa,CAAC,0BAAW,CAAC,CAAC,IAAI,iCAC1C,WAAW,KACd,MAAM,EACN,OAAO,EAAE,IAAI,EACb,OAAO,EAAE,IAAI,IACb,CAAA;IACJ,CAAC;IAIK,AAAN,KAAK,CAAC,iBAAiB,CACV,EAAU,EACP,KAAuB,EAC9B,OAAY;QAEnB,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAE1C,MAAM,UAAU,GAAG,EAAE,CAAC,aAAa,CAAC,0BAAW,CAAC,CAAA;QAChD,MAAM,WAAW,GAAG,MAAM,UAAU,CAAC,OAAO,CAC1C;YACE,KAAK,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,MAAM,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE;YACxC,SAAS,EAAE,CAAC,QAAQ,EAAC,SAAS,EAAC,SAAS,CAAC;SAC1C,CACF,CAAA;QAED,OAAO,MAAM,UAAU,CAAC,IAAI,+CACvB,WAAW,GACX,KAAK,KACR,OAAO,EAAE,IAAI,IACb,CAA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AE,EAAE,WAAW,EAAE,iCAAiC,EAAE,CAAC;IAE9E,mBAAA,IAAA,kBAAG,EAAC,KAAK,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAA;IAC5B,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;6DAUP;8BA7GU,mBAAmB;IAD/B,IAAA,uBAAQ,EAAC,0BAAW,CAAC;GACT,mBAAmB,CA8G/B","sourcesContent":["\nimport { Resolver, Mutation, Arg, Ctx, Directive } from 'type-graphql'\nimport { In } from 'typeorm'\nimport { DocTemplate } from './doc-template'\nimport { NewDocTemplate, DocTemplatePatch } from './doc-template-type'\nimport { Domain, getRepository } from '@things-factory/shell'\nimport { User } from '@things-factory/auth-base'\n\n@Resolver(DocTemplate)\nexport class DocTemplateMutation {\n @Directive('@transaction')\n @Mutation(returns => DocTemplate, { description: 'To create new DocTemplate' })\n async createDocTemplate(@Arg('docTemplate') docTemplate: NewDocTemplate, @Ctx() context: any): Promise<DocTemplate> {\n const { domain, user, tx } = context.state\n\n return await tx.getRepository(DocTemplate).save({\n ...docTemplate,\n domain,\n creator: user,\n updater: user\n })\n }\n\n @Directive('@transaction')\n @Mutation(returns => DocTemplate, { description: 'To modify DocTemplate information' })\n async updateDocTemplate(\n @Arg('id') id: string,\n @Arg('patch') patch: DocTemplatePatch,\n @Ctx() context: any\n ): Promise<DocTemplate> {\n const { domain, user, tx } = context.state\n\n const repository = tx.getRepository(DocTemplate)\n const docTemplate = await repository.findOne(\n {\n where: { domain: { id: domain.id }, id },\n relations: ['domain','updater','creator']\n }\n )\n\n return await repository.save({\n ...docTemplate,\n ...patch,\n updater: user\n })\n }\n\n @Directive('@transaction')\n @Mutation(returns => [DocTemplate], { description: \"To modify multiple DocTemplates' information\" })\n async updateMultipleDocTemplate(\n @Arg('patches', type => [DocTemplatePatch]) patches: DocTemplatePatch[],\n @Ctx() context: any\n ): Promise<DocTemplate[]> {\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 docTemplateRepo = tx.getRepository(DocTemplate)\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 docTemplateRepo.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 docTemplate = await docTemplateRepo.findOne({\n where: { domain: { id: domain.id }, id:updRecord.id },\n relations: ['domain','updater','creator']\n })\n \n const result = await docTemplateRepo.save({\n ...docTemplate,\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 DocTemplate' })\n async deleteDocTemplate(@Arg('id') id: string, @Ctx() context: any): Promise<boolean> {\n const { domain, tx, user } = context.state\n await tx.getRepository(DocTemplate).remove({ domain, id, updater:user })\n return true\n }\n\n @Directive('@transaction')\n @Mutation(returns => Boolean, { description: 'To delete multiple docTemplates' })\n async deleteDocTemplates(\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(DocTemplate).remove(delEntitis)\n return true\n }\n}\n"]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ListParam } from '@things-factory/shell';
|
|
2
|
+
import { DocTemplate } from './doc-template';
|
|
3
|
+
import { DocTemplateList } from './doc-template-type';
|
|
4
|
+
import { User } from '@things-factory/auth-base';
|
|
5
|
+
import { Domain } from '@things-factory/shell';
|
|
6
|
+
export declare class DocTemplateQuery {
|
|
7
|
+
docTemplate(id: string, context: any): Promise<DocTemplate>;
|
|
8
|
+
docTemplates(params: ListParam, context: any): Promise<DocTemplateList>;
|
|
9
|
+
domain(docTemplate: DocTemplate): Promise<Domain>;
|
|
10
|
+
creator(docTemplate: DocTemplate): Promise<User>;
|
|
11
|
+
updater(docTemplate: DocTemplate): Promise<User>;
|
|
12
|
+
}
|
|
@@ -36,6 +36,7 @@ let DocTemplateQuery = class DocTemplateQuery {
|
|
|
36
36
|
return await (0, shell_1.getRepository)(auth_base_1.User).findOneBy({ id: docTemplate.updaterId });
|
|
37
37
|
}
|
|
38
38
|
};
|
|
39
|
+
exports.DocTemplateQuery = DocTemplateQuery;
|
|
39
40
|
tslib_1.__decorate([
|
|
40
41
|
(0, type_graphql_1.Query)(returns => doc_template_1.DocTemplate, { description: 'To fetch a DocTemplate' }),
|
|
41
42
|
tslib_1.__param(0, (0, type_graphql_1.Arg)('id')),
|
|
@@ -46,7 +47,7 @@ tslib_1.__decorate([
|
|
|
46
47
|
], DocTemplateQuery.prototype, "docTemplate", null);
|
|
47
48
|
tslib_1.__decorate([
|
|
48
49
|
(0, type_graphql_1.Query)(returns => doc_template_type_1.DocTemplateList, { description: 'To fetch multiple DocTemplates' }),
|
|
49
|
-
tslib_1.__param(0, (0, type_graphql_1.Args)()),
|
|
50
|
+
tslib_1.__param(0, (0, type_graphql_1.Args)(type => shell_1.ListParam)),
|
|
50
51
|
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
|
51
52
|
tslib_1.__metadata("design:type", Function),
|
|
52
53
|
tslib_1.__metadata("design:paramtypes", [shell_1.ListParam, Object]),
|
|
@@ -73,8 +74,7 @@ tslib_1.__decorate([
|
|
|
73
74
|
tslib_1.__metadata("design:paramtypes", [doc_template_1.DocTemplate]),
|
|
74
75
|
tslib_1.__metadata("design:returntype", Promise)
|
|
75
76
|
], DocTemplateQuery.prototype, "updater", null);
|
|
76
|
-
DocTemplateQuery = tslib_1.__decorate([
|
|
77
|
+
exports.DocTemplateQuery = DocTemplateQuery = tslib_1.__decorate([
|
|
77
78
|
(0, type_graphql_1.Resolver)(doc_template_1.DocTemplate)
|
|
78
79
|
], DocTemplateQuery);
|
|
79
|
-
exports.DocTemplateQuery = DocTemplateQuery;
|
|
80
80
|
//# sourceMappingURL=doc-template-query.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"doc-template-query.js","sourceRoot":"","sources":["../../../server/service/doc-template/doc-template-query.ts"],"names":[],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"doc-template-query.js","sourceRoot":"","sources":["../../../server/service/doc-template/doc-template-query.ts"],"names":[],"mappings":";;;;AAAA,+CAA8F;AAC9F,iDAAkH;AAClH,iDAA4C;AAC5C,2DAAqD;AAErD,yDAAgD;AAChD,iDAA8C;AAGvC,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB;IAErB,AAAN,KAAK,CAAC,WAAW,CAAY,EAAU,EAAS,OAAY;QAC1D,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAChC,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,CAA0B,MAAiB,EAAS,OAAY;QAChF,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,CAAC,KAAK,EAAE,KAAK,CAAC,GAAG,MAAM,YAAY,CAAC,eAAe,EAAE,CAAA;QAC3D,OAAO,EAAE,K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AC,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;2BArCU,gBAAgB;IAD5B,IAAA,uBAAQ,EAAC,0BAAW,CAAC;GACT,gBAAgB,CAsC5B","sourcesContent":["import { Resolver, Query, FieldResolver, Root, Args, Arg, Ctx, Directive } from 'type-graphql'\nimport { ListParam, convertListParams, getRepository, getQueryBuilderFromListParams } from '@things-factory/shell'\nimport { DocTemplate } from './doc-template'\nimport { DocTemplateList } from './doc-template-type'\n\nimport { User } from '@things-factory/auth-base'\nimport { Domain } from '@things-factory/shell'\n\n@Resolver(DocTemplate)\nexport class DocTemplateQuery {\n @Query(returns => DocTemplate, { description: 'To fetch a DocTemplate' })\n async docTemplate(@Arg('id') id: string, @Ctx() context: any): Promise<DocTemplate> {\n const { domain } = context.state\n return await getRepository(DocTemplate).findOne({\n where: { domain: { id: domain.id }, id }\n })\n }\n\n @Query(returns => DocTemplateList, { description: 'To fetch multiple DocTemplates' })\n async docTemplates(@Args(type => ListParam) params: ListParam, @Ctx() context: any): Promise<DocTemplateList> {\n const { domain } = context.state\n\n const queryBuilder = getQueryBuilderFromListParams({\n domain,\n params,\n repository: await getRepository(DocTemplate),\n searchables: ['name', 'description']\n })\n\n const [items, total] = await queryBuilder.getManyAndCount()\n return { items, total }\n }\n\n @FieldResolver(type => Domain)\n async domain(@Root() docTemplate: DocTemplate): Promise<Domain> {\n return await getRepository(Domain).findOneBy({ id: docTemplate.domainId })\n }\n\n @FieldResolver(type => User)\n async creator(@Root() docTemplate: DocTemplate): Promise<User> {\n return await getRepository(User).findOneBy({ id: docTemplate.creatorId })\n }\n\n @FieldResolver(type => User)\n async updater(@Root() docTemplate: DocTemplate): Promise<User> {\n return await getRepository(User).findOneBy({ id: docTemplate.updaterId })\n }\n}\n"]}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { DocTemplate } from './doc-template';
|
|
2
|
+
export declare class NewDocTemplate {
|
|
3
|
+
name: string;
|
|
4
|
+
description: string;
|
|
5
|
+
jobType?: string;
|
|
6
|
+
jobClass?: string;
|
|
7
|
+
jobCategory?: string;
|
|
8
|
+
template?: string;
|
|
9
|
+
logic?: string;
|
|
10
|
+
activeFlag?: boolean;
|
|
11
|
+
note?: string;
|
|
12
|
+
}
|
|
13
|
+
export declare class DocTemplatePatch {
|
|
14
|
+
id?: string;
|
|
15
|
+
name?: string;
|
|
16
|
+
description?: string;
|
|
17
|
+
jobType?: string;
|
|
18
|
+
jobClass?: string;
|
|
19
|
+
jobCategory?: string;
|
|
20
|
+
template?: string;
|
|
21
|
+
logic?: string;
|
|
22
|
+
activeFlag?: boolean;
|
|
23
|
+
note?: string;
|
|
24
|
+
cuFlag: string;
|
|
25
|
+
}
|
|
26
|
+
export declare class DocTemplateList {
|
|
27
|
+
items: DocTemplate[];
|
|
28
|
+
total: number;
|
|
29
|
+
}
|
|
@@ -6,6 +6,7 @@ const type_graphql_1 = require("type-graphql");
|
|
|
6
6
|
const doc_template_1 = require("./doc-template");
|
|
7
7
|
let NewDocTemplate = class NewDocTemplate {
|
|
8
8
|
};
|
|
9
|
+
exports.NewDocTemplate = NewDocTemplate;
|
|
9
10
|
tslib_1.__decorate([
|
|
10
11
|
(0, type_graphql_1.Field)({ nullable: false }),
|
|
11
12
|
tslib_1.__metadata("design:type", String)
|
|
@@ -42,12 +43,12 @@ tslib_1.__decorate([
|
|
|
42
43
|
(0, type_graphql_1.Field)({ nullable: true }),
|
|
43
44
|
tslib_1.__metadata("design:type", String)
|
|
44
45
|
], NewDocTemplate.prototype, "note", void 0);
|
|
45
|
-
NewDocTemplate = tslib_1.__decorate([
|
|
46
|
+
exports.NewDocTemplate = NewDocTemplate = tslib_1.__decorate([
|
|
46
47
|
(0, type_graphql_1.InputType)()
|
|
47
48
|
], NewDocTemplate);
|
|
48
|
-
exports.NewDocTemplate = NewDocTemplate;
|
|
49
49
|
let DocTemplatePatch = class DocTemplatePatch {
|
|
50
50
|
};
|
|
51
|
+
exports.DocTemplatePatch = DocTemplatePatch;
|
|
51
52
|
tslib_1.__decorate([
|
|
52
53
|
(0, type_graphql_1.Field)(type => type_graphql_1.ID, { nullable: true }),
|
|
53
54
|
tslib_1.__metadata("design:type", String)
|
|
@@ -92,12 +93,12 @@ tslib_1.__decorate([
|
|
|
92
93
|
(0, type_graphql_1.Field)(),
|
|
93
94
|
tslib_1.__metadata("design:type", String)
|
|
94
95
|
], DocTemplatePatch.prototype, "cuFlag", void 0);
|
|
95
|
-
DocTemplatePatch = tslib_1.__decorate([
|
|
96
|
+
exports.DocTemplatePatch = DocTemplatePatch = tslib_1.__decorate([
|
|
96
97
|
(0, type_graphql_1.InputType)()
|
|
97
98
|
], DocTemplatePatch);
|
|
98
|
-
exports.DocTemplatePatch = DocTemplatePatch;
|
|
99
99
|
let DocTemplateList = class DocTemplateList {
|
|
100
100
|
};
|
|
101
|
+
exports.DocTemplateList = DocTemplateList;
|
|
101
102
|
tslib_1.__decorate([
|
|
102
103
|
(0, type_graphql_1.Field)(type => [doc_template_1.DocTemplate]),
|
|
103
104
|
tslib_1.__metadata("design:type", Array)
|
|
@@ -106,8 +107,7 @@ tslib_1.__decorate([
|
|
|
106
107
|
(0, type_graphql_1.Field)(type => type_graphql_1.Int),
|
|
107
108
|
tslib_1.__metadata("design:type", Number)
|
|
108
109
|
], DocTemplateList.prototype, "total", void 0);
|
|
109
|
-
DocTemplateList = tslib_1.__decorate([
|
|
110
|
+
exports.DocTemplateList = DocTemplateList = tslib_1.__decorate([
|
|
110
111
|
(0, type_graphql_1.ObjectType)()
|
|
111
112
|
], DocTemplateList);
|
|
112
|
-
exports.DocTemplateList = DocTemplateList;
|
|
113
113
|
//# sourceMappingURL=doc-template-type.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"doc-template-type.js","sourceRoot":"","sources":["../../../server/service/doc-template/doc-template-type.ts"],"names":[],"mappings":";;;;AACA,+CAA6F;AAE7F,iDAA4C;AAGrC,IAAM,cAAc,GAApB,MAAM,cAAc;CA4B1B,CAAA;
|
|
1
|
+
{"version":3,"file":"doc-template-type.js","sourceRoot":"","sources":["../../../server/service/doc-template/doc-template-type.ts"],"names":[],"mappings":";;;;AACA,+CAA6F;AAE7F,iDAA4C;AAGrC,IAAM,cAAc,GAApB,MAAM,cAAc;CA4B1B,CAAA;AA5BY,wCAAc;AAGzB;IADC,IAAA,oBAAK,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;;4CAChB;AAGZ;IADC,IAAA,oBAAK,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;;mDACT;AAGnB;IADC,IAAA,oBAAK,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;+CACX;AAGhB;IADC,IAAA,oBAAK,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;gDACV;AAGjB;IADC,IAAA,oBAAK,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;mDACP;AAGpB;IADC,IAAA,oBAAK,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;gDACV;AAGjB;IADC,IAAA,oBAAK,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;6CACb;AAGd;IADC,IAAA,oBAAK,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;kDACP;AAGpB;IADC,IAAA,oBAAK,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;4CACd;yBA3BF,cAAc;IAD1B,IAAA,wBAAS,GAAE;GACC,cAAc,CA4B1B;AAGM,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB;CAiC5B,CAAA;AAjCY,4CAAgB;AAE3B;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,iBAAE,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;4CAC3B;AAGX;IADC,IAAA,oBAAK,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;8CACd;AAGb;IADC,IAAA,oBAAK,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;qDACP;AAGpB;IADC,IAAA,oBAAK,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;iDACX;AAGhB;IADC,IAAA,oBAAK,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;kDACV;AAGjB;IADC,IAAA,oBAAK,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;qDACP;AAGpB;IADC,IAAA,oBAAK,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;kDACV;AAGjB;IADC,IAAA,oBAAK,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;+CACb;AAGd;IADC,IAAA,oBAAK,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;oDACP;AAGpB;IADC,IAAA,oBAAK,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;8CACd;AAGb;IADC,IAAA,oBAAK,GAAE;;gDACM;2BAhCH,gBAAgB;IAD5B,IAAA,wBAAS,GAAE;GACC,gBAAgB,CAiC5B;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":["\nimport { ObjectType, Field, InputType, Int, ID, Float, registerEnumType } from 'type-graphql'\nimport { ObjectRef } from '@things-factory/shell'\nimport { DocTemplate } from './doc-template'\n\n@InputType()\nexport class NewDocTemplate {\n\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 template?: string\n\n @Field( { nullable: true })\n logic?: string\n\n @Field( { nullable: true })\n activeFlag?: boolean\n\n @Field( { nullable: true })\n note?: string\n}\n\n@InputType()\nexport class DocTemplatePatch {\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 template?: string\n\n @Field( { nullable: true })\n logic?: string\n\n @Field( { nullable: true })\n activeFlag?: boolean\n\n @Field( { nullable: true })\n note?: string\n\n @Field()\n cuFlag: string\n}\n\n@ObjectType()\nexport class DocTemplateList {\n @Field(type => [DocTemplate])\n items: DocTemplate[]\n\n @Field(type => Int)\n total: number\n}\n"]}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { User } from '@things-factory/auth-base';
|
|
2
|
+
import { Domain } from '@things-factory/shell';
|
|
3
|
+
export declare class DocTemplate {
|
|
4
|
+
readonly id: string;
|
|
5
|
+
name: string;
|
|
6
|
+
description: string;
|
|
7
|
+
jobType?: string;
|
|
8
|
+
jobClass?: string;
|
|
9
|
+
jobCategory?: string;
|
|
10
|
+
template?: string;
|
|
11
|
+
logic?: string;
|
|
12
|
+
activeFlag?: boolean;
|
|
13
|
+
note?: string;
|
|
14
|
+
domain: Domain;
|
|
15
|
+
domainId: string;
|
|
16
|
+
creator?: User;
|
|
17
|
+
creatorId?: string;
|
|
18
|
+
updater?: User;
|
|
19
|
+
updaterId?: string;
|
|
20
|
+
createdAt?: Date;
|
|
21
|
+
updatedAt?: Date;
|
|
22
|
+
}
|
|
@@ -8,6 +8,7 @@ const auth_base_1 = require("@things-factory/auth-base");
|
|
|
8
8
|
const shell_1 = require("@things-factory/shell");
|
|
9
9
|
let DocTemplate = class DocTemplate {
|
|
10
10
|
};
|
|
11
|
+
exports.DocTemplate = DocTemplate;
|
|
11
12
|
tslib_1.__decorate([
|
|
12
13
|
(0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
|
|
13
14
|
(0, type_graphql_1.Field)(type => type_graphql_1.ID),
|
|
@@ -69,7 +70,7 @@ tslib_1.__decorate([
|
|
|
69
70
|
], DocTemplate.prototype, "domainId", void 0);
|
|
70
71
|
tslib_1.__decorate([
|
|
71
72
|
(0, typeorm_1.ManyToOne)(type => auth_base_1.User, { createForeignKeyConstraints: false, nullable: true }),
|
|
72
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
|
73
|
+
(0, type_graphql_1.Field)(type => auth_base_1.User, { nullable: true }),
|
|
73
74
|
tslib_1.__metadata("design:type", auth_base_1.User)
|
|
74
75
|
], DocTemplate.prototype, "creator", void 0);
|
|
75
76
|
tslib_1.__decorate([
|
|
@@ -78,7 +79,7 @@ tslib_1.__decorate([
|
|
|
78
79
|
], DocTemplate.prototype, "creatorId", void 0);
|
|
79
80
|
tslib_1.__decorate([
|
|
80
81
|
(0, typeorm_1.ManyToOne)(type => auth_base_1.User, { createForeignKeyConstraints: false, nullable: true }),
|
|
81
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
|
82
|
+
(0, type_graphql_1.Field)(type => auth_base_1.User, { nullable: true }),
|
|
82
83
|
tslib_1.__metadata("design:type", auth_base_1.User)
|
|
83
84
|
], DocTemplate.prototype, "updater", void 0);
|
|
84
85
|
tslib_1.__decorate([
|
|
@@ -95,11 +96,10 @@ tslib_1.__decorate([
|
|
|
95
96
|
(0, type_graphql_1.Field)({ nullable: true }),
|
|
96
97
|
tslib_1.__metadata("design:type", Date)
|
|
97
98
|
], DocTemplate.prototype, "updatedAt", void 0);
|
|
98
|
-
DocTemplate = tslib_1.__decorate([
|
|
99
|
+
exports.DocTemplate = DocTemplate = tslib_1.__decorate([
|
|
99
100
|
(0, typeorm_1.Entity)('doc_templates'),
|
|
100
101
|
(0, typeorm_1.Index)('ix_doc_template_0', (docTemplate) => [docTemplate.domain, docTemplate.name], { unique: true }),
|
|
101
102
|
(0, typeorm_1.Index)('ix_doc_template_1', (docTemplate) => [docTemplate.domain, docTemplate.activeFlag]),
|
|
102
103
|
(0, type_graphql_1.ObjectType)({ description: 'Entity for DocTemplate' })
|
|
103
104
|
], DocTemplate);
|
|
104
|
-
exports.DocTemplate = DocTemplate;
|
|
105
105
|
//# sourceMappingURL=doc-template.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"doc-template.js","sourceRoot":"","sources":["../../../server/service/doc-template/doc-template.ts"],"names":[],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"doc-template.js","sourceRoot":"","sources":["../../../server/service/doc-template/doc-template.ts"],"names":[],"mappings":";;;;AAAA,qCASgB;AAChB,+CAAkF;AAElF,yDAAgD;AAChD,iDAA8C;AAMvC,IAAM,WAAW,GAAjB,MAAM,WAAW;CAqEvB,CAAA;AArEY,kCAAW;AAGb;IAFR,IAAA,gCAAsB,EAAC,MAAM,CAAC;IAC9B,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,iBAAE,CAAC;;uCACC;AAInB;IAFC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;IACzC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;;yCACf;AAIZ;IAFC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;IAChD,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;;gDACR;AAInB;IAFC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,U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;IACvB,IAAA,eAAK,EAAC,mBAAmB,EAAE,CAAC,WAAwB,EAAE,EAAE,CAAC,CAAC,WAAW,CAAC,MAAM,EAAE,WAAW,CAAC,IAAI,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;IAClH,IAAA,eAAK,EAAC,mBAAmB,EAAE,CAAC,WAAwB,EAAE,EAAE,CAAC,CAAC,WAAW,CAAC,MAAM,EAAE,WAAW,CAAC,UAAU,CAAC,CAAC;IACtG,IAAA,yBAAU,EAAC,EAAE,WAAW,EAAE,wBAAwB,EAAE,CAAC;GACzC,WAAW,CAqEvB","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, Float, registerEnumType } from 'type-graphql'\n\nimport { User } from '@things-factory/auth-base'\nimport { Domain } from '@things-factory/shell'\n\n@Entity('doc_templates')\n@Index('ix_doc_template_0', (docTemplate: DocTemplate) => [docTemplate.domain, docTemplate.name], { unique: true })\n@Index('ix_doc_template_1', (docTemplate: DocTemplate) => [docTemplate.domain, docTemplate.activeFlag])\n@ObjectType({ description: 'Entity for DocTemplate' })\nexport class DocTemplate {\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: 'template', type: 'text', nullable: true })\n @Field({ nullable: true })\n template?: string\n\n @Column({ name: 'logic', type: 'text', nullable: true })\n @Field({ nullable: true })\n logic?: 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 => Domain, { createForeignKeyConstraints: false, nullable: false })\n @Field({ nullable: false })\n domain: Domain\n\n @RelationId((docTemplate: DocTemplate) => docTemplate.domain)\n domainId: string\n\n @ManyToOne(type => User, { createForeignKeyConstraints: false, nullable: true })\n @Field(type => User, { nullable: true })\n creator?: User\n\n @RelationId((docTemplate: DocTemplate) => docTemplate.creator)\n creatorId?: string\n\n @ManyToOne(type => User, { createForeignKeyConstraints: false, nullable: true })\n @Field(type => User, { nullable: true })\n updater?: User\n\n @RelationId((docTemplate: DocTemplate) => docTemplate.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"]}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { DocTemplate } from './doc-template';
|
|
2
|
+
import { DocTemplateQuery } from './doc-template-query';
|
|
3
|
+
import { DocTemplateMutation } from './doc-template-mutation';
|
|
4
|
+
export declare const entities: (typeof DocTemplate)[];
|
|
5
|
+
export declare const resolvers: (typeof DocTemplateQuery | typeof DocTemplateMutation)[];
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export * from './doc-template/doc-template';
|
|
2
|
+
export * from './template-file/template-file';
|
|
3
|
+
export declare const entities: (typeof import("./doc-template/doc-template").DocTemplate | typeof import("./template-file/template-file").TemplateFile)[];
|
|
4
|
+
export declare const schema: {
|
|
5
|
+
resolverClasses: (typeof import("./doc-template/doc-template-query").DocTemplateQuery | typeof import("./doc-template/doc-template-mutation").DocTemplateMutation | typeof import("./template-file/template-file-query").TemplateFileQuery | typeof import("./template-file/template-file-mutation").TemplateFileMutation)[];
|
|
6
|
+
};
|
|
7
|
+
export declare const subscribers: any[];
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { TemplateFile } from './template-file';
|
|
2
|
+
import { TemplateFileQuery } from './template-file-query';
|
|
3
|
+
import { TemplateFileMutation } from './template-file-mutation';
|
|
4
|
+
export declare const entities: (typeof TemplateFile)[];
|
|
5
|
+
export declare const resolvers: (typeof TemplateFileQuery | typeof TemplateFileMutation)[];
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { TemplateFile } from './template-file';
|
|
2
|
+
import { NewTemplateFile, TemplateFilePatch } from './template-file-type';
|
|
3
|
+
export declare class TemplateFileMutation {
|
|
4
|
+
createTemplateFile(templateFile: NewTemplateFile, context: any): Promise<TemplateFile>;
|
|
5
|
+
updateTemplateFile(id: string, patch: TemplateFilePatch, context: any): Promise<TemplateFile>;
|
|
6
|
+
updateMultipleTemplateFile(patches: TemplateFilePatch[], context: any): Promise<TemplateFile[]>;
|
|
7
|
+
deleteTemplateFile(id: string, context: any): Promise<boolean>;
|
|
8
|
+
deleteTemplateFiles(ids: string[], context: any): Promise<boolean>;
|
|
9
|
+
}
|
|
@@ -59,6 +59,7 @@ let TemplateFileMutation = class TemplateFileMutation {
|
|
|
59
59
|
return true;
|
|
60
60
|
}
|
|
61
61
|
};
|
|
62
|
+
exports.TemplateFileMutation = TemplateFileMutation;
|
|
62
63
|
tslib_1.__decorate([
|
|
63
64
|
(0, type_graphql_1.Directive)('@transaction'),
|
|
64
65
|
(0, type_graphql_1.Mutation)(returns => template_file_1.TemplateFile, { description: 'To create new TemplateFile' }),
|
|
@@ -105,8 +106,7 @@ tslib_1.__decorate([
|
|
|
105
106
|
tslib_1.__metadata("design:paramtypes", [Array, Object]),
|
|
106
107
|
tslib_1.__metadata("design:returntype", Promise)
|
|
107
108
|
], TemplateFileMutation.prototype, "deleteTemplateFiles", null);
|
|
108
|
-
TemplateFileMutation = tslib_1.__decorate([
|
|
109
|
+
exports.TemplateFileMutation = TemplateFileMutation = tslib_1.__decorate([
|
|
109
110
|
(0, type_graphql_1.Resolver)(template_file_1.TemplateFile)
|
|
110
111
|
], TemplateFileMutation);
|
|
111
|
-
exports.TemplateFileMutation = TemplateFileMutation;
|
|
112
112
|
//# sourceMappingURL=template-file-mutation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"template-file-mutation.js","sourceRoot":"","sources":["../../../server/service/template-file/template-file-mutation.ts"],"names":[],"mappings":";;;;AACA,+CAAsE;AACtE,mDAA8C;AAC9C,6DAAyE;AAGlE,IAAM,oBAAoB,GAA1B,MAAM,oBAAoB;IAGzB,AAAN,KAAK,CAAC,kBAAkB,CAAsB,YAA6B,EAAS,OAAY;QAC9F,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAE1C,OAAO,MAAM,EAAE,CAAC,aAAa,CAAC,4BAAY,CAAC,CAAC,IAAI,iCAC3C,YAAY,KACf,MAAM,EACN,OAAO,EAAE,IAAI,EACb,OAAO,EAAE,IAAI,IACb,CAAA;IACJ,CAAC;IAIK,AAAN,KAAK,CAAC,kBAAkB,CACX,EAAU,EACP,KAAwB,EAC/B,OAAY;QAEnB,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAE1C,MAAM,UAAU,GAAG,EAAE,CAAC,aAAa,CAAC,4BAAY,CAAC,CAAA;QACjD,MAAM,YAAY,GAAG,MAAM,UAAU,CAAC,OAAO,CAC3C;YACE,KAAK,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,MAAM,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE;YACxC,SAAS,EAAE,CAAC,QAAQ,EAAC,SAAS,EAAC,SAAS,EAAC,YAAY,CAAC;SACvD,CACF,CAAA;QAED,OAAO,MAAM,UAAU,CAAC,IAAI,+CACvB,YAAY,GACZ,KAAK,KACR,OAAO,EAAE,IAAI,IACb,CAAA;IACJ,CAAC;IAIK,AAAN,KAAK,CAAC,0BAA0B,CACe,OAA4B,EAClE,OAAY;QAEnB,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAE1C,IAAI,OAAO,GAAG,EAAE,CAAA;QAChB,MAAM,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,KAAU,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,WAAW,EAAE,KAAK,GAAG,CAAC,CAAA;QACzF,MAAM,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,KAAU,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,WAAW,EAAE,KAAK,GAAG,CAAC,CAAA;QACzF,MAAM,gBAAgB,GAAG,EAAE,CAAC,aAAa,CAAC,4BAAY,CAAC,CAAA;QAEvD,IAAI,cAAc,CAAC,MAAM,GAAG,CAAC,EAAE;
|
|
1
|
+
{"version":3,"file":"template-file-mutation.js","sourceRoot":"","sources":["../../../server/service/template-file/template-file-mutation.ts"],"names":[],"mappings":";;;;AACA,+CAAsE;AACtE,mDAA8C;AAC9C,6DAAyE;AAGlE,IAAM,oBAAoB,GAA1B,MAAM,oBAAoB;IAGzB,AAAN,KAAK,CAAC,kBAAkB,CAAsB,YAA6B,EAAS,OAAY;QAC9F,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAE1C,OAAO,MAAM,EAAE,CAAC,aAAa,CAAC,4BAAY,CAAC,CAAC,IAAI,iCAC3C,YAAY,KACf,MAAM,EACN,OAAO,EAAE,IAAI,EACb,OAAO,EAAE,IAAI,IACb,CAAA;IACJ,CAAC;IAIK,AAAN,KAAK,CAAC,kBAAkB,CACX,EAAU,EACP,KAAwB,EAC/B,OAAY;QAEnB,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAE1C,MAAM,UAAU,GAAG,EAAE,CAAC,aAAa,CAAC,4BAAY,CAAC,CAAA;QACjD,MAAM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;IAFL,IAAA,wBAAS,EAAC,cAAc,CAAC;IACzB,IAAA,uBAAQ,EAAC,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,WAAW,EAAE,wBAAwB,EAAE,CAAC;IAC9C,mBAAA,IAAA,kBAAG,EAAC,IAAI,CAAC,CAAA;IAAc,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;8DAIrD;AAIK;IAFL,IAAA,wBAAS,EAAC,cAAc,CAAC;IACzB,IAAA,uBAAQ,EAAC,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,WAAW,EAAE,kCAAkC,EAAE,CAAC;IAE/E,mBAAA,IAAA,kBAAG,EAAC,KAAK,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAA;IAC5B,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;+DAUP;+BA7GU,oBAAoB;IADhC,IAAA,uBAAQ,EAAC,4BAAY,CAAC;GACV,oBAAoB,CA8GhC","sourcesContent":["\nimport { Resolver, Mutation, 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,14 @@
|
|
|
1
|
+
import { ListParam } from '@things-factory/shell';
|
|
2
|
+
import { TemplateFile } from './template-file';
|
|
3
|
+
import { TemplateFileList } from './template-file-type';
|
|
4
|
+
import { User } from '@things-factory/auth-base';
|
|
5
|
+
import { Domain } from '@things-factory/shell';
|
|
6
|
+
import { Attachment } from '@things-factory/attachment-base';
|
|
7
|
+
export declare class TemplateFileQuery {
|
|
8
|
+
templateFile(id: string, context: any): Promise<TemplateFile>;
|
|
9
|
+
templateFiles(params: ListParam, context: any): Promise<TemplateFileList>;
|
|
10
|
+
attachment(templateFile: TemplateFile): Promise<Attachment>;
|
|
11
|
+
domain(templateFile: TemplateFile): Promise<Domain>;
|
|
12
|
+
creator(templateFile: TemplateFile): Promise<User>;
|
|
13
|
+
updater(templateFile: TemplateFile): Promise<User>;
|
|
14
|
+
}
|
|
@@ -40,6 +40,7 @@ let TemplateFileQuery = class TemplateFileQuery {
|
|
|
40
40
|
return await (0, shell_1.getRepository)(auth_base_1.User).findOneBy({ id: templateFile.updaterId });
|
|
41
41
|
}
|
|
42
42
|
};
|
|
43
|
+
exports.TemplateFileQuery = TemplateFileQuery;
|
|
43
44
|
tslib_1.__decorate([
|
|
44
45
|
(0, type_graphql_1.Query)(returns => template_file_1.TemplateFile, { description: 'To fetch a TemplateFile' }),
|
|
45
46
|
tslib_1.__param(0, (0, type_graphql_1.Arg)('id')),
|
|
@@ -50,7 +51,7 @@ tslib_1.__decorate([
|
|
|
50
51
|
], TemplateFileQuery.prototype, "templateFile", null);
|
|
51
52
|
tslib_1.__decorate([
|
|
52
53
|
(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(0, (0, type_graphql_1.Args)(type => shell_1.ListParam)),
|
|
54
55
|
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
|
55
56
|
tslib_1.__metadata("design:type", Function),
|
|
56
57
|
tslib_1.__metadata("design:paramtypes", [shell_1.ListParam, Object]),
|
|
@@ -84,8 +85,7 @@ tslib_1.__decorate([
|
|
|
84
85
|
tslib_1.__metadata("design:paramtypes", [template_file_1.TemplateFile]),
|
|
85
86
|
tslib_1.__metadata("design:returntype", Promise)
|
|
86
87
|
], TemplateFileQuery.prototype, "updater", null);
|
|
87
|
-
TemplateFileQuery = tslib_1.__decorate([
|
|
88
|
+
exports.TemplateFileQuery = TemplateFileQuery = tslib_1.__decorate([
|
|
88
89
|
(0, type_graphql_1.Resolver)(template_file_1.TemplateFile)
|
|
89
90
|
], TemplateFileQuery);
|
|
90
|
-
exports.TemplateFileQuery = TemplateFileQuery;
|
|
91
91
|
//# sourceMappingURL=template-file-query.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"template-file-query.js","sourceRoot":"","sources":["../../../server/service/template-file/template-file-query.ts"],"names":[],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"template-file-query.js","sourceRoot":"","sources":["../../../server/service/template-file/template-file-query.ts"],"names":[],"mappings":";;;;AAAA,+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,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAChC,OAAO,MAAM,IAAA,qBAAa,EAAC,4BAAY,CAAC,CAAC,OAAO,CAAC;YAC/C,KAAK,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,MAAM,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE;SACzC,CAAC,CAAA;IACJ,CAAC;IAGK,AAAN,KAAK,CAAC,aAAa,CAA0B,MAAiB,EAAS,OAAY;QACjF,MA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E,yBAAyB,EAAE,CAAC;IACvD,mBAAA,IAAA,kBAAG,EAAC,IAAI,CAAC,CAAA;IAAc,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;qDAK/C;AAGK;IADL,IAAA,oBAAK,EAAC,OAAO,CAAC,EAAE,CAAC,qCAAgB,EAAE,EAAE,WAAW,EAAE,iCAAiC,EAAE,CAAC;IAClE,mBAAA,IAAA,mBAAI,EAAC,IAAI,CAAC,EAAE,CAAC,iBAAS,CAAC,CAAA;IAAqB,mBAAA,IAAA,kBAAG,GAAE,CAAA;;6CAAjB,iBAAS;;sDAY7D;AAGK;IADL,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,4BAAU,CAAC;IAChB,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAe,4BAAY;;mDAElD;AAGK;IADL,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,cAAM,CAAC;IAChB,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAe,4BAAY;;+CAE9C;AAGK;IADL,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,CAAC;IACb,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAe,4BAAY;;gDAE/C;AAGK;IADL,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,CAAC;IACb,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAe,4BAAY;;gDAE/C;4BA1CU,iBAAiB;IAD7B,IAAA,uBAAQ,EAAC,4BAAY,CAAC;GACV,iBAAiB,CA2C7B","sourcesContent":["import { 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(type => ListParam) 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"]}
|