@things-factory/geography 5.0.11 → 6.0.0-alpha.3
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
|
@@ -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;
|
|
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;AAGnE,IAAa,kBAAkB,GAA/B,MAAa,kBAAkB;IAG7B,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,iCACzC,UAAU,KACb,OAAO,EAAE,IAAI,EACb,OAAO,EAAE,IAAI,IACb,CAAA;IACJ,CAAC;IAID,KAAK,CAAC,gBAAgB,CACT,EAAU,EACP,KAAsB,EAC7B,OAAwB;QAE/B,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAElC,MAAM,UAAU,GAAG,EAAE,CAAC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C,wBAAU,CAAC;GACR,kBAAkB,CAyG9B;AAzGY,gDAAkB","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"]}
|
|
@@ -1,34 +1,36 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var _a;
|
|
3
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
3
|
exports.GeoCountryQuery = 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/geo-continent");
|
|
11
9
|
const geo_country_1 = require("./geo-country");
|
|
12
10
|
const geo_country_type_1 = require("./geo-country-type");
|
|
13
11
|
let GeoCountryQuery = class GeoCountryQuery {
|
|
14
12
|
async geoCountry(id, context) {
|
|
15
|
-
return await (0,
|
|
13
|
+
return await (0, shell_1.getRepository)(geo_country_1.GeoCountry).findOne({
|
|
16
14
|
where: { id }
|
|
17
15
|
});
|
|
18
16
|
}
|
|
19
17
|
async geoCountries(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_country_1.GeoCountry).findAndCount(convertedParams);
|
|
20
|
+
return { items, total };
|
|
21
|
+
}
|
|
22
|
+
async geoCountriesWithoutParam(context) {
|
|
23
|
+
const [items, total] = await (0, shell_1.getRepository)(geo_country_1.GeoCountry).findAndCount();
|
|
22
24
|
return { items, total };
|
|
23
25
|
}
|
|
24
26
|
async geoContinent(geoCountry) {
|
|
25
|
-
return await (0,
|
|
27
|
+
return await (0, shell_1.getRepository)(geo_continent_1.GeoContinent).findOneBy({ id: geoCountry.geoContinentId });
|
|
26
28
|
}
|
|
27
29
|
async updater(geoCountry) {
|
|
28
|
-
return await (0,
|
|
30
|
+
return await (0, shell_1.getRepository)(auth_base_1.User).findOneBy({ id: geoCountry.updaterId });
|
|
29
31
|
}
|
|
30
32
|
async creator(geoCountry) {
|
|
31
|
-
return await (0,
|
|
33
|
+
return await (0, shell_1.getRepository)(auth_base_1.User).findOneBy({ id: geoCountry.creatorId });
|
|
32
34
|
}
|
|
33
35
|
};
|
|
34
36
|
tslib_1.__decorate([
|
|
@@ -44,9 +46,16 @@ tslib_1.__decorate([
|
|
|
44
46
|
tslib_1.__param(0, (0, type_graphql_1.Args)()),
|
|
45
47
|
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
|
46
48
|
tslib_1.__metadata("design:type", Function),
|
|
47
|
-
tslib_1.__metadata("design:paramtypes", [
|
|
49
|
+
tslib_1.__metadata("design:paramtypes", [shell_1.ListParam, Object]),
|
|
48
50
|
tslib_1.__metadata("design:returntype", Promise)
|
|
49
51
|
], GeoCountryQuery.prototype, "geoCountries", null);
|
|
52
|
+
tslib_1.__decorate([
|
|
53
|
+
(0, type_graphql_1.Query)(returns => geo_country_type_1.GeoCountryList, { description: 'To fetch multiple GeoCountries without params' }),
|
|
54
|
+
tslib_1.__param(0, (0, type_graphql_1.Ctx)()),
|
|
55
|
+
tslib_1.__metadata("design:type", Function),
|
|
56
|
+
tslib_1.__metadata("design:paramtypes", [Object]),
|
|
57
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
58
|
+
], GeoCountryQuery.prototype, "geoCountriesWithoutParam", null);
|
|
50
59
|
tslib_1.__decorate([
|
|
51
60
|
(0, type_graphql_1.FieldResolver)(type => geo_continent_1.GeoContinent),
|
|
52
61
|
tslib_1.__param(0, (0, type_graphql_1.Root)()),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"geo-country-query.js","sourceRoot":"","sources":["../../../server/service/geo-country/geo-country-query.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"geo-country-query.js","sourceRoot":"","sources":["../../../server/service/geo-country/geo-country-query.ts"],"names":[],"mappings":";;;;AAAA,+CAAmF;AAEnF,yDAAgD;AAChD,iDAAmF;AAEnF,kEAA6D;AAC7D,+CAA0C;AAC1C,yDAAmD;AAGnD,IAAa,eAAe,GAA5B,MAAa,eAAe;IAE1B,KAAK,CAAC,UAAU,CAAY,EAAU,EAAS,OAAwB;QACrE,OAAO,MAAM,IAAA,qBAAa,EAAC,wBAAU,CAAC,CAAC,OAAO,CAAC;YAC7C,KAAK,EAAE,EAAE,EAAE,EAAE;SACd,CAAC,CAAA;IACJ,CAAC;IAGD,KAAK,CAAC,YAAY,CAAS,MAAiB,EAAS,OAAwB;QAC3E,MAAM,eAAe,GAAG,IAAA,yBAAiB,EAAC,MAAM,CAAC,CAAA;QACjD,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,GAAG,MAAM,IAAA,qBAAa,EAAC,wBAAU,CAAC,CAAC,YAAY,CAAC,eAAe,CAAC,CAAA;QAEpF,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,CAAA;IACzB,CAAC;IAGD,KAAK,CAAC,wBAAwB,CAAQ,OAAwB;QAC5D,MAAM,CAAC,KAAK,EAAE,KAAK,CA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+DAIpC;AAGD;IADC,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,4BAAY,CAAC;IAChB,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAa,wBAAU;;mDAEhD;AAGD;IADC,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,CAAC;IACb,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAa,wBAAU;;8CAE3C;AAGD;IADC,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,CAAC;IACb,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAa,wBAAU;;8CAE3C;AApCU,eAAe;IAD3B,IAAA,uBAAQ,EAAC,wBAAU,CAAC;GACR,eAAe,CAqC3B;AArCY,0CAAe","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/geo-continent'\nimport { GeoCountry } from './geo-country'\nimport { GeoCountryList } from './geo-country-type'\n\n@Resolver(GeoCountry)\nexport class GeoCountryQuery {\n @Query(returns => GeoCountry, { description: 'To fetch a GeoCountry' })\n async geoCountry(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<GeoCountry> {\n return await getRepository(GeoCountry).findOne({\n where: { id }\n })\n }\n\n @Query(returns => GeoCountryList, { description: 'To fetch multiple GeoCountries' })\n async geoCountries(@Args() params: ListParam, @Ctx() context: ResolverContext): Promise<GeoCountryList> {\n const convertedParams = convertListParams(params)\n const [items, total] = await getRepository(GeoCountry).findAndCount(convertedParams)\n\n return { items, total }\n }\n\n @Query(returns => GeoCountryList, { description: 'To fetch multiple GeoCountries without params' })\n async geoCountriesWithoutParam(@Ctx() context: ResolverContext): Promise<GeoCountryList> {\n const [items, total] = await getRepository(GeoCountry).findAndCount()\n\n return { items, total }\n }\n\n @FieldResolver(type => GeoContinent)\n async geoContinent(@Root() geoCountry: GeoCountry): Promise<GeoContinent> {\n return await getRepository(GeoContinent).findOneBy({ id: geoCountry.geoContinentId })\n }\n\n @FieldResolver(type => User)\n async updater(@Root() geoCountry: GeoCountry): Promise<User> {\n return await getRepository(User).findOneBy({ id: geoCountry.updaterId })\n }\n\n @FieldResolver(type => User)\n async creator(@Root() geoCountry: GeoCountry): Promise<User> {\n return await getRepository(User).findOneBy({ id: geoCountry.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.GeoCountry = void 0;
|
|
5
4
|
const tslib_1 = require("tslib");
|
|
@@ -55,7 +54,7 @@ tslib_1.__decorate([
|
|
|
55
54
|
nullable: true
|
|
56
55
|
}),
|
|
57
56
|
(0, type_graphql_1.Field)({ nullable: true }),
|
|
58
|
-
tslib_1.__metadata("design:type",
|
|
57
|
+
tslib_1.__metadata("design:type", auth_base_1.User)
|
|
59
58
|
], GeoCountry.prototype, "creator", void 0);
|
|
60
59
|
tslib_1.__decorate([
|
|
61
60
|
(0, typeorm_1.RelationId)((geoCountry) => geoCountry.creator),
|
|
@@ -66,7 +65,7 @@ tslib_1.__decorate([
|
|
|
66
65
|
nullable: true
|
|
67
66
|
}),
|
|
68
67
|
(0, type_graphql_1.Field)({ nullable: true }),
|
|
69
|
-
tslib_1.__metadata("design:type",
|
|
68
|
+
tslib_1.__metadata("design:type", auth_base_1.User)
|
|
70
69
|
], GeoCountry.prototype, "updater", void 0);
|
|
71
70
|
tslib_1.__decorate([
|
|
72
71
|
(0, typeorm_1.RelationId)((geoCountry) => geoCountry.creator),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"geo-country.js","sourceRoot":"","sources":["../../../server/service/geo-country/geo-country.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"geo-country.js","sourceRoot":"","sources":["../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CAAA;AAGd;IADC,IAAA,oBAAU,EAAC,CAAC,UAAsB,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,CAAC;;6CACzC;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;2CAAA;AAGd;IADC,IAAA,oBAAU,EAAC,CAAC,UAAsB,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,CAAC;;6CACzC;AAlDP,UAAU;IAHtB,IAAA,gBAAM,GAAE;IACR,IAAA,eAAK,EAAC,kBAAkB,EAAE,CAAC,UAAsB,EAAE,EAAE,CAAC,CAAC,UAAU,CAAC,YAAY,EAAE,UAAU,CAAC,IAAI,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;IACnH,IAAA,yBAAU,EAAC,EAAE,WAAW,EAAE,uBAAuB,EAAE,CAAC;GACxC,UAAU,CAmDtB;AAnDY,gCAAU","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 { GeoContinent } from '../geo-continent/geo-continent'\n\n@Entity()\n@Index('ix_geo_country_0', (geoCountry: GeoCountry) => [geoCountry.geoContinent, geoCountry.name], { unique: true })\n@ObjectType({ description: 'Entity for GeoCountry' })\nexport class GeoCountry {\n @PrimaryGeneratedColumn('uuid')\n @Field(type => ID)\n readonly id: string\n\n @ManyToOne(type => GeoContinent)\n @Field()\n geoContinent: GeoContinent\n\n @RelationId((geoCountry: GeoCountry) => geoCountry.geoContinent)\n geoContinentId: 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 isoCode?: 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((geoCountry: GeoCountry) => geoCountry.creator)\n creatorId?: string\n\n @ManyToOne(type => User, {\n nullable: true\n })\n @Field({ nullable: true })\n updater?: User\n\n @RelationId((geoCountry: GeoCountry) => geoCountry.creator)\n updaterId?: string\n}\n"]}
|
|
@@ -35,7 +35,7 @@ let GeoStateMutation = class GeoStateMutation {
|
|
|
35
35
|
if (_updateRecords.length > 0) {
|
|
36
36
|
for (let i = 0; i < _updateRecords.length; i++) {
|
|
37
37
|
const newRecord = _updateRecords[i];
|
|
38
|
-
const geoState = await geoStateRepo.
|
|
38
|
+
const geoState = await geoStateRepo.findOneBy({ id: newRecord.id });
|
|
39
39
|
const result = await geoStateRepo.save(Object.assign(Object.assign(Object.assign({}, geoState), newRecord), { updater: user }));
|
|
40
40
|
results.push(Object.assign(Object.assign({}, result), { cuFlag: 'M' }));
|
|
41
41
|
}
|
|
@@ -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;
|
|
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;AAG7D,IAAa,gBAAgB,GAA7B,MAAa,gBAAgB;IAG3B,KAAK,CAAC,cAAc,CAAkB,QAAqB,EAAS,OAAwB;QAC1F,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAElC,OAAO,MAAM,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S,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;AArGU,gBAAgB;IAD5B,IAAA,uBAAQ,EAAC,oBAAQ,CAAC;GACN,gBAAgB,CAsG5B;AAtGY,4CAAgB","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"]}
|
|
@@ -1,34 +1,32 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var _a;
|
|
3
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
3
|
exports.GeoStateQuery = 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");
|
|
12
10
|
const geo_state_type_1 = require("./geo-state-type");
|
|
13
11
|
let GeoStateQuery = class GeoStateQuery {
|
|
14
12
|
async geoState(id, context) {
|
|
15
|
-
return await (0,
|
|
13
|
+
return await (0, shell_1.getRepository)(geo_state_1.GeoState).findOne({
|
|
16
14
|
where: { id }
|
|
17
15
|
});
|
|
18
16
|
}
|
|
19
17
|
async geoStates(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_state_1.GeoState).findAndCount(convertedParams);
|
|
22
20
|
return { items, total };
|
|
23
21
|
}
|
|
24
22
|
async geoCountry(geoState) {
|
|
25
|
-
return await (0,
|
|
23
|
+
return await (0, shell_1.getRepository)(geo_country_1.GeoCountry).findOneBy({ id: geoState.geoCountryId });
|
|
26
24
|
}
|
|
27
25
|
async updater(geoState) {
|
|
28
|
-
return await (0,
|
|
26
|
+
return await (0, shell_1.getRepository)(auth_base_1.User).findOneBy({ id: geoState.updaterId });
|
|
29
27
|
}
|
|
30
28
|
async creator(geoState) {
|
|
31
|
-
return await (0,
|
|
29
|
+
return await (0, shell_1.getRepository)(auth_base_1.User).findOneBy({ id: geoState.creatorId });
|
|
32
30
|
}
|
|
33
31
|
};
|
|
34
32
|
tslib_1.__decorate([
|
|
@@ -44,7 +42,7 @@ tslib_1.__decorate([
|
|
|
44
42
|
tslib_1.__param(0, (0, type_graphql_1.Args)()),
|
|
45
43
|
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
|
46
44
|
tslib_1.__metadata("design:type", Function),
|
|
47
|
-
tslib_1.__metadata("design:paramtypes", [
|
|
45
|
+
tslib_1.__metadata("design:paramtypes", [shell_1.ListParam, Object]),
|
|
48
46
|
tslib_1.__metadata("design:returntype", Promise)
|
|
49
47
|
], GeoStateQuery.prototype, "geoStates", null);
|
|
50
48
|
tslib_1.__decorate([
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"geo-state-query.js","sourceRoot":"","sources":["../../../server/service/geo-state/geo-state-query.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"geo-state-query.js","sourceRoot":"","sources":["../../../server/service/geo-state/geo-state-query.ts"],"names":[],"mappings":";;;;AAAA,+CAAmF;AAEnF,yDAAgD;AAChD,iDAAmF;AAEnF,4DAAuD;AACvD,2CAAsC;AACtC,qDAA+C;AAG/C,IAAa,aAAa,GAA1B,MAAa,aAAa;IAExB,KAAK,CAAC,QAAQ,CAAY,EAAU,EAAS,OAAwB;QACnE,OAAO,MAAM,IAAA,qBAAa,EAAC,oBAAQ,CAAC,CAAC,OAAO,CAAC;YAC3C,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,oBAAQ,CAAC,CAAC,YAAY,CAAC,eAAe,CAAC,CAAA;QAElF,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,CAAA;IACzB,CAAC;IAGD,KAAK,CAAC,UAAU,CAAS,QAAkB;QACzC,OAAO,MAAM,IAAA,qBAAa,EAAC,wBAAU,CAAC,CAAC,SAAS,CAAC,EAAE,EAAE,EAAE,QAAQ,CAAC,YAAY,EAAE,CAAC,CAAA;IACjF,CAAC;IAGD,KAAK,CAAC,OAAO,CAAS,QAAkB;QACtC,OAAO,MAAM,IAAA,qBAAa,EAAC,gBAAI,CAAC,CAAC,SAAS,CAAC,EAAE,EAAE,EAAE,QAAQ,CAAC,SAAS,EAAE,CAAC,CAAA;IACxE,CAAC;IAGD,KAAK,CAAC,OAAO,CAAS,QAAkB;QACtC,OAAO,MAAM,IAAA,qBAAa,EAAC,gBAAI,CAAC,CAAC,SAAS,CAAC,EAAE,EAAE,EAAE,QAAQ,CAAC,SAAS,EAAE,CAAC,CAAA;IACxE,CAAC;CACF,CAAA;AA5BC;IADC,IAAA,oBAAK,EAAC,OAAO,CAAC,EAAE,CAAC,oBAAQ,EAAE,EAAE,WAAW,EAAE,qBAAqB,EAAE,CAAC;IACnD,mBAAA,IAAA,kBAAG,EAAC,IAAI,CAAC,CAAA;IAAc,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;6CAI3C;AAGD;IADC,IAAA,oBAAK,EAAC,OAAO,CAAC,EAAE,CAAC,6BAAY,EAAE,EAAE,WAAW,EAAE,6BAA6B,EAAE,CAAC;IAC9D,mBAAA,IAAA,mBAAI,GAAE,CAAA;IAAqB,mBAAA,IAAA,kBAAG,GAAE,CAAA;;6CAAjB,iBAAS;;8CAKxC;AAGD;IADC,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,wBAAU,CAAC;IAChB,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAW,oBAAQ;;+CAE1C;AAGD;IADC,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,CAAC;IACb,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAW,oBAAQ;;4CAEvC;AAGD;IADC,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,CAAC;IACb,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAW,oBAAQ;;4CAEvC;AA7BU,aAAa;IADzB,IAAA,uBAAQ,EAAC,oBAAQ,CAAC;GACN,aAAa,CA8BzB;AA9BY,sCAAa","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'\nimport { GeoStateList } from './geo-state-type'\n\n@Resolver(GeoState)\nexport class GeoStateQuery {\n @Query(returns => GeoState, { description: 'To fetch a GeoState' })\n async geoState(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<GeoState> {\n return await getRepository(GeoState).findOne({\n where: { id }\n })\n }\n\n @Query(returns => GeoStateList, { description: 'To fetch multiple GeoStates' })\n async geoStates(@Args() params: ListParam, @Ctx() context: ResolverContext): Promise<GeoStateList> {\n const convertedParams = convertListParams(params)\n const [items, total] = await getRepository(GeoState).findAndCount(convertedParams)\n\n return { items, total }\n }\n\n @FieldResolver(type => GeoCountry)\n async geoCountry(@Root() geoState: GeoState): Promise<GeoCountry> {\n return await getRepository(GeoCountry).findOneBy({ id: geoState.geoCountryId })\n }\n\n @FieldResolver(type => User)\n async updater(@Root() geoState: GeoState): Promise<User> {\n return await getRepository(User).findOneBy({ id: geoState.updaterId })\n }\n\n @FieldResolver(type => User)\n async creator(@Root() geoState: GeoState): Promise<User> {\n return await getRepository(User).findOneBy({ id: geoState.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.GeoState = void 0;
|
|
5
4
|
const tslib_1 = require("tslib");
|
|
@@ -60,7 +59,7 @@ tslib_1.__decorate([
|
|
|
60
59
|
nullable: true
|
|
61
60
|
}),
|
|
62
61
|
(0, type_graphql_1.Field)({ nullable: true }),
|
|
63
|
-
tslib_1.__metadata("design:type",
|
|
62
|
+
tslib_1.__metadata("design:type", auth_base_1.User)
|
|
64
63
|
], GeoState.prototype, "creator", void 0);
|
|
65
64
|
tslib_1.__decorate([
|
|
66
65
|
(0, typeorm_1.RelationId)((geoState) => geoState.creator),
|
|
@@ -71,7 +70,7 @@ tslib_1.__decorate([
|
|
|
71
70
|
nullable: true
|
|
72
71
|
}),
|
|
73
72
|
(0, type_graphql_1.Field)({ nullable: true }),
|
|
74
|
-
tslib_1.__metadata("design:type",
|
|
73
|
+
tslib_1.__metadata("design:type", auth_base_1.User)
|
|
75
74
|
], GeoState.prototype, "updater", void 0);
|
|
76
75
|
tslib_1.__decorate([
|
|
77
76
|
(0, typeorm_1.RelationId)((geoState) => geoState.creator),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"geo-state.js","sourceRoot":"","sources":["../../../server/service/geo-state/geo-state.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"geo-state.js","sourceRoot":"","sources":["../../../server/service/geo-state/geo-state.ts"],"names":[],"mappings":";;;;AAAA,yDAAgD;AAChD,+CAAoD;AACpD,qCASgB;AAChB,4DAAuD;AAKvD,IAAa,QAAQ,GAArB,MAAa,QAAQ;CAuDpB,CAAA;AApDC;IAFC,IAAA,gCAAsB,EAAC,MAAM,CAAC;IAC9B,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,iBAAE,CAAC;;oCACC;AAInB;IAFC,IAAA,mBAAS,EAAC,IAAI,CAAC,EAAE,CAAC,wBAAU,CAAC;IAC7B,IAAA,oBAAK,GAAE;sCACI,wBAAU;4CAAA;AAGtB;IADC,IAAA,oBAAU,EAAC,CAAC,QAAkB,EAAE,EAAE,CAAC,QAAQ,CAAC,UAAU,CAAC;;8CACpC;AAIpB;IAFC,IAAA,gBAAM,GAAE;IACR,IAAA,oBAAK,GAAE;;sCACI;AAMZ;IAJC,IAAA,gBAAM,EAAC;QACN,QAAQ,EAAE,IAAI;KACf,CAAC;IACD,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;6CACN;AAIpB;IAFC,IAAA,gBAAM,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IAC1B,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;0CACT;AAIjB;IAFC,IAAA,gBAAM,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IAC1B,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;2CACR;AAIlB;IAFC,IAAA,0BAAgB,GAAE;IAClB,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;sCACd,IAAI;2CAAA;AAIhB;IAFC,IAAA,0BAAgB,GAAE;IAClB,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;sCACd,IAAI;2CAAA;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;yCAAA;AAGd;IADC,IAAA,oBAAU,EAAC,CAAC,QAAkB,EAAE,EAAE,CAAC,QAAQ,CAAC,OAAO,CAAC;;2CACnC;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;yCAAA;AAGd;IADC,IAAA,oBAAU,EAAC,CAAC,QAAkB,EAAE,EAAE,CAAC,QAAQ,CAAC,OAAO,CAAC;;2CACnC;AAtDP,QAAQ;IAHpB,IAAA,gBAAM,GAAE;IACR,IAAA,eAAK,EAAC,gBAAgB,EAAE,CAAC,QAAkB,EAAE,EAAE,CAAC,CAAC,QAAQ,CAAC,UAAU,EAAE,QAAQ,CAAC,IAAI,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;IACvG,IAAA,yBAAU,EAAC,EAAE,WAAW,EAAE,qBAAqB,EAAE,CAAC;GACtC,QAAQ,CAuDpB;AAvDY,4BAAQ","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'\n\n@Entity()\n@Index('ix_geo_state_0', (geoState: GeoState) => [geoState.geoCountry, geoState.name], { unique: true })\n@ObjectType({ description: 'Entity for GeoState' })\nexport class GeoState {\n @PrimaryGeneratedColumn('uuid')\n @Field(type => ID)\n readonly id: string\n\n @ManyToOne(type => GeoCountry)\n @Field()\n geoCountry: GeoCountry\n\n @RelationId((geoState: GeoState) => geoState.geoCountry)\n geoCountryId: 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((geoState: GeoState) => geoState.creator)\n creatorId?: string\n\n @ManyToOne(type => User, {\n nullable: true\n })\n @Field({ nullable: true })\n updater?: User\n\n @RelationId((geoState: GeoState) => geoState.creator)\n updaterId?: string\n}\n"]}
|