@things-factory/resource-base 6.0.0-alpha.20 → 6.0.0-alpha.21
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/entity/entity-mutation.js +19 -38
- package/dist-server/service/entity/entity-mutation.js.map +1 -1
- package/dist-server/service/entity-column/entity-column-mutation.js +6 -6
- package/dist-server/service/entity-column/entity-column-mutation.js.map +1 -1
- package/dist-server/service/entity-column/entity-column-type.js +3 -2
- package/dist-server/service/entity-column/entity-column-type.js.map +1 -1
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -3
- package/server/service/entity/entity-mutation.ts +18 -37
- package/server/service/entity-column/entity-column-mutation.ts +8 -5
- package/server/service/entity-column/entity-column-type.ts +3 -3
|
@@ -2,10 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.EntityMutation = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
-
const del_strategy_type_1 = require("../../constants/del-strategy-type");
|
|
6
5
|
const type_graphql_1 = require("type-graphql");
|
|
7
6
|
const typeorm_1 = require("typeorm");
|
|
8
|
-
const entity_column_1 = require("../entity-column/entity-column");
|
|
9
7
|
const entity_1 = require("./entity");
|
|
10
8
|
const entity_type_1 = require("./entity-type");
|
|
11
9
|
let EntityMutation = class EntityMutation {
|
|
@@ -73,13 +71,29 @@ let EntityMutation = class EntityMutation {
|
|
|
73
71
|
}
|
|
74
72
|
async deleteEntity(id, context) {
|
|
75
73
|
const { domain, tx } = context.state;
|
|
76
|
-
|
|
74
|
+
const entityRepo = tx.getRepository(entity_1.Entity);
|
|
75
|
+
const entity = await entityRepo.findOne({
|
|
76
|
+
where: { domain: { id: domain.id }, id },
|
|
77
|
+
relations: ['columns']
|
|
78
|
+
});
|
|
79
|
+
if (entity.columns.length)
|
|
80
|
+
throw new Error('cannot delete Entity because columns of entity exists');
|
|
81
|
+
else
|
|
82
|
+
await entityRepo.delete(entity.id);
|
|
77
83
|
return true;
|
|
78
84
|
}
|
|
79
85
|
async deleteEntities(ids, context) {
|
|
80
86
|
const { domain, tx } = context.state;
|
|
81
|
-
|
|
82
|
-
|
|
87
|
+
const entityRepo = tx.getRepository(entity_1.Entity);
|
|
88
|
+
for (const id of ids) {
|
|
89
|
+
const entity = await entityRepo.findOne({
|
|
90
|
+
where: { domain: { id: domain.id }, id },
|
|
91
|
+
relations: ['columns']
|
|
92
|
+
});
|
|
93
|
+
if (entity.columns.length)
|
|
94
|
+
throw new Error('cannot delete Entity because columns of entity exists');
|
|
95
|
+
else
|
|
96
|
+
await entityRepo.delete(entity.id);
|
|
83
97
|
}
|
|
84
98
|
return true;
|
|
85
99
|
}
|
|
@@ -134,37 +148,4 @@ EntityMutation = tslib_1.__decorate([
|
|
|
134
148
|
(0, type_graphql_1.Resolver)(entity_1.Entity)
|
|
135
149
|
], EntityMutation);
|
|
136
150
|
exports.EntityMutation = EntityMutation;
|
|
137
|
-
async function deleteEntityAndEntityColumns(id, domain, tx) {
|
|
138
|
-
const entity = tx.getRepository(entity_1.Entity).findOne({ domain: { id: domain.id }, id });
|
|
139
|
-
const columns = tx
|
|
140
|
-
.getRepository(entity_column_1.EntityColumn)
|
|
141
|
-
.find({ where: { entity: { id: entity.id }, domain: { id: domain.id } }, relations: ['entity'] });
|
|
142
|
-
if (columns && columns.length)
|
|
143
|
-
await tx.getRepository(entity_column_1.EntityColumn).delete(columns);
|
|
144
|
-
await tx.getRepository(entity_1.Entity).delete(entity);
|
|
145
|
-
}
|
|
146
|
-
async function deleteEntity(id, domain, tx) {
|
|
147
|
-
const entity = await tx.getRepository(entity_1.Entity).findOne({
|
|
148
|
-
where: {
|
|
149
|
-
domain: { id: domain.id },
|
|
150
|
-
id
|
|
151
|
-
},
|
|
152
|
-
relations: ['children']
|
|
153
|
-
});
|
|
154
|
-
if ((entity.children && entity.children.length) || entity.delStrategy === del_strategy_type_1.DEL_STRATEGY.NULLIFY) {
|
|
155
|
-
if (entity.delStrategy === del_strategy_type_1.DEL_STRATEGY.DELETE || entity.delStrategy === del_strategy_type_1.DEL_STRATEGY.DESTROY) {
|
|
156
|
-
const children = entity.children;
|
|
157
|
-
for (let i = 0; i < children.length; i++) {
|
|
158
|
-
await deleteEntityAndEntityColumns(children[i].id, domain, tx);
|
|
159
|
-
}
|
|
160
|
-
await deleteEntityAndEntityColumns(entity.id, domain, tx);
|
|
161
|
-
}
|
|
162
|
-
else if (entity.delStrategy === del_strategy_type_1.DEL_STRATEGY.RESTRICT_WITH_ERROR) {
|
|
163
|
-
throw new Error('entity cannot delete');
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
else {
|
|
167
|
-
await deleteEntityAndEntityColumns(entity.id, domain, tx);
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
151
|
//# sourceMappingURL=entity-mutation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entity-mutation.js","sourceRoot":"","sources":["../../../server/service/entity/entity-mutation.ts"],"names":[],"mappings":";;;;AAAA,yEAAgE;AAChE,+CAAsE;AACtE,qCAA4B;AAC5B,kEAA6D;AAE7D,qCAAiC;AACjC,+CAAsD;AAG/C,IAAM,cAAc,GAApB,MAAM,cAAc;IAGnB,AAAN,KAAK,CAAC,YAAY,CAAgB,MAAiB,EAAS,OAAwB;QAClF,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAE1C,MAAM,UAAU,GAAG,EAAE,CAAC,aAAa,CAAC,eAAM,CAAC,CAAA;QAE3C,IAAI,MAAM,CAAC,MAAM,EAAE;YACjB,MAAM,CAAC,MAAM,GAAG,CAAC,MAAM,UAAU,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE,MAAM,CAAC,MAAM,EAAE,EAAE,CAAC,CAAQ,CAAA;SACpF;QAED,OAAO,MAAM,UAAU,CAAC,IAAI,iCACtB,M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E,MAAM,EAAE,EAAE,CAAC,CAAA;aAC/D;YACD,MAAM,4BAA4B,CAAC,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,EAAE,CAAC,CAAA;SAC1D;aAAM,IAAI,MAAM,CAAC,WAAW,KAAK,gCAAY,CAAC,mBAAmB,EAAE;YAClE,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAA;SACxC;KACF;SAAM;QACL,MAAM,4BAA4B,CAAC,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,EAAE,CAAC,CAAA;KAC1D;AACH,CAAC","sourcesContent":["import { DEL_STRATEGY } from '../../constants/del-strategy-type'\nimport { Arg, Ctx, Directive, Mutation, Resolver } from 'type-graphql'\nimport { In } from 'typeorm'\nimport { EntityColumn } from '../entity-column/entity-column'\n\nimport { Entity } from './entity'\nimport { EntityPatch, NewEntity } from './entity-type'\n\n@Resolver(Entity)\nexport class EntityMutation {\n @Directive('@transaction')\n @Mutation(returns => Entity, { description: 'To create new Entity' })\n async createEntity(@Arg('entity') entity: NewEntity, @Ctx() context: ResolverContext): Promise<Entity> {\n const { domain, user, tx } = context.state\n\n const repository = tx.getRepository(Entity)\n\n if (entity.master) {\n entity.master = (await repository.findOne({ where: { id: entity.master } })) as any\n }\n\n return await repository.save({\n ...(entity as any),\n domain,\n creator: user,\n updater: user\n })\n }\n\n @Directive('@transaction')\n @Mutation(returns => Entity, { description: \"To modify Entity' information\" })\n async updateEntity(\n @Arg('id', type => String) id: string,\n @Arg('patch', type => EntityPatch) patch: EntityPatch,\n @Ctx() context: ResolverContext\n ): Promise<Entity> {\n const { domain, user, tx } = context.state\n\n const repository = tx.getRepository(Entity)\n const entity = repository.findOne({\n where: { domain: { id: domain.id }, id },\n relations: ['master', 'children']\n })\n\n if (patch.master) {\n patch.master = (await repository.findOne({ where: { domain: { id: domain.id }, id: patch.master } })) as any\n }\n\n if (patch.children && patch.children.length) {\n patch.children = (await repository.findBy({ id: In(patch.children) })) as any\n }\n\n return await repository.save({\n ...entity,\n ...(patch as any),\n updater: user\n })\n }\n\n @Directive('@transaction')\n @Mutation(returns => [Entity], { description: \"To modify multiple Entitys' information\" })\n async updateMultipleEntity(\n @Arg('patches', type => [EntityPatch]) patches: EntityPatch[],\n @Ctx() context: ResolverContext\n ): Promise<Entity[]> {\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 entityRepo = tx.getRepository(Entity)\n\n if (_createRecords.length > 0) {\n for (let i = 0; i < _createRecords.length; i++) {\n const newRecord = _createRecords[i]\n\n if (newRecord.master) {\n newRecord.master = (await tx\n .getRepository(Entity)\n .findOne({ where: { domain: { id: domain.id }, id: newRecord.master } })) as any\n }\n\n if (newRecord.children && newRecord.children.length) {\n newRecord.children = (await tx.getRepository(Entity).findBy({ id: In(newRecord.children) })) as any\n }\n\n const result = await entityRepo.save({\n ...(newRecord as any),\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 entity = await entityRepo.findOneBy({ id: updateRecord.id })\n\n if (updateRecord.master) {\n updateRecord.master = (await tx\n .getRepository(Entity)\n .findOne({ where: { domain: { id: domain.id }, id: updateRecord.master } })) as any\n }\n\n if (updateRecord.children && updateRecord.children.length) {\n updateRecord.children = (await tx.getRepository(Entity).findBy({ id: In(updateRecord.children) })) as any\n }\n\n const result = await entityRepo.save({\n ...entity,\n ...(updateRecord as any),\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 Entity' })\n async deleteEntity(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<boolean> {\n const { domain, tx } = context.state\n await deleteEntity(id, domain, tx)\n\n return true\n }\n\n @Directive('@transaction')\n @Mutation(returns => Boolean, { description: 'To delete multiple Entities' })\n async deleteEntities(@Arg('ids', type => [String]) ids: string[], @Ctx() context: ResolverContext): Promise<boolean> {\n const { domain, tx } = context.state\n\n for (let i = 0; i < ids.length; i++) {\n await deleteEntity(ids[i], domain, tx)\n }\n\n return true\n }\n}\n\nasync function deleteEntityAndEntityColumns(id, domain, tx) {\n const entity: Entity = tx.getRepository(Entity).findOne({ domain: { id: domain.id }, id })\n const columns: EntityColumn[] = tx\n .getRepository(EntityColumn)\n .find({ where: { entity: { id: entity.id }, domain: { id: domain.id } }, relations: ['entity'] })\n\n if (columns && columns.length) await tx.getRepository(EntityColumn).delete(columns)\n await tx.getRepository(Entity).delete(entity)\n}\n\nasync function deleteEntity(id, domain, tx) {\n const entity: Entity = await tx.getRepository(Entity).findOne({\n where: {\n domain: { id: domain.id },\n id\n },\n relations: ['children']\n })\n\n if ((entity.children && entity.children.length) || entity.delStrategy === DEL_STRATEGY.NULLIFY) {\n if (entity.delStrategy === DEL_STRATEGY.DELETE || entity.delStrategy === DEL_STRATEGY.DESTROY) {\n const children = entity.children\n for (let i = 0; i < children.length; i++) {\n await deleteEntityAndEntityColumns(children[i].id, domain, tx)\n }\n await deleteEntityAndEntityColumns(entity.id, domain, tx)\n } else if (entity.delStrategy === DEL_STRATEGY.RESTRICT_WITH_ERROR) {\n throw new Error('entity cannot delete')\n }\n } else {\n await deleteEntityAndEntityColumns(entity.id, domain, tx)\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"entity-mutation.js","sourceRoot":"","sources":["../../../server/service/entity/entity-mutation.ts"],"names":[],"mappings":";;;;AACA,+CAAsE;AACtE,qCAA4B;AAG5B,qCAAiC;AACjC,+CAAsD;AAG/C,IAAM,cAAc,GAApB,MAAM,cAAc;IAGnB,AAAN,KAAK,CAAC,YAAY,CAAgB,MAAiB,EAAS,OAAwB;QAClF,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,G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IAAI,CAAC,EAAE,CAAC,CAAC,yBAAW,CAAC,CAAC,CAAA;IACrC,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;0DA4DP;AAIK;IAFL,IAAA,wBAAS,EAAC,cAAc,CAAC;IACzB,IAAA,uBAAQ,EAAC,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,WAAW,EAAE,kBAAkB,EAAE,CAAC;IAC9C,mBAAA,IAAA,kBAAG,EAAC,IAAI,CAAC,CAAA;IAAc,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;kDAa/C;AAIK;IAFL,IAAA,wBAAS,EAAC,cAAc,CAAC;IACzB,IAAA,uBAAQ,EAAC,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,WAAW,EAAE,6BAA6B,EAAE,CAAC;IACvD,mBAAA,IAAA,kBAAG,EAAC,KAAK,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAA;IAAiB,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;oDAevE;AAtJU,cAAc;IAD1B,IAAA,uBAAQ,EAAC,eAAM,CAAC;GACJ,cAAc,CAuJ1B;AAvJY,wCAAc","sourcesContent":["import { DEL_STRATEGY } from '../../constants/del-strategy-type'\nimport { Arg, Ctx, Directive, Mutation, Resolver } from 'type-graphql'\nimport { In } from 'typeorm'\nimport { EntityColumn } from '../entity-column/entity-column'\n\nimport { Entity } from './entity'\nimport { EntityPatch, NewEntity } from './entity-type'\n\n@Resolver(Entity)\nexport class EntityMutation {\n @Directive('@transaction')\n @Mutation(returns => Entity, { description: 'To create new Entity' })\n async createEntity(@Arg('entity') entity: NewEntity, @Ctx() context: ResolverContext): Promise<Entity> {\n const { domain, user, tx } = context.state\n\n const repository = tx.getRepository(Entity)\n\n if (entity.master) {\n entity.master = (await repository.findOne({ where: { id: entity.master } })) as any\n }\n\n return await repository.save({\n ...(entity as any),\n domain,\n creator: user,\n updater: user\n })\n }\n\n @Directive('@transaction')\n @Mutation(returns => Entity, { description: \"To modify Entity' information\" })\n async updateEntity(\n @Arg('id', type => String) id: string,\n @Arg('patch', type => EntityPatch) patch: EntityPatch,\n @Ctx() context: ResolverContext\n ): Promise<Entity> {\n const { domain, user, tx } = context.state\n\n const repository = tx.getRepository(Entity)\n const entity = repository.findOne({\n where: { domain: { id: domain.id }, id },\n relations: ['master', 'children']\n })\n\n if (patch.master) {\n patch.master = (await repository.findOne({ where: { domain: { id: domain.id }, id: patch.master } })) as any\n }\n\n if (patch.children && patch.children.length) {\n patch.children = (await repository.findBy({ id: In(patch.children) })) as any\n }\n\n return await repository.save({\n ...entity,\n ...(patch as any),\n updater: user\n })\n }\n\n @Directive('@transaction')\n @Mutation(returns => [Entity], { description: \"To modify multiple Entitys' information\" })\n async updateMultipleEntity(\n @Arg('patches', type => [EntityPatch]) patches: EntityPatch[],\n @Ctx() context: ResolverContext\n ): Promise<Entity[]> {\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 entityRepo = tx.getRepository(Entity)\n\n if (_createRecords.length > 0) {\n for (let i = 0; i < _createRecords.length; i++) {\n const newRecord = _createRecords[i]\n\n if (newRecord.master) {\n newRecord.master = (await tx\n .getRepository(Entity)\n .findOne({ where: { domain: { id: domain.id }, id: newRecord.master } })) as any\n }\n\n if (newRecord.children && newRecord.children.length) {\n newRecord.children = (await tx.getRepository(Entity).findBy({ id: In(newRecord.children) })) as any\n }\n\n const result = await entityRepo.save({\n ...(newRecord as any),\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 entity = await entityRepo.findOneBy({ id: updateRecord.id })\n\n if (updateRecord.master) {\n updateRecord.master = (await tx\n .getRepository(Entity)\n .findOne({ where: { domain: { id: domain.id }, id: updateRecord.master } })) as any\n }\n\n if (updateRecord.children && updateRecord.children.length) {\n updateRecord.children = (await tx.getRepository(Entity).findBy({ id: In(updateRecord.children) })) as any\n }\n\n const result = await entityRepo.save({\n ...entity,\n ...(updateRecord as any),\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 Entity' })\n async deleteEntity(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<boolean> {\n const { domain, tx } = context.state\n const entityRepo = tx.getRepository(Entity)\n\n const entity: Entity = await entityRepo.findOne({\n where: { domain: { id: domain.id }, id },\n relations: ['columns']\n })\n\n if (entity.columns.length) throw new Error('cannot delete Entity because columns of entity exists')\n else await entityRepo.delete(entity.id)\n\n return true\n }\n\n @Directive('@transaction')\n @Mutation(returns => Boolean, { description: 'To delete multiple Entities' })\n async deleteEntities(@Arg('ids', type => [String]) ids: string[], @Ctx() context: ResolverContext): Promise<boolean> {\n const { domain, tx } = context.state\n const entityRepo = tx.getRepository(Entity)\n\n for (const id of ids) {\n const entity: Entity = await entityRepo.findOne({\n where: { domain: { id: domain.id }, id },\n relations: ['columns']\n })\n\n if (entity.columns.length) throw new Error('cannot delete Entity because columns of entity exists')\n else await entityRepo.delete(entity.id)\n }\n\n return true\n }\n}\n"]}
|
|
@@ -11,7 +11,7 @@ let EntityColumnMutation = class EntityColumnMutation {
|
|
|
11
11
|
async createEntityColumn(entityColumn, context) {
|
|
12
12
|
const { domain, user, tx } = context.state;
|
|
13
13
|
if (entityColumn.entity) {
|
|
14
|
-
entityColumn.entity = (await tx.getRepository(entity_1.Entity).findOne({ where: { id: entityColumn.entity } }));
|
|
14
|
+
entityColumn.entity = (await tx.getRepository(entity_1.Entity).findOne({ where: { id: entityColumn.entity.id } }));
|
|
15
15
|
}
|
|
16
16
|
return await tx.getRepository(entity_column_1.EntityColumn).save(Object.assign(Object.assign({}, entityColumn), { domain, creator: user, updater: user }));
|
|
17
17
|
}
|
|
@@ -22,7 +22,7 @@ let EntityColumnMutation = class EntityColumnMutation {
|
|
|
22
22
|
where: { domain: { id: domain.id }, id }
|
|
23
23
|
});
|
|
24
24
|
if (patch.entity) {
|
|
25
|
-
patch.entity = (await tx.getRepository(entity_1.Entity).findOneBy({ id: patch.entity }));
|
|
25
|
+
patch.entity = (await tx.getRepository(entity_1.Entity).findOneBy({ id: patch.entity.id }));
|
|
26
26
|
}
|
|
27
27
|
return await repository.save(Object.assign(Object.assign(Object.assign({}, entityColumn), patch), { updater: user }));
|
|
28
28
|
}
|
|
@@ -36,7 +36,7 @@ let EntityColumnMutation = class EntityColumnMutation {
|
|
|
36
36
|
for (let i = 0; i < _createRecords.length; i++) {
|
|
37
37
|
const newRecord = _createRecords[i];
|
|
38
38
|
if (newRecord.entity) {
|
|
39
|
-
newRecord.entity = (await tx.getRepository(entity_1.Entity).findOneBy({ id: newRecord.entity }));
|
|
39
|
+
newRecord.entity = (await tx.getRepository(entity_1.Entity).findOneBy({ id: newRecord.entity.id }));
|
|
40
40
|
}
|
|
41
41
|
const result = await entityColumnRepo.save(Object.assign(Object.assign({}, newRecord), { domain, creator: user, updater: user }));
|
|
42
42
|
results.push(Object.assign(Object.assign({}, result), { cuFlag: '+' }));
|
|
@@ -47,7 +47,7 @@ let EntityColumnMutation = class EntityColumnMutation {
|
|
|
47
47
|
const updateRecord = _updateRecords[i];
|
|
48
48
|
const entity = await entityColumnRepo.findOneBy({ id: updateRecord.id });
|
|
49
49
|
if (updateRecord.entity) {
|
|
50
|
-
updateRecord.entity = (await tx.getRepository(entity_1.Entity).findOneBy({ id: updateRecord.entity }));
|
|
50
|
+
updateRecord.entity = (await tx.getRepository(entity_1.Entity).findOneBy({ id: updateRecord.entity.id }));
|
|
51
51
|
}
|
|
52
52
|
const result = await entityColumnRepo.save(Object.assign(Object.assign(Object.assign({}, entity), updateRecord), { updater: user }));
|
|
53
53
|
results.push(Object.assign(Object.assign({}, result), { cuFlag: 'M' }));
|
|
@@ -60,7 +60,7 @@ let EntityColumnMutation = class EntityColumnMutation {
|
|
|
60
60
|
await tx.getRepository(entity_column_1.EntityColumn).delete({ domain: { id: domain.id }, id });
|
|
61
61
|
return true;
|
|
62
62
|
}
|
|
63
|
-
async
|
|
63
|
+
async deleteEntityColumns(ids, context) {
|
|
64
64
|
const { domain, tx } = context.state;
|
|
65
65
|
await tx.getRepository(entity_column_1.EntityColumn).delete({ domain: { id: domain.id }, id: (0, typeorm_1.In)(ids) });
|
|
66
66
|
return true;
|
|
@@ -111,7 +111,7 @@ tslib_1.__decorate([
|
|
|
111
111
|
tslib_1.__metadata("design:type", Function),
|
|
112
112
|
tslib_1.__metadata("design:paramtypes", [Array, Object]),
|
|
113
113
|
tslib_1.__metadata("design:returntype", Promise)
|
|
114
|
-
], EntityColumnMutation.prototype, "
|
|
114
|
+
], EntityColumnMutation.prototype, "deleteEntityColumns", null);
|
|
115
115
|
EntityColumnMutation = tslib_1.__decorate([
|
|
116
116
|
(0, type_graphql_1.Resolver)(entity_column_1.EntityColumn)
|
|
117
117
|
], EntityColumnMutation);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entity-column-mutation.js","sourceRoot":"","sources":["../../../server/service/entity-column/entity-column-mutation.ts"],"names":[],"mappings":";;;;AAAA,+CAAsE;AACtE,qCAA4B;AAE5B,6CAAyC;AACzC,mDAA8C;AAC9C,6DAAyE;AAGlE,IAAM,oBAAoB,GAA1B,MAAM,oBAAoB;IAGzB,AAAN,KAAK,CAAC,kBAAkB,CACD,YAA6B,EAC3C,OAAwB;QAE/B,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAE1C,IAAI,YAAY,CAAC,MAAM,EAAE;YACvB,YAAY,CAAC,MAAM,GAAG,CAAC,MAAM,EAAE,CAAC,aAAa,CAAC,eAAM,CAAC,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE,YAAY,CAAC,MAAM,EAAE,EAAE,CAAC,CAAQ,CAAA;
|
|
1
|
+
{"version":3,"file":"entity-column-mutation.js","sourceRoot":"","sources":["../../../server/service/entity-column/entity-column-mutation.ts"],"names":[],"mappings":";;;;AAAA,+CAAsE;AACtE,qCAA4B;AAE5B,6CAAyC;AACzC,mDAA8C;AAC9C,6DAAyE;AAGlE,IAAM,oBAAoB,GAA1B,MAAM,oBAAoB;IAGzB,AAAN,KAAK,CAAC,kBAAkB,CACD,YAA6B,EAC3C,OAAwB;QAE/B,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAE1C,IAAI,YAAY,CAAC,MAAM,EAAE;YACvB,YAAY,CAAC,MAAM,GAAG,CAAC,MAAM,EAAE,CAAC,aAAa,CAAC,eAAM,CAAC,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE,YAAY,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,CAAC,CAAQ,CAAA;SACjH;QAED,OAAO,MAAM,EAAE,CAAC,aAAa,CAAC,4BAAY,CAAC,CAAC,IAAI,iCAC1C,YAAoB,KACxB,MAAM,EACN,OAAO,EAAE,IAAI,EACb,OAAO,EAAE,IAAI,IACb,CAAA;IACJ,CAAC;IAIK,AAAN,KAAK,CAAC,kBAAkB,CACX,EAAU,EACP,KAAwB,EAC/B,OAAwB;QAE/B,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,CAAC;YAC5C,KAAK,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,MAAM,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE;SACzC,CAAC,CAAA;Q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AG,EAAC,SAAS,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,sCAAiB,CAAC,CAAC,CAAA;IAC3C,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;sEAgDP;AAIK;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;;;;8DAKrD;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;;;;+DAOP;AAxHU,oBAAoB;IADhC,IAAA,uBAAQ,EAAC,4BAAY,CAAC;GACV,oBAAoB,CAyHhC;AAzHY,oDAAoB","sourcesContent":["import { Arg, Ctx, Directive, Mutation, Resolver } from 'type-graphql'\nimport { In } from 'typeorm'\n\nimport { Entity } from '../entity/entity'\nimport { EntityColumn } from './entity-column'\nimport { EntityColumnPatch, NewEntityColumn } from './entity-column-type'\n\n@Resolver(EntityColumn)\nexport class EntityColumnMutation {\n @Directive('@transaction')\n @Mutation(returns => EntityColumn, { description: 'To create new EntityColumn' })\n async createEntityColumn(\n @Arg('entityColumn') entityColumn: NewEntityColumn,\n @Ctx() context: ResolverContext\n ): Promise<EntityColumn> {\n const { domain, user, tx } = context.state\n\n if (entityColumn.entity) {\n entityColumn.entity = (await tx.getRepository(Entity).findOne({ where: { id: entityColumn.entity.id } })) as any\n }\n\n return await tx.getRepository(EntityColumn).save({\n ...(entityColumn as any),\n domain,\n creator: user,\n updater: user\n })\n }\n\n @Directive('@transaction')\n @Mutation(returns => EntityColumn, { description: 'To modify EntityColumn information' })\n async updateEntityColumn(\n @Arg('id') id: string,\n @Arg('patch') patch: EntityColumnPatch,\n @Ctx() context: ResolverContext\n ): Promise<EntityColumn> {\n const { domain, user, tx } = context.state\n\n const repository = tx.getRepository(EntityColumn)\n const entityColumn = await repository.findOne({\n where: { domain: { id: domain.id }, id }\n })\n\n if (patch.entity) {\n patch.entity = (await tx.getRepository(Entity).findOneBy({ id: patch.entity.id })) as any\n }\n\n return await repository.save({\n ...entityColumn,\n ...(patch as any),\n updater: user\n })\n }\n\n @Directive('@transaction')\n @Mutation(returns => [EntityColumn], { description: \"To modify multiple Entitys' information\" })\n async updateMultipleEntityColumn(\n @Arg('patches', type => [EntityColumnPatch]) patches: EntityColumnPatch[],\n @Ctx() context: ResolverContext\n ): Promise<EntityColumn[]> {\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 entityColumnRepo = tx.getRepository(EntityColumn)\n\n if (_createRecords.length > 0) {\n for (let i = 0; i < _createRecords.length; i++) {\n const newRecord = _createRecords[i]\n\n if (newRecord.entity) {\n newRecord.entity = (await tx.getRepository(Entity).findOneBy({ id: newRecord.entity.id })) as any\n }\n\n const result = await entityColumnRepo.save({\n ...(newRecord as any),\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 entity = await entityColumnRepo.findOneBy({ id: updateRecord.id })\n\n if (updateRecord.entity) {\n updateRecord.entity = (await tx.getRepository(Entity).findOneBy({ id: updateRecord.entity.id })) as any\n }\n\n const result = await entityColumnRepo.save({\n ...entity,\n ...(updateRecord as any),\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 EntityColumn' })\n async deleteEntityColumn(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<boolean> {\n const { domain, tx } = context.state\n\n await tx.getRepository(EntityColumn).delete({ domain: { id: domain.id }, id })\n return true\n }\n\n @Directive('@transaction')\n @Mutation(returns => Boolean, { description: 'To delete multiple EntityColumns' })\n async deleteEntityColumns(\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(EntityColumn).delete({ domain: { id: domain.id }, id: In(ids) })\n\n return true\n }\n}\n"]}
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.EntityColumnList = exports.EntityColumnPatch = exports.NewEntityColumn = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const type_graphql_1 = require("type-graphql");
|
|
6
|
+
const shell_1 = require("@things-factory/shell");
|
|
6
7
|
const entity_column_1 = require("./entity-column");
|
|
7
8
|
let NewEntityColumn = class NewEntityColumn {
|
|
8
9
|
};
|
|
@@ -16,7 +17,7 @@ tslib_1.__decorate([
|
|
|
16
17
|
], NewEntityColumn.prototype, "description", void 0);
|
|
17
18
|
tslib_1.__decorate([
|
|
18
19
|
(0, type_graphql_1.Field)(),
|
|
19
|
-
tslib_1.__metadata("design:type",
|
|
20
|
+
tslib_1.__metadata("design:type", shell_1.ObjectRef)
|
|
20
21
|
], NewEntityColumn.prototype, "entity", void 0);
|
|
21
22
|
tslib_1.__decorate([
|
|
22
23
|
(0, type_graphql_1.Field)({ nullable: true }),
|
|
@@ -162,7 +163,7 @@ tslib_1.__decorate([
|
|
|
162
163
|
], EntityColumnPatch.prototype, "description", void 0);
|
|
163
164
|
tslib_1.__decorate([
|
|
164
165
|
(0, type_graphql_1.Field)({ nullable: true }),
|
|
165
|
-
tslib_1.__metadata("design:type",
|
|
166
|
+
tslib_1.__metadata("design:type", shell_1.ObjectRef)
|
|
166
167
|
], EntityColumnPatch.prototype, "entity", void 0);
|
|
167
168
|
tslib_1.__decorate([
|
|
168
169
|
(0, type_graphql_1.Field)(type => type_graphql_1.Int, { nullable: true }),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entity-column-type.js","sourceRoot":"","sources":["../../../server/service/entity-column/entity-column-type.ts"],"names":[],"mappings":";;;;AAAA,+CAAoE;
|
|
1
|
+
{"version":3,"file":"entity-column-type.js","sourceRoot":"","sources":["../../../server/service/entity-column/entity-column-type.ts"],"names":[],"mappings":";;;;AAAA,+CAAoE;AACpE,iDAAiD;AACjD,mDAA8C;AAGvC,IAAM,eAAe,GAArB,MAAM,eAAe;CAsG3B,CAAA;AArGC;IAAC,IAAA,oBAAK,GAAE;;6CACI;AAEZ;IAAC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;oDACN;AAEpB;IAAC,IAAA,oBAAK,GAAE;sCACA,iBAAS;+CAAA;AAEjB;IAAC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;6CACb;AAEb;IAAC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;6CACb;AAEb;IAAC,IAAA,oBAAK,GAAE;;gDACO;AAEf;IAAC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;gDACV;AAEhB;IAAC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;iDACR;AAElB;IAAC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;gDACV;AAEhB;IAAC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;gDACV;AAEhB;IAAC,IAAA,oBAAK,EAAC,EAA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I,EAAE,CAAC;;iDACX;AAEf;IAAC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;mDACT;AAEjB;IAAC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;sDACL;AAErB;IAAC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;iDACX;AA3GJ,iBAAiB;IAD7B,IAAA,wBAAS,GAAE;GACC,iBAAiB,CA4G7B;AA5GY,8CAAiB;AA+GvB,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB;CAM5B,CAAA;AALC;IAAC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,CAAC,4BAAY,CAAC,CAAC;;+CACT;AAErB;IAAC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,kBAAG,CAAC;;+CACN;AALF,gBAAgB;IAD5B,IAAA,yBAAU,GAAE;GACA,gBAAgB,CAM5B;AANY,4CAAgB","sourcesContent":["import { Field, ID, InputType, Int, ObjectType } from 'type-graphql'\nimport { ObjectRef } from '@things-factory/shell'\nimport { EntityColumn } from './entity-column'\n\n@InputType()\nexport class NewEntityColumn {\n @Field()\n name: string\n\n @Field({ nullable: true })\n description?: string\n\n @Field()\n entity: ObjectRef\n\n @Field({ nullable: true })\n rank?: number\n\n @Field({ nullable: true })\n term?: string\n\n @Field()\n colType: string\n\n @Field({ nullable: true })\n colSize?: number\n\n @Field({ nullable: true })\n nullable?: boolean\n\n @Field({ nullable: true })\n refType?: string\n\n @Field({ nullable: true })\n refName?: string\n\n @Field({ nullable: true })\n refUrl?: string\n\n @Field({ nullable: true })\n refParams?: string\n\n @Field({ nullable: true })\n refRelated?: string\n\n @Field(type => Int, { nullable: true })\n searchRank?: number\n\n @Field(type => Int, { nullable: true })\n sortRank?: number\n\n @Field({ nullable: true })\n reverseSort?: boolean\n\n @Field({ nullable: true })\n virtualField?: boolean\n\n @Field({ nullable: true })\n searchName?: string\n\n @Field({ nullable: true })\n searchEditor?: string\n\n @Field({ nullable: true })\n searchOper?: string\n\n @Field({ nullable: true })\n searchInitVal?: string\n\n @Field(type => Int, { nullable: true })\n gridRank?: number\n\n @Field({ nullable: true })\n gridEditor?: string\n\n @Field({ nullable: true })\n gridFormat?: string\n\n @Field({ nullable: true })\n gridValidator?: string\n\n @Field(type => Int, { nullable: true })\n gridWidth?: number\n\n @Field({ nullable: true })\n gridAlign?: string\n\n @Field(type => Int, { nullable: true })\n uniqRank?: number\n\n @Field({ nullable: true })\n formEditor?: string\n\n @Field({ nullable: true })\n formValidator?: string\n\n @Field({ nullable: true })\n formFormat?: string\n\n @Field({ nullable: true })\n defVal?: string\n\n @Field({ nullable: true })\n rangeVal?: string\n\n @Field({ nullable: true })\n ignoreOnSav?: boolean\n}\n\n@InputType()\nexport class EntityColumnPatch {\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 entity?: ObjectRef\n\n @Field(type => Int, { nullable: true })\n rank?: number\n\n @Field({ nullable: true })\n term?: string\n\n @Field({ nullable: true })\n colType?: string\n\n @Field(type => Int, { nullable: true })\n colSize?: number\n\n @Field({ nullable: true })\n nullable?: boolean\n\n @Field({ nullable: true })\n refType?: string\n\n @Field({ nullable: true })\n refName?: string\n\n @Field({ nullable: true })\n refUrl?: string\n\n @Field({ nullable: true })\n refParams?: string\n\n @Field({ nullable: true })\n refRelated?: string\n\n @Field(type => Int, { nullable: true })\n searchRank?: number\n\n @Field({ nullable: true })\n sortRank?: number\n\n @Field({ nullable: true })\n reverseSort?: boolean\n\n @Field({ nullable: true })\n virtualField?: boolean\n\n @Field({ nullable: true })\n searchName?: string\n\n @Field({ nullable: true })\n searchEditor?: string\n\n @Field({ nullable: true })\n searchOper?: string\n\n @Field({ nullable: true })\n searchInitVal?: string\n\n @Field(type => Int, { nullable: true })\n gridRank?: number\n\n @Field({ nullable: true })\n gridEditor?: string\n\n @Field({ nullable: true })\n gridFormat?: string\n\n @Field({ nullable: true })\n gridValidator?: string\n\n @Field(type => Int, { nullable: true })\n gridWidth?: number\n\n @Field({ nullable: true })\n gridAlign?: string\n\n @Field(type => Int, { nullable: true })\n uniqRank?: number\n\n @Field({ nullable: true })\n formEditor?: string\n\n @Field({ nullable: true })\n formValidator?: string\n\n @Field({ nullable: true })\n formFormat?: string\n\n @Field({ nullable: true })\n defVal?: string\n\n @Field({ nullable: true })\n rangeVal?: string\n\n @Field({ nullable: true })\n ignoreOnSav?: boolean\n\n @Field({ nullable: true })\n cuFlag?: string\n}\n\n@ObjectType()\nexport class EntityColumnList {\n @Field(type => [EntityColumn])\n items: EntityColumn[]\n\n @Field(type => Int)\n total: number\n}\n"]}
|