@things-factory/geography 5.0.14 → 6.0.0-alpha.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 +1 -1
- package/dist-server/service/geo-area/geo-area-mutation.js.map +1 -1
- package/dist-server/service/geo-area/geo-area-query.js +47 -9
- package/dist-server/service/geo-area/geo-area-query.js.map +1 -1
- package/dist-server/service/geo-area/geo-area.js +3 -4
- package/dist-server/service/geo-area/geo-area.js.map +1 -1
- package/dist-server/service/geo-city/geo-city-mutation.js +1 -1
- package/dist-server/service/geo-city/geo-city-mutation.js.map +1 -1
- package/dist-server/service/geo-city/geo-city-query.js +8 -10
- package/dist-server/service/geo-city/geo-city-query.js.map +1 -1
- package/dist-server/service/geo-city/geo-city.js +3 -4
- package/dist-server/service/geo-city/geo-city.js.map +1 -1
- package/dist-server/service/geo-continent/geo-continent-mutation.js +1 -1
- package/dist-server/service/geo-continent/geo-continent-mutation.js.map +1 -1
- package/dist-server/service/geo-continent/geo-continent-query.js +6 -8
- package/dist-server/service/geo-continent/geo-continent-query.js.map +1 -1
- package/dist-server/service/geo-continent/geo-continent.js +2 -3
- package/dist-server/service/geo-continent/geo-continent.js.map +1 -1
- package/dist-server/service/geo-country/geo-country-mutation.js +1 -1
- package/dist-server/service/geo-country/geo-country-mutation.js.map +1 -1
- package/dist-server/service/geo-country/geo-country-query.js +18 -9
- package/dist-server/service/geo-country/geo-country-query.js.map +1 -1
- package/dist-server/service/geo-country/geo-country.js +2 -3
- package/dist-server/service/geo-country/geo-country.js.map +1 -1
- package/dist-server/service/geo-state/geo-state-mutation.js +1 -1
- package/dist-server/service/geo-state/geo-state-mutation.js.map +1 -1
- package/dist-server/service/geo-state/geo-state-query.js +7 -9
- package/dist-server/service/geo-state/geo-state-query.js.map +1 -1
- package/dist-server/service/geo-state/geo-state.js +2 -3
- package/dist-server/service/geo-state/geo-state.js.map +1 -1
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/package.json +5 -5
- package/server/service/geo-area/geo-area-mutation.ts +11 -6
- package/server/service/geo-area/geo-area-query.ts +42 -8
- package/server/service/geo-area/geo-area.ts +1 -1
- package/server/service/geo-city/geo-city-mutation.ts +14 -6
- package/server/service/geo-city/geo-city-query.ts +10 -9
- package/server/service/geo-city/geo-city.ts +1 -1
- package/server/service/geo-continent/geo-continent-mutation.ts +10 -6
- package/server/service/geo-continent/geo-continent-query.ts +8 -7
- package/server/service/geo-country/geo-country-mutation.ts +13 -6
- package/server/service/geo-country/geo-country-query.ts +16 -8
- package/server/service/geo-state/geo-state-mutation.ts +10 -6
- package/server/service/geo-state/geo-state-query.ts +9 -8
|
@@ -35,7 +35,7 @@ let GeoAreaMutation = class GeoAreaMutation {
|
|
|
35
35
|
if (_updateRecords.length > 0) {
|
|
36
36
|
for (let i = 0; i < _updateRecords.length; i++) {
|
|
37
37
|
const newRecord = _updateRecords[i];
|
|
38
|
-
const geoArea = await geoAreaRepo.
|
|
38
|
+
const geoArea = await geoAreaRepo.findOneBy({ id: newRecord.id });
|
|
39
39
|
const result = await geoAreaRepo.save(Object.assign(Object.assign(Object.assign({}, geoArea), newRecord), { updater: user }));
|
|
40
40
|
results.push(Object.assign(Object.assign({}, result), { cuFlag: 'M' }));
|
|
41
41
|
}
|
|
@@ -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;
|
|
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;AAG1D,IAAa,eAAe,GAA5B,MAAa,eAAe;IAG1B,KAAK,CAAC,aAAa,CAAiB,OAAmB,EAAS,OAAwB;QACtF,MAAM,EA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IAAc,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;oDAKhD;AAID;IAFC,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;AAlGU,eAAe;IAD3B,IAAA,uBAAQ,EAAC,kBAAO,CAAC;GACL,eAAe,CAmG3B;AAnGY,0CAAe","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"]}
|
|
@@ -1,34 +1,57 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var _a;
|
|
3
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
3
|
exports.GeoAreaQuery = void 0;
|
|
5
4
|
const tslib_1 = require("tslib");
|
|
5
|
+
const type_graphql_1 = require("type-graphql");
|
|
6
6
|
const auth_base_1 = require("@things-factory/auth-base");
|
|
7
7
|
const shell_1 = require("@things-factory/shell");
|
|
8
|
-
const type_graphql_1 = require("type-graphql");
|
|
9
|
-
const typeorm_1 = require("typeorm");
|
|
10
8
|
const geo_city_1 = require("../geo-city/geo-city");
|
|
11
9
|
const geo_area_1 = require("./geo-area");
|
|
12
10
|
const geo_area_type_1 = require("./geo-area-type");
|
|
13
11
|
let GeoAreaQuery = class GeoAreaQuery {
|
|
14
12
|
async geoArea(id, context) {
|
|
15
|
-
return await (0,
|
|
13
|
+
return await (0, shell_1.getRepository)(geo_area_1.GeoArea).findOne({
|
|
16
14
|
where: { id }
|
|
17
15
|
});
|
|
18
16
|
}
|
|
19
17
|
async geoAreas(params, context) {
|
|
20
18
|
const convertedParams = (0, shell_1.convertListParams)(params);
|
|
21
|
-
const [items, total] = await (0,
|
|
19
|
+
const [items, total] = await (0, shell_1.getRepository)(geo_area_1.GeoArea).findAndCount(convertedParams);
|
|
22
20
|
return { items, total };
|
|
23
21
|
}
|
|
22
|
+
async geoAreasAllPostCode(context) {
|
|
23
|
+
const result = await (0, shell_1.getRepository)(geo_area_1.GeoArea)
|
|
24
|
+
.createQueryBuilder('ga')
|
|
25
|
+
.select('ga.postal_code')
|
|
26
|
+
.distinct(true)
|
|
27
|
+
.orderBy('ga.postal_code')
|
|
28
|
+
.getRawMany();
|
|
29
|
+
const items = result.map(item => {
|
|
30
|
+
return {
|
|
31
|
+
postalCode: item.postal_code
|
|
32
|
+
};
|
|
33
|
+
});
|
|
34
|
+
const total = items.length;
|
|
35
|
+
return { items, total };
|
|
36
|
+
}
|
|
37
|
+
async geoAreasGetStateAndCityByPosCode(postCode, context) {
|
|
38
|
+
let result = await (0, shell_1.getRepository)(geo_area_1.GeoArea)
|
|
39
|
+
.createQueryBuilder('ga')
|
|
40
|
+
.select('ga.city_name', 'cityName')
|
|
41
|
+
.addSelect('ga.state_name', 'stateName')
|
|
42
|
+
.distinct(true)
|
|
43
|
+
.where('ga.postal_code = :postCode', { postCode: postCode })
|
|
44
|
+
.getRawOne();
|
|
45
|
+
return result;
|
|
46
|
+
}
|
|
24
47
|
async geoCity(geoArea) {
|
|
25
|
-
return await (0,
|
|
48
|
+
return await (0, shell_1.getRepository)(geo_city_1.GeoCity).findOneBy({ id: geoArea.geoCityId });
|
|
26
49
|
}
|
|
27
50
|
async updater(geoArea) {
|
|
28
|
-
return await (0,
|
|
51
|
+
return await (0, shell_1.getRepository)(auth_base_1.User).findOneBy({ id: geoArea.updaterId });
|
|
29
52
|
}
|
|
30
53
|
async creator(geoArea) {
|
|
31
|
-
return await (0,
|
|
54
|
+
return await (0, shell_1.getRepository)(auth_base_1.User).findOneBy({ id: geoArea.creatorId });
|
|
32
55
|
}
|
|
33
56
|
};
|
|
34
57
|
tslib_1.__decorate([
|
|
@@ -44,9 +67,24 @@ tslib_1.__decorate([
|
|
|
44
67
|
tslib_1.__param(0, (0, type_graphql_1.Args)()),
|
|
45
68
|
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
|
46
69
|
tslib_1.__metadata("design:type", Function),
|
|
47
|
-
tslib_1.__metadata("design:paramtypes", [
|
|
70
|
+
tslib_1.__metadata("design:paramtypes", [shell_1.ListParam, Object]),
|
|
48
71
|
tslib_1.__metadata("design:returntype", Promise)
|
|
49
72
|
], GeoAreaQuery.prototype, "geoAreas", null);
|
|
73
|
+
tslib_1.__decorate([
|
|
74
|
+
(0, type_graphql_1.Query)(returns => geo_area_type_1.GeoAreaList),
|
|
75
|
+
tslib_1.__param(0, (0, type_graphql_1.Ctx)()),
|
|
76
|
+
tslib_1.__metadata("design:type", Function),
|
|
77
|
+
tslib_1.__metadata("design:paramtypes", [Object]),
|
|
78
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
79
|
+
], GeoAreaQuery.prototype, "geoAreasAllPostCode", null);
|
|
80
|
+
tslib_1.__decorate([
|
|
81
|
+
(0, type_graphql_1.Query)(returns => geo_area_1.GeoArea),
|
|
82
|
+
tslib_1.__param(0, (0, type_graphql_1.Arg)('postCode')),
|
|
83
|
+
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
|
84
|
+
tslib_1.__metadata("design:type", Function),
|
|
85
|
+
tslib_1.__metadata("design:paramtypes", [String, Object]),
|
|
86
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
87
|
+
], GeoAreaQuery.prototype, "geoAreasGetStateAndCityByPosCode", null);
|
|
50
88
|
tslib_1.__decorate([
|
|
51
89
|
(0, type_graphql_1.FieldResolver)(type => geo_city_1.GeoCity),
|
|
52
90
|
tslib_1.__param(0, (0, type_graphql_1.Root)()),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"geo-area-query.js","sourceRoot":"","sources":["../../../server/service/geo-area/geo-area-query.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"geo-area-query.js","sourceRoot":"","sources":["../../../server/service/geo-area/geo-area-query.ts"],"names":[],"mappings":";;;;AAAA,+CAAmF;AAEnF,yDAAgD;AAChD,iDAAmF;AAEnF,mDAA8C;AAC9C,yCAAoC;AACpC,mDAA6C;AAG7C,IAAa,YAAY,GAAzB,MAAa,YAAY;IAEvB,KAAK,CAAC,OAAO,CAAY,EAAU,EAAS,OAAwB;QAClE,OAAO,MAAM,IAAA,qBAAa,EAAC,kBAAO,CAAC,CAAC,OAAO,CAAC;YAC1C,KAAK,EAAE,EAAE,EAAE,EAAE;SACd,CAAC,CAAA;IACJ,CAAC;IAGD,KAAK,CAAC,QAAQ,CAAS,MAAiB,EAAS,OAAwB;QACvE,MAAM,eAAe,GAAG,IAAA,yBAAiB,EAAC,MAAM,CAAC,CAAA;QACjD,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,GAAG,MAAM,IAAA,qBAAa,EAAC,kBAAO,CAAC,CAAC,YAAY,CAAC,eAAe,CAAC,CAAA;QAEjF,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,CAAA;IACzB,CAAC;IAGD,KAAK,CAAC,mBAAmB,CAAQ,OAAwB;QACvD,MAAM,MAAM,GAAG,MAAM,IAAA,qBAAa,EAAC,kBAAO,CAAC;aACxC,kBAAkB,CAAC,IAAI,CAAC;aAC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;AA/DY,oCAAY","sourcesContent":["import { Arg, Args, Ctx, FieldResolver, Query, Resolver, Root } from 'type-graphql'\n\nimport { User } from '@things-factory/auth-base'\nimport { convertListParams, getRepository, ListParam } from '@things-factory/shell'\n\nimport { GeoCity } from '../geo-city/geo-city'\nimport { GeoArea } from './geo-area'\nimport { GeoAreaList } from './geo-area-type'\n\n@Resolver(GeoArea)\nexport class GeoAreaQuery {\n @Query(returns => GeoArea, { description: 'To fetch a GeoArea' })\n async geoArea(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<GeoArea> {\n return await getRepository(GeoArea).findOne({\n where: { id }\n })\n }\n\n @Query(returns => GeoAreaList, { description: 'To fetch multiple GeoAreas' })\n async geoAreas(@Args() params: ListParam, @Ctx() context: ResolverContext): Promise<GeoAreaList> {\n const convertedParams = convertListParams(params)\n const [items, total] = await getRepository(GeoArea).findAndCount(convertedParams)\n\n return { items, total }\n }\n\n @Query(returns => GeoAreaList)\n async geoAreasAllPostCode(@Ctx() context: ResolverContext) {\n const result = await getRepository(GeoArea)\n .createQueryBuilder('ga')\n .select('ga.postal_code')\n .distinct(true)\n .orderBy('ga.postal_code')\n .getRawMany()\n\n const items: any[] = result.map(item => {\n return {\n postalCode: item.postal_code\n }\n })\n\n const total = items.length\n\n return { items, total }\n }\n\n @Query(returns => GeoArea)\n async geoAreasGetStateAndCityByPosCode(@Arg('postCode') postCode: string, @Ctx() context: ResolverContext) {\n let result = await getRepository(GeoArea)\n .createQueryBuilder('ga')\n .select('ga.city_name', 'cityName')\n .addSelect('ga.state_name', 'stateName')\n .distinct(true)\n .where('ga.postal_code = :postCode', { postCode: postCode })\n .getRawOne()\n\n return result\n }\n\n @FieldResolver(type => GeoCity)\n async geoCity(@Root() geoArea: GeoArea): Promise<GeoCity> {\n return await getRepository(GeoCity).findOneBy({ id: geoArea.geoCityId })\n }\n\n @FieldResolver(type => User)\n async updater(@Root() geoArea: GeoArea): Promise<User> {\n return await getRepository(User).findOneBy({ id: geoArea.updaterId })\n }\n\n @FieldResolver(type => User)\n async creator(@Root() geoArea: GeoArea): Promise<User> {\n return await getRepository(User).findOneBy({ id: geoArea.creatorId })\n }\n}\n"]}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var _a, _b;
|
|
3
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
3
|
exports.GeoArea = void 0;
|
|
5
4
|
const tslib_1 = require("tslib");
|
|
@@ -76,7 +75,7 @@ tslib_1.__decorate([
|
|
|
76
75
|
tslib_1.__decorate([
|
|
77
76
|
(0, typeorm_1.ManyToOne)(type => auth_base_1.User, { nullable: true }),
|
|
78
77
|
(0, type_graphql_1.Field)({ nullable: true }),
|
|
79
|
-
tslib_1.__metadata("design:type",
|
|
78
|
+
tslib_1.__metadata("design:type", auth_base_1.User)
|
|
80
79
|
], GeoArea.prototype, "creator", void 0);
|
|
81
80
|
tslib_1.__decorate([
|
|
82
81
|
(0, typeorm_1.RelationId)((geoArea) => geoArea.creator),
|
|
@@ -85,7 +84,7 @@ tslib_1.__decorate([
|
|
|
85
84
|
tslib_1.__decorate([
|
|
86
85
|
(0, typeorm_1.ManyToOne)(type => auth_base_1.User, { nullable: true }),
|
|
87
86
|
(0, type_graphql_1.Field)({ nullable: true }),
|
|
88
|
-
tslib_1.__metadata("design:type",
|
|
87
|
+
tslib_1.__metadata("design:type", auth_base_1.User)
|
|
89
88
|
], GeoArea.prototype, "updater", void 0);
|
|
90
89
|
tslib_1.__decorate([
|
|
91
90
|
(0, typeorm_1.RelationId)((geoArea) => geoArea.creator),
|
|
@@ -93,7 +92,7 @@ tslib_1.__decorate([
|
|
|
93
92
|
], GeoArea.prototype, "updaterId", void 0);
|
|
94
93
|
GeoArea = tslib_1.__decorate([
|
|
95
94
|
(0, typeorm_1.Entity)(),
|
|
96
|
-
(0, typeorm_1.Index)('ix_geo_area_0', (geoArea) => [geoArea.geoCity, geoArea.name], { unique: true }),
|
|
95
|
+
(0, typeorm_1.Index)('ix_geo_area_0', (geoArea) => [geoArea.geoCity, geoArea.name, geoArea.postalCode, geoArea.stateName], { unique: true }),
|
|
97
96
|
(0, type_graphql_1.ObjectType)({ description: 'Entity for GeoArea' })
|
|
98
97
|
], GeoArea);
|
|
99
98
|
exports.GeoArea = GeoArea;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"geo-area.js","sourceRoot":"","sources":["../../../server/service/geo-area/geo-area.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"geo-area.js","sourceRoot":"","sources":["../../../server/service/geo-area/geo-area.ts"],"names":[],"mappings":";;;;AAAA,yDAAgD;AAChD,+CAAoD;AACpD,qCASgB;AAChB,mDAA8C;AAK9C,IAAa,OAAO,GAApB,MAAa,OAAO;CAiEnB,CAAA;AA9DC;IAFC,IAAA,gCAAsB,EAAC,MAAM,CAAC;IAC9B,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,iBAAE,CAAC;;mCACC;AAInB;IAFC,IAAA,mBAAS,EAAC,IAAI,CAAC,EAAE,CAAC,kBAAO,CAAC;IAC1B,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;sCAChB,kBAAO;wCAAA;AAGjB;IADC,IAAA,oBAAU,EAAC,CAAC,OAAgB,EAAE,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC;;0CAChC;AAIlB;IAFC,IAAA,gBAAM,GAAE;IACR,IAAA,oBAAK,GAAE;;qCACI;AAIZ;IAFC,IAAA,gBAAM,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IAC1B,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;4CACN;AAIpB;IAFC,IAAA,gBAAM,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IAC1B,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;4CACN;AAIpB;IAFC,IAAA,gBAAM,EA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AC,EAAE,CAAC,gBAAI,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IAC3C,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;sCAChB,gBAAI;wCAAA;AAGd;IADC,IAAA,oBAAU,EAAC,CAAC,OAAgB,EAAE,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC;;0CAChC;AAhEP,OAAO;IAHnB,IAAA,gBAAM,GAAE;IACR,IAAA,eAAK,EAAC,eAAe,EAAE,CAAC,OAAgB,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,UAAU,EAAC,OAAO,CAAC,SAAS,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;IACrI,IAAA,yBAAU,EAAC,EAAE,WAAW,EAAE,oBAAoB,EAAE,CAAC;GACrC,OAAO,CAiEnB;AAjEY,0BAAO","sourcesContent":["import { User } from '@things-factory/auth-base'\nimport { Field, ID, ObjectType } from 'type-graphql'\nimport {\n Column,\n CreateDateColumn,\n Entity,\n Index,\n ManyToOne,\n PrimaryGeneratedColumn,\n RelationId,\n UpdateDateColumn\n} from 'typeorm'\nimport { GeoCity } from '../geo-city/geo-city'\n\n@Entity()\n@Index('ix_geo_area_0', (geoArea: GeoArea) => [geoArea.geoCity, geoArea.name, geoArea.postalCode,geoArea.stateName], { unique: true })\n@ObjectType({ description: 'Entity for GeoArea' })\nexport class GeoArea {\n @PrimaryGeneratedColumn('uuid')\n @Field(type => ID)\n readonly id: string\n\n @ManyToOne(type => GeoCity)\n @Field({ nullable: true })\n geoCity?: GeoCity\n\n @RelationId((geoArea: GeoArea) => geoArea.geoCity)\n geoCityId?: string\n\n @Column()\n @Field()\n name: string\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n description?: string\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n countryCode?: string\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n cityName?: string\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n stateName?: string\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n postalCode?: string\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n latitude?: string\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n longitude?: string\n\n @CreateDateColumn()\n @Field({ nullable: true })\n createdAt?: Date\n\n @UpdateDateColumn()\n @Field({ nullable: true })\n updatedAt?: Date\n\n @ManyToOne(type => User, { nullable: true })\n @Field({ nullable: true })\n creator?: User\n\n @RelationId((geoArea: GeoArea) => geoArea.creator)\n creatorId?: string\n\n @ManyToOne(type => User, { nullable: true })\n @Field({ nullable: true })\n updater?: User\n\n @RelationId((geoArea: GeoArea) => geoArea.creator)\n updaterId?: string\n}\n"]}
|
|
@@ -35,7 +35,7 @@ let GeoCityMutation = class GeoCityMutation {
|
|
|
35
35
|
if (_updateRecords.length > 0) {
|
|
36
36
|
for (let i = 0; i < _updateRecords.length; i++) {
|
|
37
37
|
const newRecord = _updateRecords[i];
|
|
38
|
-
const geoCity = await geoCityRepo.
|
|
38
|
+
const geoCity = await geoCityRepo.findOneBy({ id: newRecord.id });
|
|
39
39
|
const result = await geoCityRepo.save(Object.assign(Object.assign(Object.assign({}, geoCity), newRecord), { updater: user }));
|
|
40
40
|
results.push(Object.assign(Object.assign({}, result), { cuFlag: 'M' }));
|
|
41
41
|
}
|
|
@@ -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;
|
|
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;AAG1D,IAAa,eAAe,GAA5B,MAAa,eAAe;IAG1B,KAAK,CAAC,aAAa,CA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,EAAC,IAAI,CAAC,CAAA;IAAc,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;oDAKhD;AAID;IAFC,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;AArGU,eAAe;IAD3B,IAAA,uBAAQ,EAAC,kBAAO,CAAC;GACL,eAAe,CAsG3B;AAtGY,0CAAe","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"]}
|
|
@@ -1,38 +1,36 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var _a;
|
|
3
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
3
|
exports.GeoCityQuery = void 0;
|
|
5
4
|
const tslib_1 = require("tslib");
|
|
5
|
+
const type_graphql_1 = require("type-graphql");
|
|
6
6
|
const auth_base_1 = require("@things-factory/auth-base");
|
|
7
7
|
const shell_1 = require("@things-factory/shell");
|
|
8
|
-
const type_graphql_1 = require("type-graphql");
|
|
9
|
-
const typeorm_1 = require("typeorm");
|
|
10
8
|
const geo_country_1 = require("../geo-country/geo-country");
|
|
11
9
|
const geo_state_1 = require("../geo-state/geo-state");
|
|
12
10
|
const geo_city_1 = require("./geo-city");
|
|
13
11
|
const geo_city_type_1 = require("./geo-city-type");
|
|
14
12
|
let GeoCityQuery = class GeoCityQuery {
|
|
15
13
|
async geoCity(id, context) {
|
|
16
|
-
return await (0,
|
|
14
|
+
return await (0, shell_1.getRepository)(geo_city_1.GeoCity).findOne({
|
|
17
15
|
where: { id }
|
|
18
16
|
});
|
|
19
17
|
}
|
|
20
18
|
async geoCities(params, context) {
|
|
21
19
|
const convertedParams = (0, shell_1.convertListParams)(params);
|
|
22
|
-
const [items, total] = await (0,
|
|
20
|
+
const [items, total] = await (0, shell_1.getRepository)(geo_city_1.GeoCity).findAndCount(convertedParams);
|
|
23
21
|
return { items, total };
|
|
24
22
|
}
|
|
25
23
|
async geoCountry(geoCity) {
|
|
26
|
-
return await (0,
|
|
24
|
+
return await (0, shell_1.getRepository)(geo_country_1.GeoCountry).findOneBy({ id: geoCity.geoCountryId });
|
|
27
25
|
}
|
|
28
26
|
async geoState(geoCity) {
|
|
29
|
-
return await (0,
|
|
27
|
+
return await (0, shell_1.getRepository)(geo_state_1.GeoState).findOneBy({ id: geoCity.geoStateId });
|
|
30
28
|
}
|
|
31
29
|
async updater(geoCity) {
|
|
32
|
-
return await (0,
|
|
30
|
+
return await (0, shell_1.getRepository)(auth_base_1.User).findOneBy({ id: geoCity.updaterId });
|
|
33
31
|
}
|
|
34
32
|
async creator(geoCity) {
|
|
35
|
-
return await (0,
|
|
33
|
+
return await (0, shell_1.getRepository)(auth_base_1.User).findOneBy({ id: geoCity.creatorId });
|
|
36
34
|
}
|
|
37
35
|
};
|
|
38
36
|
tslib_1.__decorate([
|
|
@@ -48,7 +46,7 @@ tslib_1.__decorate([
|
|
|
48
46
|
tslib_1.__param(0, (0, type_graphql_1.Args)()),
|
|
49
47
|
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
|
50
48
|
tslib_1.__metadata("design:type", Function),
|
|
51
|
-
tslib_1.__metadata("design:paramtypes", [
|
|
49
|
+
tslib_1.__metadata("design:paramtypes", [shell_1.ListParam, Object]),
|
|
52
50
|
tslib_1.__metadata("design:returntype", Promise)
|
|
53
51
|
], GeoCityQuery.prototype, "geoCities", null);
|
|
54
52
|
tslib_1.__decorate([
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"geo-city-query.js","sourceRoot":"","sources":["../../../server/service/geo-city/geo-city-query.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"geo-city-query.js","sourceRoot":"","sources":["../../../server/service/geo-city/geo-city-query.ts"],"names":[],"mappings":";;;;AAAA,+CAAmF;AAEnF,yDAAgD;AAChD,iDAAmF;AAEnF,4DAAuD;AACvD,sDAAiD;AACjD,yCAAoC;AACpC,mDAA6C;AAG7C,IAAa,YAAY,GAAzB,MAAa,YAAY;IAEvB,KAAK,CAAC,OAAO,CAAY,EAAU,EAAS,OAAwB;QAClE,OAAO,MAAM,IAAA,qBAAa,EAAC,kBAAO,CAAC,CAAC,OAAO,CAAC;YAC1C,KAAK,EAAE,EAAE,EAAE,EAAE;SACd,CAAC,CAAA;IACJ,CAAC;IAGD,KAAK,CAAC,SAAS,CAAS,MAAiB,EAAS,OAAwB;QACxE,MAAM,eAAe,GAAG,IAAA,yBAAiB,EAAC,MAAM,CAAC,CAAA;QACjD,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,GAAG,MAAM,IAAA,qBAAa,EAAC,kBAAO,CAAC,CAAC,YAAY,CAAC,eAAe,CAAC,CAAA;QAEjF,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,CAAA;IACzB,CAAC;IAGD,KAAK,CAAC,UAAU,CAAS,OAAgB;QACvC,OAAO,MAAM,IAAA,qBAAa,EAAC,wBAAU,CAAC,CAAC,SAAS,CAAC,EAAE,EAAE,EAAE,OAAO,CAAC,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kBAAO;;4CAEtC;AAGD;IADC,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,CAAC;IACb,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAU,kBAAO;;2CAErC;AAGD;IADC,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,CAAC;IACb,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAU,kBAAO;;2CAErC;AAlCU,YAAY;IADxB,IAAA,uBAAQ,EAAC,kBAAO,CAAC;GACL,YAAY,CAmCxB;AAnCY,oCAAY","sourcesContent":["import { Arg, Args, Ctx, FieldResolver, Query, Resolver, Root } from 'type-graphql'\n\nimport { User } from '@things-factory/auth-base'\nimport { convertListParams, getRepository, ListParam } from '@things-factory/shell'\n\nimport { GeoCountry } from '../geo-country/geo-country'\nimport { GeoState } from '../geo-state/geo-state'\nimport { GeoCity } from './geo-city'\nimport { GeoCityList } from './geo-city-type'\n\n@Resolver(GeoCity)\nexport class GeoCityQuery {\n @Query(returns => GeoCity, { description: 'To fetch a GeoCity' })\n async geoCity(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<GeoCity> {\n return await getRepository(GeoCity).findOne({\n where: { id }\n })\n }\n\n @Query(returns => GeoCityList, { description: 'To fetch multiple GeoCities' })\n async geoCities(@Args() params: ListParam, @Ctx() context: ResolverContext): Promise<GeoCityList> {\n const convertedParams = convertListParams(params)\n const [items, total] = await getRepository(GeoCity).findAndCount(convertedParams)\n\n return { items, total }\n }\n\n @FieldResolver(type => GeoCountry)\n async geoCountry(@Root() geoCity: GeoCity): Promise<GeoCountry> {\n return await getRepository(GeoCountry).findOneBy({ id: geoCity.geoCountryId })\n }\n\n @FieldResolver(type => GeoState)\n async geoState(@Root() geoCity: GeoCity): Promise<GeoState> {\n return await getRepository(GeoState).findOneBy({ id: geoCity.geoStateId })\n }\n\n @FieldResolver(type => User)\n async updater(@Root() geoCity: GeoCity): Promise<User> {\n return await getRepository(User).findOneBy({ id: geoCity.updaterId })\n }\n\n @FieldResolver(type => User)\n async creator(@Root() geoCity: GeoCity): Promise<User> {\n return await getRepository(User).findOneBy({ id: geoCity.creatorId })\n }\n}\n"]}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var _a, _b;
|
|
3
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
3
|
exports.GeoCity = void 0;
|
|
5
4
|
const tslib_1 = require("tslib");
|
|
@@ -70,7 +69,7 @@ tslib_1.__decorate([
|
|
|
70
69
|
nullable: true
|
|
71
70
|
}),
|
|
72
71
|
(0, type_graphql_1.Field)({ nullable: true }),
|
|
73
|
-
tslib_1.__metadata("design:type",
|
|
72
|
+
tslib_1.__metadata("design:type", auth_base_1.User)
|
|
74
73
|
], GeoCity.prototype, "creator", void 0);
|
|
75
74
|
tslib_1.__decorate([
|
|
76
75
|
(0, typeorm_1.RelationId)((geoCity) => geoCity.creator),
|
|
@@ -81,7 +80,7 @@ tslib_1.__decorate([
|
|
|
81
80
|
nullable: true
|
|
82
81
|
}),
|
|
83
82
|
(0, type_graphql_1.Field)({ nullable: true }),
|
|
84
|
-
tslib_1.__metadata("design:type",
|
|
83
|
+
tslib_1.__metadata("design:type", auth_base_1.User)
|
|
85
84
|
], GeoCity.prototype, "updater", void 0);
|
|
86
85
|
tslib_1.__decorate([
|
|
87
86
|
(0, typeorm_1.RelationId)((geoCity) => geoCity.creator),
|
|
@@ -89,7 +88,7 @@ tslib_1.__decorate([
|
|
|
89
88
|
], GeoCity.prototype, "updaterId", void 0);
|
|
90
89
|
GeoCity = tslib_1.__decorate([
|
|
91
90
|
(0, typeorm_1.Entity)(),
|
|
92
|
-
(0, typeorm_1.Index)('ix_geo_city_0', (geoCity) => [geoCity.geoCountry, geoCity.name], { unique: true }),
|
|
91
|
+
(0, typeorm_1.Index)('ix_geo_city_0', (geoCity) => [geoCity.geoCountry, geoCity.name, geoCity.geoState], { unique: true }),
|
|
93
92
|
(0, type_graphql_1.ObjectType)({ description: 'Entity for GeoCity' })
|
|
94
93
|
], GeoCity);
|
|
95
94
|
exports.GeoCity = GeoCity;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"geo-city.js","sourceRoot":"","sources":["../../../server/service/geo-city/geo-city.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"geo-city.js","sourceRoot":"","sources":["../../../server/service/geo-city/geo-city.ts"],"names":[],"mappings":";;;;AAAA,yDAAgD;AAChD,+CAAoD;AACpD,qCASgB;AAChB,4DAAuD;AACvD,sDAAiD;AAKjD,IAAa,OAAO,GAApB,MAAa,OAAO;CA8DnB,CAAA;AA3DC;IAFC,IAAA,gCAAsB,EAAC,MAAM,CAAC;IAC9B,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,iBAAE,CAAC;;mCACC;AAInB;IAFC,IAAA,mBAAS,EAAC,IAAI,CAAC,EAAE,CAAC,wBAAU,CAAC;IAC7B,IAAA,oBAAK,GAAE;sCACI,wBAAU;2CAAA;AAGtB;IADC,IAAA,oBAAU,EAAC,CAAC,OAAgB,EAAE,EAAE,CAAC,OAAO,CAAC,UAAU,CAAC;;6CAChC;AAIrB;IAFC,IAAA,mBAAS,EAAC,IAAI,CAAC,EAAE,CAAC,oBAAQ,CAAC;IAC3B,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;sCACf,oBAAQ;yCAAA;AAGnB;IADC,IAAA,oBAAU,EAAC,CAAC,OAAgB,EAAE,EAAE,CAAC,OAAO,CAAC,QAAQ,CAAC;;2CAChC;AAInB;IAFC,IAAA,gBAAM,GAAE;IACR,IAAA,oBAAK,GAAE;;qCACI;AAMZ;IAJC,IAAA,gBAAM,EAAC;QACN,QAAQ,EAAE,IAAI;KACf,CAAC;IACD,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;4CACN;AAIpB;IAFC,IAAA,gBAAM,EAAC,EAAE,QAAQ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MAAM,EAAE,IAAI,EAAE,CAAC;IACpH,IAAA,yBAAU,EAAC,EAAE,WAAW,EAAE,oBAAoB,EAAE,CAAC;GACrC,OAAO,CA8DnB;AA9DY,0BAAO","sourcesContent":["import { User } from '@things-factory/auth-base'\nimport { Field, ID, ObjectType } from 'type-graphql'\nimport {\n Column,\n CreateDateColumn,\n Entity,\n Index,\n ManyToOne,\n PrimaryGeneratedColumn,\n RelationId,\n UpdateDateColumn\n} from 'typeorm'\nimport { GeoCountry } from '../geo-country/geo-country'\nimport { GeoState } from '../geo-state/geo-state'\n\n@Entity()\n@Index('ix_geo_city_0', (geoCity: GeoCity) => [geoCity.geoCountry, geoCity.name, geoCity.geoState], { unique: true })\n@ObjectType({ description: 'Entity for GeoCity' })\nexport class GeoCity {\n @PrimaryGeneratedColumn('uuid')\n @Field(type => ID)\n readonly id: string\n\n @ManyToOne(type => GeoCountry)\n @Field()\n geoCountry: GeoCountry\n\n @RelationId((geoCity: GeoCity) => geoCity.geoCountry)\n geoCountryId?: string\n\n @ManyToOne(type => GeoState)\n @Field({ nullable: true })\n geoState?: GeoState\n\n @RelationId((geoCity: GeoCity) => geoCity.geoState)\n geoStateId?: string\n\n @Column()\n @Field()\n name: string\n\n @Column({\n nullable: true\n })\n @Field({ nullable: true })\n description?: string\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n latitude?: string\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n longitude?: string\n\n @CreateDateColumn()\n @Field({ nullable: true })\n createdAt?: Date\n\n @UpdateDateColumn()\n @Field({ nullable: true })\n updatedAt?: Date\n\n @ManyToOne(type => User, {\n nullable: true\n })\n @Field({ nullable: true })\n creator?: User\n\n @RelationId((geoCity: GeoCity) => geoCity.creator)\n creatorId?: string\n\n @ManyToOne(type => User, {\n nullable: true\n })\n @Field({ nullable: true })\n updater?: User\n\n @RelationId((geoCity: GeoCity) => geoCity.creator)\n updaterId?: string\n}\n"]}
|
|
@@ -35,7 +35,7 @@ let GeoContinentMutation = class GeoContinentMutation {
|
|
|
35
35
|
if (_updateRecords.length > 0) {
|
|
36
36
|
for (let i = 0; i < _updateRecords.length; i++) {
|
|
37
37
|
const newRecord = _updateRecords[i];
|
|
38
|
-
const geoContinent = await geoContinentRepo.
|
|
38
|
+
const geoContinent = await geoContinentRepo.findOneBy({ id: newRecord.id });
|
|
39
39
|
const result = await geoContinentRepo.save(Object.assign(Object.assign(Object.assign({}, geoContinent), newRecord), { updater: user }));
|
|
40
40
|
results.push(Object.assign(Object.assign({}, result), { cuFlag: 'M' }));
|
|
41
41
|
}
|
|
@@ -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;
|
|
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;AAGzE,IAAa,oBAAoB,GAAjC,MAAa,oBAAoB;IAG/B,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,iCAC3C,YAAY,KACf,OAAO,EAAE,IAAI,EACb,OAAO,EAAE,IAAI,IACb,CAAA;IACJ,CAAC;IAID,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,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ourcesContent":["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"]}
|
|
@@ -1,30 +1,28 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var _a;
|
|
3
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
3
|
exports.GeoContinentQuery = void 0;
|
|
5
4
|
const tslib_1 = require("tslib");
|
|
5
|
+
const type_graphql_1 = require("type-graphql");
|
|
6
6
|
const auth_base_1 = require("@things-factory/auth-base");
|
|
7
7
|
const shell_1 = require("@things-factory/shell");
|
|
8
|
-
const type_graphql_1 = require("type-graphql");
|
|
9
|
-
const typeorm_1 = require("typeorm");
|
|
10
8
|
const geo_continent_1 = require("./geo-continent");
|
|
11
9
|
const geo_continent_type_1 = require("./geo-continent-type");
|
|
12
10
|
let GeoContinentQuery = class GeoContinentQuery {
|
|
13
11
|
async geoContinent(id, context) {
|
|
14
|
-
return await (0,
|
|
12
|
+
return await (0, shell_1.getRepository)(geo_continent_1.GeoContinent).findOne({
|
|
15
13
|
where: { id }
|
|
16
14
|
});
|
|
17
15
|
}
|
|
18
16
|
async geoContinents(params, context) {
|
|
19
17
|
const convertedParams = (0, shell_1.convertListParams)(params);
|
|
20
|
-
const [items, total] = await (0,
|
|
18
|
+
const [items, total] = await (0, shell_1.getRepository)(geo_continent_1.GeoContinent).findAndCount(convertedParams);
|
|
21
19
|
return { items, total };
|
|
22
20
|
}
|
|
23
21
|
async updater(geoContinent) {
|
|
24
|
-
return await (0,
|
|
22
|
+
return await (0, shell_1.getRepository)(auth_base_1.User).findOneBy({ id: geoContinent.updaterId });
|
|
25
23
|
}
|
|
26
24
|
async creator(geoContinent) {
|
|
27
|
-
return await (0,
|
|
25
|
+
return await (0, shell_1.getRepository)(auth_base_1.User).findOneBy({ id: geoContinent.creatorId });
|
|
28
26
|
}
|
|
29
27
|
};
|
|
30
28
|
tslib_1.__decorate([
|
|
@@ -40,7 +38,7 @@ tslib_1.__decorate([
|
|
|
40
38
|
tslib_1.__param(0, (0, type_graphql_1.Args)()),
|
|
41
39
|
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
|
42
40
|
tslib_1.__metadata("design:type", Function),
|
|
43
|
-
tslib_1.__metadata("design:paramtypes", [
|
|
41
|
+
tslib_1.__metadata("design:paramtypes", [shell_1.ListParam, Object]),
|
|
44
42
|
tslib_1.__metadata("design:returntype", Promise)
|
|
45
43
|
], GeoContinentQuery.prototype, "geoContinents", null);
|
|
46
44
|
tslib_1.__decorate([
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"geo-continent-query.js","sourceRoot":"","sources":["../../../server/service/geo-continent/geo-continent-query.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"geo-continent-query.js","sourceRoot":"","sources":["../../../server/service/geo-continent/geo-continent-query.ts"],"names":[],"mappings":";;;;AAAA,+CAAmF;AAEnF,yDAAgD;AAChD,iDAAmF;AAEnF,mDAA8C;AAC9C,6DAAuD;AAGvD,IAAa,iBAAiB,GAA9B,MAAa,iBAAiB;IAE5B,KAAK,CAAC,YAAY,CAAY,EAAU,EAAS,OAAwB;QACvE,OAAO,MAAM,IAAA,qBAAa,EAAC,4BAAY,CAAC,CAAC,OAAO,CAAC;YAC/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GAAE,CAAA;;6CAAe,4BAAY;;gDAE/C;AAGD;IADC,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,CAAC;IACb,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAe,4BAAY;;gDAE/C;AAxBU,iBAAiB;IAD7B,IAAA,uBAAQ,EAAC,4BAAY,CAAC;GACV,iBAAiB,CAyB7B;AAzBY,8CAAiB","sourcesContent":["import { Arg, Args, Ctx, FieldResolver, Query, Resolver, Root } from 'type-graphql'\n\nimport { User } from '@things-factory/auth-base'\nimport { convertListParams, getRepository, ListParam } from '@things-factory/shell'\n\nimport { GeoContinent } from './geo-continent'\nimport { GeoContinentList } from './geo-continent-type'\n\n@Resolver(GeoContinent)\nexport class GeoContinentQuery {\n @Query(returns => GeoContinent, { description: 'To fetch a GeoContinent' })\n async geoContinent(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<GeoContinent> {\n return await getRepository(GeoContinent).findOne({\n where: { id }\n })\n }\n\n @Query(returns => GeoContinentList, { description: 'To fetch multiple GeoContinents' })\n async geoContinents(@Args() params: ListParam, @Ctx() context: ResolverContext): Promise<GeoContinentList> {\n const convertedParams = convertListParams(params)\n const [items, total] = await getRepository(GeoContinent).findAndCount(convertedParams)\n\n return { items, total }\n }\n\n @FieldResolver(type => User)\n async updater(@Root() geoContinent: GeoContinent): Promise<User> {\n return await getRepository(User).findOneBy({ id: geoContinent.updaterId })\n }\n\n @FieldResolver(type => User)\n async creator(@Root() geoContinent: GeoContinent): Promise<User> {\n return await getRepository(User).findOneBy({ id: geoContinent.creatorId })\n }\n}\n"]}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var _a, _b;
|
|
3
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
3
|
exports.GeoContinent = void 0;
|
|
5
4
|
const tslib_1 = require("tslib");
|
|
@@ -40,7 +39,7 @@ tslib_1.__decorate([
|
|
|
40
39
|
nullable: true
|
|
41
40
|
}),
|
|
42
41
|
(0, type_graphql_1.Field)({ nullable: true }),
|
|
43
|
-
tslib_1.__metadata("design:type",
|
|
42
|
+
tslib_1.__metadata("design:type", auth_base_1.User)
|
|
44
43
|
], GeoContinent.prototype, "creator", void 0);
|
|
45
44
|
tslib_1.__decorate([
|
|
46
45
|
(0, typeorm_1.RelationId)((geoContinent) => geoContinent.creator),
|
|
@@ -51,7 +50,7 @@ tslib_1.__decorate([
|
|
|
51
50
|
nullable: true
|
|
52
51
|
}),
|
|
53
52
|
(0, type_graphql_1.Field)({ nullable: true }),
|
|
54
|
-
tslib_1.__metadata("design:type",
|
|
53
|
+
tslib_1.__metadata("design:type", auth_base_1.User)
|
|
55
54
|
], GeoContinent.prototype, "updater", void 0);
|
|
56
55
|
tslib_1.__decorate([
|
|
57
56
|
(0, typeorm_1.RelationId)((geoContinent) => geoContinent.creator),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"geo-continent.js","sourceRoot":"","sources":["../../../server/service/geo-continent/geo-continent.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"geo-continent.js","sourceRoot":"","sources":["../../../server/service/geo-continent/geo-continent.ts"],"names":[],"mappings":";;;;AAAA,yDAAgD;AAChD,+CAAoD;AACpD,qCASgB;AAKhB,IAAa,YAAY,GAAzB,MAAa,YAAY;CAwCxB,CAAA;AArCC;IAFC,IAAA,gCAAsB,EAAC,MAAM,CAAC;IAC9B,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,iBAAE,CAAC;;wCACC;AAInB;IAFC,IAAA,gBAAM,GAAE;IACR,IAAA,oBAAK,GAAE;;0CACI;AAMZ;IAJC,IAAA,gBAAM,EAAC;QACN,QAAQ,EAAE,IAAI;KACf,CAAC;IACD,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;iDACN;AAIpB;IAFC,IAAA,0BAAgB,GAAE;IAClB,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;sCACd,IAAI;+CAAA;AAIhB;IAFC,IAAA,0BAAgB,GAAE;IAClB,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;sCACd,IAAI;+CAAA;AAMhB;IAJC,IAAA,mBAAS,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,EAAE;QACvB,QAAQ,EAAE,IAAI;KACf,CAAC;IACD,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;sCAChB,gBAAI;6CAAA;AAGd;IADC,IAAA,oBAAU,EAAC,CAAC,YAA0B,EAAE,EAAE,CAAC,YAAY,CAAC,OAAO,CAAC;;+CAC/C;AAMlB;IAJC,IAAA,mBAAS,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,EAAE;QACvB,QAAQ,EAAE,IAAI;KACf,CAAC;IACD,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;sCAChB,gBAAI;6CAAA;AAGd;IADC,IAAA,oBAAU,EAAC,CAAC,YAA0B,EAAE,EAAE,CAAC,YAAY,CAAC,OAAO,CAAC;;+CAC/C;AAvCP,YAAY;IAHxB,IAAA,gBAAM,GAAE;IACR,IAAA,eAAK,EAAC,oBAAoB,EAAE,CAAC,YAA0B,EAAE,EAAE,CAAC,CAAC,YAAY,CAAC,IAAI,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;IAClG,IAAA,yBAAU,EAAC,EAAE,WAAW,EAAE,yBAAyB,EAAE,CAAC;GAC1C,YAAY,CAwCxB;AAxCY,oCAAY","sourcesContent":["import { User } from '@things-factory/auth-base'\nimport { Field, ID, ObjectType } from 'type-graphql'\nimport {\n Column,\n CreateDateColumn,\n Entity,\n Index,\n ManyToOne,\n PrimaryGeneratedColumn,\n RelationId,\n UpdateDateColumn\n} from 'typeorm'\n\n@Entity()\n@Index('ix_geo_continent_0', (geoContinent: GeoContinent) => [geoContinent.name], { unique: true })\n@ObjectType({ description: 'Entity for GeoContinent' })\nexport class GeoContinent {\n @PrimaryGeneratedColumn('uuid')\n @Field(type => ID)\n readonly id: string\n\n @Column()\n @Field()\n name: string\n\n @Column({\n nullable: true\n })\n @Field({ nullable: true })\n description?: string\n\n @CreateDateColumn()\n @Field({ nullable: true })\n createdAt?: Date\n\n @UpdateDateColumn()\n @Field({ nullable: true })\n updatedAt?: Date\n\n @ManyToOne(type => User, {\n nullable: true\n })\n @Field({ nullable: true })\n creator?: User\n\n @RelationId((geoContinent: GeoContinent) => geoContinent.creator)\n creatorId?: string\n\n @ManyToOne(type => User, {\n nullable: true\n })\n @Field({ nullable: true })\n updater?: User\n\n @RelationId((geoContinent: GeoContinent) => geoContinent.creator)\n updaterId?: string\n}\n"]}
|
|
@@ -35,7 +35,7 @@ let GeoCountryMutation = class GeoCountryMutation {
|
|
|
35
35
|
if (_updateRecords.length > 0) {
|
|
36
36
|
for (let i = 0; i < _updateRecords.length; i++) {
|
|
37
37
|
const newRecord = _updateRecords[i];
|
|
38
|
-
const geoCountry = await geoCountryRepo.
|
|
38
|
+
const geoCountry = await geoCountryRepo.findOneBy({ id: newRecord.id });
|
|
39
39
|
const result = await geoCountryRepo.save(Object.assign(Object.assign(Object.assign({}, geoCountry), newRecord), { updater: user }));
|
|
40
40
|
results.push(Object.assign(Object.assign({}, result), { cuFlag: 'M' }));
|
|
41
41
|
}
|