@things-factory/document-template-base 9.0.0-beta.8 → 9.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist-server/service/doc-template/doc-template-mutation.js +24 -6
- package/dist-server/service/doc-template/doc-template-mutation.js.map +1 -1
- package/dist-server/service/template-file/template-file-mutation.js +24 -6
- package/dist-server/service/template-file/template-file-mutation.js.map +1 -1
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/package.json +5 -5
|
@@ -8,7 +8,12 @@ const doc_template_type_1 = require("./doc-template-type");
|
|
|
8
8
|
let DocTemplateMutation = class DocTemplateMutation {
|
|
9
9
|
async createDocTemplate(docTemplate, context) {
|
|
10
10
|
const { domain, user, tx } = context.state;
|
|
11
|
-
return await tx.getRepository(doc_template_1.DocTemplate).save(
|
|
11
|
+
return await tx.getRepository(doc_template_1.DocTemplate).save({
|
|
12
|
+
...docTemplate,
|
|
13
|
+
domain,
|
|
14
|
+
creator: user,
|
|
15
|
+
updater: user
|
|
16
|
+
});
|
|
12
17
|
}
|
|
13
18
|
async updateDocTemplate(id, patch, context) {
|
|
14
19
|
const { domain, user, tx } = context.state;
|
|
@@ -17,7 +22,11 @@ let DocTemplateMutation = class DocTemplateMutation {
|
|
|
17
22
|
where: { domain: { id: domain.id }, id },
|
|
18
23
|
relations: ['domain', 'updater', 'creator']
|
|
19
24
|
});
|
|
20
|
-
return await repository.save(
|
|
25
|
+
return await repository.save({
|
|
26
|
+
...docTemplate,
|
|
27
|
+
...patch,
|
|
28
|
+
updater: user
|
|
29
|
+
});
|
|
21
30
|
}
|
|
22
31
|
async updateMultipleDocTemplate(patches, context) {
|
|
23
32
|
const { domain, user, tx } = context.state;
|
|
@@ -28,8 +37,13 @@ let DocTemplateMutation = class DocTemplateMutation {
|
|
|
28
37
|
if (_createRecords.length > 0) {
|
|
29
38
|
for (let i = 0; i < _createRecords.length; i++) {
|
|
30
39
|
const newRecord = _createRecords[i];
|
|
31
|
-
const result = await docTemplateRepo.save(
|
|
32
|
-
|
|
40
|
+
const result = await docTemplateRepo.save({
|
|
41
|
+
...newRecord,
|
|
42
|
+
domain,
|
|
43
|
+
creator: user,
|
|
44
|
+
updater: user
|
|
45
|
+
});
|
|
46
|
+
results.push({ ...result, cuFlag: '+' });
|
|
33
47
|
}
|
|
34
48
|
}
|
|
35
49
|
if (_updateRecords.length > 0) {
|
|
@@ -39,8 +53,12 @@ let DocTemplateMutation = class DocTemplateMutation {
|
|
|
39
53
|
where: { domain: { id: domain.id }, id: updRecord.id },
|
|
40
54
|
relations: ['domain', 'updater', 'creator']
|
|
41
55
|
});
|
|
42
|
-
const result = await docTemplateRepo.save(
|
|
43
|
-
|
|
56
|
+
const result = await docTemplateRepo.save({
|
|
57
|
+
...docTemplate,
|
|
58
|
+
...updRecord,
|
|
59
|
+
updater: user
|
|
60
|
+
});
|
|
61
|
+
results.push({ ...result, cuFlag: 'M' });
|
|
44
62
|
}
|
|
45
63
|
}
|
|
46
64
|
return results;
|
|
@@ -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,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,
|
|
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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AC;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"]}
|
|
@@ -8,7 +8,12 @@ const template_file_type_1 = require("./template-file-type");
|
|
|
8
8
|
let TemplateFileMutation = class TemplateFileMutation {
|
|
9
9
|
async createTemplateFile(templateFile, context) {
|
|
10
10
|
const { domain, user, tx } = context.state;
|
|
11
|
-
return await tx.getRepository(template_file_1.TemplateFile).save(
|
|
11
|
+
return await tx.getRepository(template_file_1.TemplateFile).save({
|
|
12
|
+
...templateFile,
|
|
13
|
+
domain,
|
|
14
|
+
creator: user,
|
|
15
|
+
updater: user
|
|
16
|
+
});
|
|
12
17
|
}
|
|
13
18
|
async updateTemplateFile(id, patch, context) {
|
|
14
19
|
const { domain, user, tx } = context.state;
|
|
@@ -17,7 +22,11 @@ let TemplateFileMutation = class TemplateFileMutation {
|
|
|
17
22
|
where: { domain: { id: domain.id }, id },
|
|
18
23
|
relations: ['domain', 'updater', 'creator', 'attachment']
|
|
19
24
|
});
|
|
20
|
-
return await repository.save(
|
|
25
|
+
return await repository.save({
|
|
26
|
+
...templateFile,
|
|
27
|
+
...patch,
|
|
28
|
+
updater: user
|
|
29
|
+
});
|
|
21
30
|
}
|
|
22
31
|
async updateMultipleTemplateFile(patches, context) {
|
|
23
32
|
const { domain, user, tx } = context.state;
|
|
@@ -28,8 +37,13 @@ let TemplateFileMutation = class TemplateFileMutation {
|
|
|
28
37
|
if (_createRecords.length > 0) {
|
|
29
38
|
for (let i = 0; i < _createRecords.length; i++) {
|
|
30
39
|
const newRecord = _createRecords[i];
|
|
31
|
-
const result = await templateFileRepo.save(
|
|
32
|
-
|
|
40
|
+
const result = await templateFileRepo.save({
|
|
41
|
+
...newRecord,
|
|
42
|
+
domain,
|
|
43
|
+
creator: user,
|
|
44
|
+
updater: user
|
|
45
|
+
});
|
|
46
|
+
results.push({ ...result, cuFlag: '+' });
|
|
33
47
|
}
|
|
34
48
|
}
|
|
35
49
|
if (_updateRecords.length > 0) {
|
|
@@ -39,8 +53,12 @@ let TemplateFileMutation = class TemplateFileMutation {
|
|
|
39
53
|
where: { domain: { id: domain.id }, id: updRecord.id },
|
|
40
54
|
relations: ['domain', 'updater', 'creator', 'attachment']
|
|
41
55
|
});
|
|
42
|
-
const result = await templateFileRepo.save(
|
|
43
|
-
|
|
56
|
+
const result = await templateFileRepo.save({
|
|
57
|
+
...templateFile,
|
|
58
|
+
...updRecord,
|
|
59
|
+
updater: user
|
|
60
|
+
});
|
|
61
|
+
results.push({ ...result, cuFlag: 'M' });
|
|
44
62
|
}
|
|
45
63
|
}
|
|
46
64
|
return results;
|
|
@@ -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,
|
|
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,CAAC;YAC/C,GAAG,YAAY;YACf,MAAM;YACN,OAAO,EAAE,IAAI;YACb,OAAO,EAAE,IAAI;SACd,CAAC,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,CA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BAAG,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"]}
|