@things-factory/geography 9.0.0-beta.76 → 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/geo-area/geo-area-mutation.js +22 -6
- package/dist-server/service/geo-area/geo-area-mutation.js.map +1 -1
- package/dist-server/service/geo-city/geo-city-mutation.js +22 -6
- package/dist-server/service/geo-city/geo-city-mutation.js.map +1 -1
- package/dist-server/service/geo-continent/geo-continent-mutation.js +22 -6
- package/dist-server/service/geo-continent/geo-continent-mutation.js.map +1 -1
- package/dist-server/service/geo-country/geo-country-mutation.js +22 -6
- package/dist-server/service/geo-country/geo-country-mutation.js.map +1 -1
- package/dist-server/service/geo-state/geo-state-mutation.js +22 -6
- package/dist-server/service/geo-state/geo-state-mutation.js.map +1 -1
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/package.json +4 -4
|
@@ -9,7 +9,11 @@ const geo_area_type_1 = require("./geo-area-type");
|
|
|
9
9
|
let GeoAreaMutation = class GeoAreaMutation {
|
|
10
10
|
async createGeoArea(geoArea, context) {
|
|
11
11
|
const { user, tx } = context.state;
|
|
12
|
-
return await tx.getRepository(geo_area_1.GeoArea).save(
|
|
12
|
+
return await tx.getRepository(geo_area_1.GeoArea).save({
|
|
13
|
+
...geoArea,
|
|
14
|
+
creator: user,
|
|
15
|
+
updater: user
|
|
16
|
+
});
|
|
13
17
|
}
|
|
14
18
|
async updateGeoArea(id, patch, context) {
|
|
15
19
|
const { user, tx } = context.state;
|
|
@@ -17,7 +21,11 @@ let GeoAreaMutation = class GeoAreaMutation {
|
|
|
17
21
|
const geoArea = await repository.findOne({
|
|
18
22
|
where: { id }
|
|
19
23
|
});
|
|
20
|
-
return await repository.save(
|
|
24
|
+
return await repository.save({
|
|
25
|
+
...geoArea,
|
|
26
|
+
...patch,
|
|
27
|
+
updater: user
|
|
28
|
+
});
|
|
21
29
|
}
|
|
22
30
|
async updateMultipleGeoArea(patches, context) {
|
|
23
31
|
const { user, tx } = context.state;
|
|
@@ -28,16 +36,24 @@ let GeoAreaMutation = class GeoAreaMutation {
|
|
|
28
36
|
if (_createRecords.length > 0) {
|
|
29
37
|
for (let i = 0; i < _createRecords.length; i++) {
|
|
30
38
|
const newRecord = _createRecords[i];
|
|
31
|
-
const result = await geoAreaRepo.save(
|
|
32
|
-
|
|
39
|
+
const result = await geoAreaRepo.save({
|
|
40
|
+
...newRecord,
|
|
41
|
+
creator: user,
|
|
42
|
+
updater: user
|
|
43
|
+
});
|
|
44
|
+
results.push({ ...result, cuFlag: '+' });
|
|
33
45
|
}
|
|
34
46
|
}
|
|
35
47
|
if (_updateRecords.length > 0) {
|
|
36
48
|
for (let i = 0; i < _updateRecords.length; i++) {
|
|
37
49
|
const newRecord = _updateRecords[i];
|
|
38
50
|
const geoArea = await geoAreaRepo.findOneBy({ id: newRecord.id });
|
|
39
|
-
const result = await geoAreaRepo.save(
|
|
40
|
-
|
|
51
|
+
const result = await geoAreaRepo.save({
|
|
52
|
+
...geoArea,
|
|
53
|
+
...newRecord,
|
|
54
|
+
updater: user
|
|
55
|
+
});
|
|
56
|
+
results.push({ ...result, cuFlag: 'M' });
|
|
41
57
|
}
|
|
42
58
|
}
|
|
43
59
|
return results;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"geo-area-mutation.js","sourceRoot":"","sources":["../../../server/service/geo-area/geo-area-mutation.ts"],"names":[],"mappings":";;;;AAAA,+CAAsE;AACtE,qCAA4B;AAE5B,yCAAoC;AACpC,mDAA0D;AAGnD,IAAM,eAAe,GAArB,MAAM,eAAe;IAGpB,AAAN,KAAK,CAAC,aAAa,CAAiB,OAAmB,EAAS,OAAwB;QACtF,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAElC,OAAO,MAAM,EAAE,CAAC,aAAa,CAAC,kBAAO,CAAC,CAAC,IAAI,
|
|
1
|
+
{"version":3,"file":"geo-area-mutation.js","sourceRoot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AAQ,EAAC,OAAO,CAAC,EAAE,CAAC,CAAC,kBAAO,CAAC,EAAE,EAAE,WAAW,EAAE,0CAA0C,EAAE,CAAC;IAEzF,mBAAA,IAAA,kBAAG,EAAC,SAAS,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,4BAAY,CAAC,CAAC,CAAA;IACtC,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;4DAuCP;AAIK;IAFL,IAAA,wBAAS,EAAC,cAAc,CAAC;IACzB,IAAA,uBAAQ,EAAC,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,WAAW,EAAE,mBAAmB,EAAE,CAAC;IAC9C,mBAAA,IAAA,kBAAG,EAAC,IAAI,CAAC,CAAA;IAAc,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;oDAKhD;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;;;;qDAQvE;0BAlGU,eAAe;IAD3B,IAAA,uBAAQ,EAAC,kBAAO,CAAC;GACL,eAAe,CAmG3B","sourcesContent":["import { Arg, Ctx, Directive, Mutation, Resolver } from 'type-graphql'\nimport { In } from 'typeorm'\n\nimport { GeoArea } from './geo-area'\nimport { GeoAreaPatch, NewGeoArea } from './geo-area-type'\n\n@Resolver(GeoArea)\nexport class GeoAreaMutation {\n @Directive('@transaction')\n @Mutation(returns => GeoArea, { description: 'To create new GeoArea' })\n async createGeoArea(@Arg('geoArea') geoArea: NewGeoArea, @Ctx() context: ResolverContext): Promise<GeoArea> {\n const { user, tx } = context.state\n\n return await tx.getRepository(GeoArea).save({\n ...geoArea,\n creator: user,\n updater: user\n })\n }\n\n @Directive('@transaction')\n @Mutation(returns => GeoArea, { description: 'To modify GeoArea information' })\n async updateGeoArea(\n @Arg('id') id: string,\n @Arg('patch') patch: GeoAreaPatch,\n @Ctx() context: ResolverContext\n ): Promise<GeoArea> {\n const { user, tx } = context.state\n\n const repository = tx.getRepository(GeoArea)\n const geoArea = await repository.findOne({\n where: { id }\n })\n\n return await repository.save({\n ...geoArea,\n ...patch,\n updater: user\n })\n }\n\n @Directive('@transaction')\n @Mutation(returns => [GeoArea], { description: \"To modify multiple GeoAreas' information\" })\n async updateMultipleGeoArea(\n @Arg('patches', type => [GeoAreaPatch]) patches: GeoAreaPatch[],\n @Ctx() context: ResolverContext\n ): Promise<GeoArea[]> {\n const { 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 geoAreaRepo = tx.getRepository(GeoArea)\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 geoAreaRepo.save({\n ...newRecord,\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 newRecord = _updateRecords[i]\n const geoArea = await geoAreaRepo.findOneBy({ id: newRecord.id })\n\n const result = await geoAreaRepo.save({\n ...geoArea,\n ...newRecord,\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 GeoArea' })\n async deleteGeoArea(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<boolean> {\n const { tx } = context.state\n\n await tx.getRepository(GeoArea).delete({ id })\n return true\n }\n\n @Directive('@transaction')\n @Mutation(returns => Boolean, { description: 'To delete multiple geoAreas' })\n async deleteGeoAreas(@Arg('ids', type => [String]) ids: string[], @Ctx() context: ResolverContext): Promise<boolean> {\n const { domain, tx } = context.state\n\n await tx.getRepository(GeoArea).delete({\n id: In(ids)\n })\n\n return true\n }\n}\n"]}
|
|
@@ -9,7 +9,11 @@ const geo_city_type_1 = require("./geo-city-type");
|
|
|
9
9
|
let GeoCityMutation = class GeoCityMutation {
|
|
10
10
|
async createGeoCity(geoCity, context) {
|
|
11
11
|
const { user, tx } = context.state;
|
|
12
|
-
return await tx.getRepository(geo_city_1.GeoCity).save(
|
|
12
|
+
return await tx.getRepository(geo_city_1.GeoCity).save({
|
|
13
|
+
...geoCity,
|
|
14
|
+
creator: user,
|
|
15
|
+
updater: user
|
|
16
|
+
});
|
|
13
17
|
}
|
|
14
18
|
async updateGeoCity(id, patch, context) {
|
|
15
19
|
const { user, tx } = context.state;
|
|
@@ -17,7 +21,11 @@ let GeoCityMutation = class GeoCityMutation {
|
|
|
17
21
|
const geoCity = await repository.findOne({
|
|
18
22
|
where: { id }
|
|
19
23
|
});
|
|
20
|
-
return await repository.save(
|
|
24
|
+
return await repository.save({
|
|
25
|
+
...geoCity,
|
|
26
|
+
...patch,
|
|
27
|
+
updater: user
|
|
28
|
+
});
|
|
21
29
|
}
|
|
22
30
|
async updateMultipleGeoCity(patches, context) {
|
|
23
31
|
const { user, tx } = context.state;
|
|
@@ -28,16 +36,24 @@ let GeoCityMutation = class GeoCityMutation {
|
|
|
28
36
|
if (_createRecords.length > 0) {
|
|
29
37
|
for (let i = 0; i < _createRecords.length; i++) {
|
|
30
38
|
const newRecord = _createRecords[i];
|
|
31
|
-
const result = await geoCityRepo.save(
|
|
32
|
-
|
|
39
|
+
const result = await geoCityRepo.save({
|
|
40
|
+
...newRecord,
|
|
41
|
+
creator: user,
|
|
42
|
+
updater: user
|
|
43
|
+
});
|
|
44
|
+
results.push({ ...result, cuFlag: '+' });
|
|
33
45
|
}
|
|
34
46
|
}
|
|
35
47
|
if (_updateRecords.length > 0) {
|
|
36
48
|
for (let i = 0; i < _updateRecords.length; i++) {
|
|
37
49
|
const newRecord = _updateRecords[i];
|
|
38
50
|
const geoCity = await geoCityRepo.findOneBy({ id: newRecord.id });
|
|
39
|
-
const result = await geoCityRepo.save(
|
|
40
|
-
|
|
51
|
+
const result = await geoCityRepo.save({
|
|
52
|
+
...geoCity,
|
|
53
|
+
...newRecord,
|
|
54
|
+
updater: user
|
|
55
|
+
});
|
|
56
|
+
results.push({ ...result, cuFlag: 'M' });
|
|
41
57
|
}
|
|
42
58
|
}
|
|
43
59
|
return results;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"geo-city-mutation.js","sourceRoot":"","sources":["../../../server/service/geo-city/geo-city-mutation.ts"],"names":[],"mappings":";;;;AAAA,+CAAsE;AACtE,qCAA4B;AAE5B,yCAAoC;AACpC,mDAA0D;AAGnD,IAAM,eAAe,GAArB,MAAM,eAAe;IAGpB,AAAN,KAAK,CAAC,aAAa,CAAiB,OAAmB,EAAS,OAAwB;QACtF,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAElC,OAAO,MAAM,EAAE,CAAC,aAAa,CAAC,kBAAO,CAAC,CAAC,IAAI,
|
|
1
|
+
{"version":3,"file":"geo-city-mutation.js","sourceRoot":"","sources":["../../../server/service/geo-city/geo-city-mutation.ts"],"names":[],"mappings":";;;;AAAA,+CAAsE;AACtE,qCAA4B;AAE5B,yCAAoC;AACpC,mDAA0D;AAGnD,IAAM,eAAe,GAArB,MAAM,eAAe;IAGpB,AAAN,KAAK,CAAC,aAAa,CAAiB,OAAmB,EAAS,OAAwB;QACtF,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAElC,OAAO,MAAM,EAAE,CAAC,aAAa,CAAC,kBAAO,CAAC,CAAC,IAAI,CAAC;YAC1C,GAAG,OAAO;YACV,OAAO,EAAE,IAAI;YACb,OAAO,EAAE,IAAI;SACd,CAAC,CAAA;IACJ,CAAC;IAIK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AAG,GAAE,CAAA;;;;oDAKhD;AAIK;IAFL,IAAA,wBAAS,EAAC,cAAc,CAAC;IACzB,IAAA,uBAAQ,EAAC,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,WAAW,EAAE,6BAA6B,EAAE,CAAC;IAE1E,mBAAA,IAAA,kBAAG,EAAC,KAAK,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAA;IAC5B,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;sDASP;0BArGU,eAAe;IAD3B,IAAA,uBAAQ,EAAC,kBAAO,CAAC;GACL,eAAe,CAsG3B","sourcesContent":["import { Arg, Ctx, Directive, Mutation, Resolver } from 'type-graphql'\nimport { In } from 'typeorm'\n\nimport { GeoCity } from './geo-city'\nimport { GeoCityPatch, NewGeoCity } from './geo-city-type'\n\n@Resolver(GeoCity)\nexport class GeoCityMutation {\n @Directive('@transaction')\n @Mutation(returns => GeoCity, { description: 'To create new GeoCity' })\n async createGeoCity(@Arg('geoCity') geoCity: NewGeoCity, @Ctx() context: ResolverContext): Promise<GeoCity> {\n const { user, tx } = context.state\n\n return await tx.getRepository(GeoCity).save({\n ...geoCity,\n creator: user,\n updater: user\n })\n }\n\n @Directive('@transaction')\n @Mutation(returns => GeoCity, { description: 'To modify GeoCity information' })\n async updateGeoCity(\n @Arg('id') id: string,\n @Arg('patch') patch: GeoCityPatch,\n @Ctx() context: ResolverContext\n ): Promise<GeoCity> {\n const { user, tx } = context.state\n\n const repository = tx.getRepository(GeoCity)\n const geoCity = await repository.findOne({\n where: { id }\n })\n\n return await repository.save({\n ...geoCity,\n ...patch,\n updater: user\n })\n }\n\n @Directive('@transaction')\n @Mutation(returns => [GeoCity], { description: \"To modify multiple GeoCities' information\" })\n async updateMultipleGeoCity(\n @Arg('patches', type => [GeoCityPatch]) patches: GeoCityPatch[],\n @Ctx() context: ResolverContext\n ): Promise<GeoCity[]> {\n const { 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 geoCityRepo = tx.getRepository(GeoCity)\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 geoCityRepo.save({\n ...newRecord,\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 newRecord = _updateRecords[i]\n const geoCity = await geoCityRepo.findOneBy({ id: newRecord.id })\n\n const result = await geoCityRepo.save({\n ...geoCity,\n ...newRecord,\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 GeoCity' })\n async deleteGeoCity(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<boolean> {\n const { tx } = context.state\n\n await tx.getRepository(GeoCity).delete({ id })\n return true\n }\n\n @Directive('@transaction')\n @Mutation(returns => Boolean, { description: 'To delete multiple geoCitys' })\n async deleteGeoCities(\n @Arg('ids', type => [String]) ids: string[],\n @Ctx() context: ResolverContext\n ): Promise<boolean> {\n const { tx } = context.state\n\n await tx.getRepository(GeoCity).delete({\n id: In(ids)\n })\n\n return true\n }\n}\n"]}
|
|
@@ -9,7 +9,11 @@ const geo_continent_type_1 = require("./geo-continent-type");
|
|
|
9
9
|
let GeoContinentMutation = class GeoContinentMutation {
|
|
10
10
|
async createGeoContinent(geoContinent, context) {
|
|
11
11
|
const { user, tx } = context.state;
|
|
12
|
-
return await tx.getRepository(geo_continent_1.GeoContinent).save(
|
|
12
|
+
return await tx.getRepository(geo_continent_1.GeoContinent).save({
|
|
13
|
+
...geoContinent,
|
|
14
|
+
creator: user,
|
|
15
|
+
updater: user
|
|
16
|
+
});
|
|
13
17
|
}
|
|
14
18
|
async updateGeoContinent(id, patch, context) {
|
|
15
19
|
const { user, tx } = context.state;
|
|
@@ -17,7 +21,11 @@ let GeoContinentMutation = class GeoContinentMutation {
|
|
|
17
21
|
const geoContinent = await repository.findOne({
|
|
18
22
|
where: { id }
|
|
19
23
|
});
|
|
20
|
-
return await repository.save(
|
|
24
|
+
return await repository.save({
|
|
25
|
+
...geoContinent,
|
|
26
|
+
...patch,
|
|
27
|
+
updater: user
|
|
28
|
+
});
|
|
21
29
|
}
|
|
22
30
|
async updateMultipleGeoContinent(patches, context) {
|
|
23
31
|
const { user, tx } = context.state;
|
|
@@ -28,16 +36,24 @@ let GeoContinentMutation = class GeoContinentMutation {
|
|
|
28
36
|
if (_createRecords.length > 0) {
|
|
29
37
|
for (let i = 0; i < _createRecords.length; i++) {
|
|
30
38
|
const newRecord = _createRecords[i];
|
|
31
|
-
const result = await geoContinentRepo.save(
|
|
32
|
-
|
|
39
|
+
const result = await geoContinentRepo.save({
|
|
40
|
+
...newRecord,
|
|
41
|
+
creator: user,
|
|
42
|
+
updater: user
|
|
43
|
+
});
|
|
44
|
+
results.push({ ...result, cuFlag: '+' });
|
|
33
45
|
}
|
|
34
46
|
}
|
|
35
47
|
if (_updateRecords.length > 0) {
|
|
36
48
|
for (let i = 0; i < _updateRecords.length; i++) {
|
|
37
49
|
const newRecord = _updateRecords[i];
|
|
38
50
|
const geoContinent = await geoContinentRepo.findOneBy({ id: newRecord.id });
|
|
39
|
-
const result = await geoContinentRepo.save(
|
|
40
|
-
|
|
51
|
+
const result = await geoContinentRepo.save({
|
|
52
|
+
...geoContinent,
|
|
53
|
+
...newRecord,
|
|
54
|
+
updater: user
|
|
55
|
+
});
|
|
56
|
+
results.push({ ...result, cuFlag: 'M' });
|
|
41
57
|
}
|
|
42
58
|
}
|
|
43
59
|
return results;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"geo-continent-mutation.js","sourceRoot":"","sources":["../../../server/service/geo-continent/geo-continent-mutation.ts"],"names":[],"mappings":";;;;AAAA,+CAAsE;AACtE,qCAA4B;AAE5B,mDAA8C;AAC9C,6DAAyE;AAGlE,IAAM,oBAAoB,GAA1B,MAAM,oBAAoB;IAGzB,AAAN,KAAK,CAAC,kBAAkB,CACD,YAA6B,EAC3C,OAAwB;QAE/B,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAElC,OAAO,MAAM,EAAE,CAAC,aAAa,CAAC,4BAAY,CAAC,CAAC,IAAI,
|
|
1
|
+
{"version":3,"file":"geo-continent-mutation.js","sourceRoot":"","sources":["../../../server/service/geo-continent/geo-continent-mutation.ts"],"names":[],"mappings":";;;;AAAA,+CAAsE;AACtE,qCAA4B;AAE5B,mDAA8C;AAC9C,6DAAyE;AAGlE,IAAM,oBAAoB,GAA1B,MAAM,oBAAoB;IAGzB,AAAN,KAAK,CAAC,kBAAkB,CACD,YAA6B,EAC3C,OAAwB;QAE/B,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAElC,OAAO,MAAM,EAAE,CAAC,aAAa,CAAC,4BAAY,CAAC,CAAC,IAAI,CAAC;YAC/C,GAAG,YAAY;YACf,OAAO,EAAE,IAAI;YACb,OAAO,EAAE,IAAI;SACd,CAAC,CAAA;IACJ,CAAC;IAIK,AAAN,KAAK,CAAC,kBAAkB,CACX,EAAU,EACP,KAAwB,EAC/B,OAAwB;QAE/B,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAElC,MAAM,UAAU,GAAG,EAAE,CAAC,aAAa,CAAC,4BAAY,CAAC,CAAA;QACjD,MAAM,YAAY,GAAG,MAAM,UAAU,CAAC,OAAO,CAAC;YAC5C,KAAK,EAAE,EAAE,EAAE,EAAE;SACd,CAAC,CAAA;QAEF,OAAO,MAAM,UAAU,CAAC,IAAI,CAAC;YAC3B,GAAG,YAAY;YACf,GAAG,KAAK;YACR,OAAO,EAAE,IAAI;SACd,CA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","sourcesContent":["import { Arg, Ctx, Directive, Mutation, Resolver } from 'type-graphql'\nimport { In } from 'typeorm'\n\nimport { GeoContinent } from './geo-continent'\nimport { GeoContinentPatch, NewGeoContinent } from './geo-continent-type'\n\n@Resolver(GeoContinent)\nexport class GeoContinentMutation {\n @Directive('@transaction')\n @Mutation(returns => GeoContinent, { description: 'To create new GeoContinent' })\n async createGeoContinent(\n @Arg('geoContinent') geoContinent: NewGeoContinent,\n @Ctx() context: ResolverContext\n ): Promise<GeoContinent> {\n const { user, tx } = context.state\n\n return await tx.getRepository(GeoContinent).save({\n ...geoContinent,\n creator: user,\n updater: user\n })\n }\n\n @Directive('@transaction')\n @Mutation(returns => GeoContinent, { description: 'To modify GeoContinent information' })\n async updateGeoContinent(\n @Arg('id') id: string,\n @Arg('patch') patch: GeoContinentPatch,\n @Ctx() context: ResolverContext\n ): Promise<GeoContinent> {\n const { user, tx } = context.state\n\n const repository = tx.getRepository(GeoContinent)\n const geoContinent = await repository.findOne({\n where: { id }\n })\n\n return await repository.save({\n ...geoContinent,\n ...patch,\n updater: user\n })\n }\n\n @Directive('@transaction')\n @Mutation(returns => [GeoContinent], { description: \"To modify multiple GeoContinents' information\" })\n async updateMultipleGeoContinent(\n @Arg('patches', type => [GeoContinentPatch]) patches: GeoContinentPatch[],\n @Ctx() context: ResolverContext\n ): Promise<GeoContinent[]> {\n const { 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 geoContinentRepo = tx.getRepository(GeoContinent)\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 geoContinentRepo.save({\n ...newRecord,\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 newRecord = _updateRecords[i]\n const geoContinent = await geoContinentRepo.findOneBy({ id: newRecord.id })\n\n const result = await geoContinentRepo.save({\n ...geoContinent,\n ...newRecord,\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 GeoContinent' })\n async deleteGeoContinent(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<boolean> {\n const { tx } = context.state\n\n await tx.getRepository(GeoContinent).delete({ id })\n return true\n }\n\n @Directive('@transaction')\n @Mutation(returns => Boolean, { description: 'To delete multiple geoContinents' })\n async deleteGeoContinents(\n @Arg('ids', type => [String]) ids: string[],\n @Ctx() context: ResolverContext\n ): Promise<boolean> {\n const { tx } = context.state\n\n await tx.getRepository(GeoContinent).delete({\n id: In(ids)\n })\n\n return true\n }\n}\n"]}
|
|
@@ -9,7 +9,11 @@ const geo_country_type_1 = require("./geo-country-type");
|
|
|
9
9
|
let GeoCountryMutation = class GeoCountryMutation {
|
|
10
10
|
async createGeoCountry(geoCountry, context) {
|
|
11
11
|
const { user, tx } = context.state;
|
|
12
|
-
return await tx.getRepository(geo_country_1.GeoCountry).save(
|
|
12
|
+
return await tx.getRepository(geo_country_1.GeoCountry).save({
|
|
13
|
+
...geoCountry,
|
|
14
|
+
creator: user,
|
|
15
|
+
updater: user
|
|
16
|
+
});
|
|
13
17
|
}
|
|
14
18
|
async updateGeoCountry(id, patch, context) {
|
|
15
19
|
const { user, tx } = context.state;
|
|
@@ -17,7 +21,11 @@ let GeoCountryMutation = class GeoCountryMutation {
|
|
|
17
21
|
const geoCountry = await repository.findOne({
|
|
18
22
|
where: { id }
|
|
19
23
|
});
|
|
20
|
-
return await repository.save(
|
|
24
|
+
return await repository.save({
|
|
25
|
+
...geoCountry,
|
|
26
|
+
...patch,
|
|
27
|
+
updater: user
|
|
28
|
+
});
|
|
21
29
|
}
|
|
22
30
|
async updateMultipleGeoCountry(patches, context) {
|
|
23
31
|
const { user, tx } = context.state;
|
|
@@ -28,16 +36,24 @@ let GeoCountryMutation = class GeoCountryMutation {
|
|
|
28
36
|
if (_createRecords.length > 0) {
|
|
29
37
|
for (let i = 0; i < _createRecords.length; i++) {
|
|
30
38
|
const newRecord = _createRecords[i];
|
|
31
|
-
const result = await geoCountryRepo.save(
|
|
32
|
-
|
|
39
|
+
const result = await geoCountryRepo.save({
|
|
40
|
+
...newRecord,
|
|
41
|
+
creator: user,
|
|
42
|
+
updater: user
|
|
43
|
+
});
|
|
44
|
+
results.push({ ...result, cuFlag: '+' });
|
|
33
45
|
}
|
|
34
46
|
}
|
|
35
47
|
if (_updateRecords.length > 0) {
|
|
36
48
|
for (let i = 0; i < _updateRecords.length; i++) {
|
|
37
49
|
const newRecord = _updateRecords[i];
|
|
38
50
|
const geoCountry = await geoCountryRepo.findOneBy({ id: newRecord.id });
|
|
39
|
-
const result = await geoCountryRepo.save(
|
|
40
|
-
|
|
51
|
+
const result = await geoCountryRepo.save({
|
|
52
|
+
...geoCountry,
|
|
53
|
+
...newRecord,
|
|
54
|
+
updater: user
|
|
55
|
+
});
|
|
56
|
+
results.push({ ...result, cuFlag: 'M' });
|
|
41
57
|
}
|
|
42
58
|
}
|
|
43
59
|
return results;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"geo-country-mutation.js","sourceRoot":"","sources":["../../../server/service/geo-country/geo-country-mutation.ts"],"names":[],"mappings":";;;;AAAA,+CAAsE;AACtE,qCAA4B;AAE5B,+CAA0C;AAC1C,yDAAmE;AAG5D,IAAM,kBAAkB,GAAxB,MAAM,kBAAkB;IAGvB,AAAN,KAAK,CAAC,gBAAgB,CACD,UAAyB,EACrC,OAAwB;QAE/B,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAElC,OAAO,MAAM,EAAE,CAAC,aAAa,CAAC,wBAAU,CAAC,CAAC,IAAI,
|
|
1
|
+
{"version":3,"file":"geo-country-mutation.js","sourceRoot":"","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AAQ,EAAC,OAAO,CAAC,EAAE,CAAC,CAAC,wBAAU,CAAC,EAAE,EAAE,WAAW,EAAE,8CAA8C,EAAE,CAAC;IAEhG,mBAAA,IAAA,kBAAG,EAAC,SAAS,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,kCAAe,CAAC,CAAC,CAAA;IACzC,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;kEAuCP;AAIK;IAFL,IAAA,wBAAS,EAAC,cAAc,CAAC;IACzB,IAAA,uBAAQ,EAAC,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,WAAW,EAAE,sBAAsB,EAAE,CAAC;IAC9C,mBAAA,IAAA,kBAAG,EAAC,IAAI,CAAC,CAAA;IAAc,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;0DAKnD;AAIK;IAFL,IAAA,wBAAS,EAAC,cAAc,CAAC;IACzB,IAAA,uBAAQ,EAAC,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,WAAW,EAAE,gCAAgC,EAAE,CAAC;IAE7E,mBAAA,IAAA,kBAAG,EAAC,KAAK,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAA;IAC5B,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;4DASP;6BAxGU,kBAAkB;IAD9B,IAAA,uBAAQ,EAAC,wBAAU,CAAC;GACR,kBAAkB,CAyG9B","sourcesContent":["import { Arg, Ctx, Directive, Mutation, Resolver } from 'type-graphql'\nimport { In } from 'typeorm'\n\nimport { GeoCountry } from './geo-country'\nimport { GeoCountryPatch, NewGeoCountry } from './geo-country-type'\n\n@Resolver(GeoCountry)\nexport class GeoCountryMutation {\n @Directive('@transaction')\n @Mutation(returns => GeoCountry, { description: 'To create new GeoCountry' })\n async createGeoCountry(\n @Arg('geoCountry') geoCountry: NewGeoCountry,\n @Ctx() context: ResolverContext\n ): Promise<GeoCountry> {\n const { user, tx } = context.state\n\n return await tx.getRepository(GeoCountry).save({\n ...geoCountry,\n creator: user,\n updater: user\n })\n }\n\n @Directive('@transaction')\n @Mutation(returns => GeoCountry, { description: 'To modify GeoCountry information' })\n async updateGeoCountry(\n @Arg('id') id: string,\n @Arg('patch') patch: GeoCountryPatch,\n @Ctx() context: ResolverContext\n ): Promise<GeoCountry> {\n const { user, tx } = context.state\n\n const repository = tx.getRepository(GeoCountry)\n const geoCountry = await repository.findOne({\n where: { id }\n })\n\n return await repository.save({\n ...geoCountry,\n ...patch,\n updater: user\n })\n }\n\n @Directive('@transaction')\n @Mutation(returns => [GeoCountry], { description: \"To modify multiple GeoCountries' information\" })\n async updateMultipleGeoCountry(\n @Arg('patches', type => [GeoCountryPatch]) patches: GeoCountryPatch[],\n @Ctx() context: ResolverContext\n ): Promise<GeoCountry[]> {\n const { 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 geoCountryRepo = tx.getRepository(GeoCountry)\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 geoCountryRepo.save({\n ...newRecord,\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 newRecord = _updateRecords[i]\n const geoCountry = await geoCountryRepo.findOneBy({ id: newRecord.id })\n\n const result = await geoCountryRepo.save({\n ...geoCountry,\n ...newRecord,\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 GeoCountry' })\n async deleteGeoCountry(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<boolean> {\n const { tx } = context.state\n\n await tx.getRepository(GeoCountry).delete({ id })\n return true\n }\n\n @Directive('@transaction')\n @Mutation(returns => Boolean, { description: 'To delete multiple geoCountrys' })\n async deleteGeoCountries(\n @Arg('ids', type => [String]) ids: string[],\n @Ctx() context: ResolverContext\n ): Promise<boolean> {\n const { tx } = context.state\n\n await tx.getRepository(GeoCountry).delete({\n id: In(ids)\n })\n\n return true\n }\n}\n"]}
|
|
@@ -9,7 +9,11 @@ const geo_state_type_1 = require("./geo-state-type");
|
|
|
9
9
|
let GeoStateMutation = class GeoStateMutation {
|
|
10
10
|
async createGeoState(geoState, context) {
|
|
11
11
|
const { user, tx } = context.state;
|
|
12
|
-
return await tx.getRepository(geo_state_1.GeoState).save(
|
|
12
|
+
return await tx.getRepository(geo_state_1.GeoState).save({
|
|
13
|
+
...geoState,
|
|
14
|
+
creator: user,
|
|
15
|
+
updater: user
|
|
16
|
+
});
|
|
13
17
|
}
|
|
14
18
|
async updateGeoState(id, patch, context) {
|
|
15
19
|
const { user, tx } = context.state;
|
|
@@ -17,7 +21,11 @@ let GeoStateMutation = class GeoStateMutation {
|
|
|
17
21
|
const geoState = await repository.findOne({
|
|
18
22
|
where: { id }
|
|
19
23
|
});
|
|
20
|
-
return await repository.save(
|
|
24
|
+
return await repository.save({
|
|
25
|
+
...geoState,
|
|
26
|
+
...patch,
|
|
27
|
+
updater: user
|
|
28
|
+
});
|
|
21
29
|
}
|
|
22
30
|
async updateMultipleGeoState(patches, context) {
|
|
23
31
|
const { user, tx } = context.state;
|
|
@@ -28,16 +36,24 @@ let GeoStateMutation = class GeoStateMutation {
|
|
|
28
36
|
if (_createRecords.length > 0) {
|
|
29
37
|
for (let i = 0; i < _createRecords.length; i++) {
|
|
30
38
|
const newRecord = _createRecords[i];
|
|
31
|
-
const result = await geoStateRepo.save(
|
|
32
|
-
|
|
39
|
+
const result = await geoStateRepo.save({
|
|
40
|
+
...newRecord,
|
|
41
|
+
creator: user,
|
|
42
|
+
updater: user
|
|
43
|
+
});
|
|
44
|
+
results.push({ ...result, cuFlag: '+' });
|
|
33
45
|
}
|
|
34
46
|
}
|
|
35
47
|
if (_updateRecords.length > 0) {
|
|
36
48
|
for (let i = 0; i < _updateRecords.length; i++) {
|
|
37
49
|
const newRecord = _updateRecords[i];
|
|
38
50
|
const geoState = await geoStateRepo.findOneBy({ id: newRecord.id });
|
|
39
|
-
const result = await geoStateRepo.save(
|
|
40
|
-
|
|
51
|
+
const result = await geoStateRepo.save({
|
|
52
|
+
...geoState,
|
|
53
|
+
...newRecord,
|
|
54
|
+
updater: user
|
|
55
|
+
});
|
|
56
|
+
results.push({ ...result, cuFlag: 'M' });
|
|
41
57
|
}
|
|
42
58
|
}
|
|
43
59
|
return results;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"geo-state-mutation.js","sourceRoot":"","sources":["../../../server/service/geo-state/geo-state-mutation.ts"],"names":[],"mappings":";;;;AAAA,+CAAsE;AACtE,qCAA4B;AAE5B,2CAAsC;AACtC,qDAA6D;AAGtD,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB;IAGrB,AAAN,KAAK,CAAC,cAAc,CAAkB,QAAqB,EAAS,OAAwB;QAC1F,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAElC,OAAO,MAAM,EAAE,CAAC,aAAa,CAAC,oBAAQ,CAAC,CAAC,IAAI,
|
|
1
|
+
{"version":3,"file":"geo-state-mutation.js","sourceRoot":"","sources":["../../../server/service/geo-state/geo-state-mutation.ts"],"names":[],"mappings":";;;;AAAA,+CAAsE;AACtE,qCAA4B;AAE5B,2CAAsC;AACtC,qDAA6D;AAGtD,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB;IAGrB,AAAN,KAAK,CAAC,cAAc,CAAkB,QAAqB,EAAS,OAAwB;QAC1F,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAElC,OAAO,MAAM,EAAE,CAAC,aAAa,CAAC,oBAAQ,CAAC,CAAC,IAAI,CAAC;YAC3C,GAAG,QAAQ;YACX,OAAO,EAAE,IAAI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;IAC9C,mBAAA,IAAA,kBAAG,EAAC,IAAI,CAAC,CAAA;IAAc,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;sDAKjD;AAIK;IAFL,IAAA,wBAAS,EAAC,cAAc,CAAC;IACzB,IAAA,uBAAQ,EAAC,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,WAAW,EAAE,8BAA8B,EAAE,CAAC;IAE3E,mBAAA,IAAA,kBAAG,EAAC,KAAK,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAA;IAC5B,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;uDASP;2BArGU,gBAAgB;IAD5B,IAAA,uBAAQ,EAAC,oBAAQ,CAAC;GACN,gBAAgB,CAsG5B","sourcesContent":["import { Arg, Ctx, Directive, Mutation, Resolver } from 'type-graphql'\nimport { In } from 'typeorm'\n\nimport { GeoState } from './geo-state'\nimport { GeoStatePatch, NewGeoState } from './geo-state-type'\n\n@Resolver(GeoState)\nexport class GeoStateMutation {\n @Directive('@transaction')\n @Mutation(returns => GeoState, { description: 'To create new GeoState' })\n async createGeoState(@Arg('geoState') geoState: NewGeoState, @Ctx() context: ResolverContext): Promise<GeoState> {\n const { user, tx } = context.state\n\n return await tx.getRepository(GeoState).save({\n ...geoState,\n creator: user,\n updater: user\n })\n }\n\n @Directive('@transaction')\n @Mutation(returns => GeoState, { description: 'To modify GeoState information' })\n async updateGeoState(\n @Arg('id') id: string,\n @Arg('patch') patch: GeoStatePatch,\n @Ctx() context: ResolverContext\n ): Promise<GeoState> {\n const { user, tx } = context.state\n\n const repository = tx.getRepository(GeoState)\n const geoState = await repository.findOne({\n where: { id }\n })\n\n return await repository.save({\n ...geoState,\n ...patch,\n updater: user\n })\n }\n\n @Directive('@transaction')\n @Mutation(returns => [GeoState], { description: \"To modify multiple GeoStates' information\" })\n async updateMultipleGeoState(\n @Arg('patches', type => [GeoStatePatch]) patches: GeoStatePatch[],\n @Ctx() context: ResolverContext\n ): Promise<GeoState[]> {\n const { 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 geoStateRepo = tx.getRepository(GeoState)\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 geoStateRepo.save({\n ...newRecord,\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 newRecord = _updateRecords[i]\n const geoState = await geoStateRepo.findOneBy({ id: newRecord.id })\n\n const result = await geoStateRepo.save({\n ...geoState,\n ...newRecord,\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 GeoState' })\n async deleteGeoState(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<boolean> {\n const { tx } = context.state\n\n await tx.getRepository(GeoState).delete({ id })\n return true\n }\n\n @Directive('@transaction')\n @Mutation(returns => Boolean, { description: 'To delete multiple geoStates' })\n async deleteGeoStates(\n @Arg('ids', type => [String]) ids: string[],\n @Ctx() context: ResolverContext\n ): Promise<boolean> {\n const { tx } = context.state\n\n await tx.getRepository(GeoState).delete({\n id: In(ids)\n })\n\n return true\n }\n}\n"]}
|