@things-factory/biz-base 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/biz-option/biz-option-mutation.js +11 -7
- package/dist-server/service/biz-option/biz-option-mutation.js.map +1 -1
- package/dist-server/service/biz-option/biz-option-query.js +4 -6
- package/dist-server/service/biz-option/biz-option-query.js.map +1 -1
- package/dist-server/service/biz-option/biz-option-types.js +1 -2
- package/dist-server/service/biz-option/biz-option-types.js.map +1 -1
- package/dist-server/service/biz-option/biz-option.js +3 -4
- package/dist-server/service/biz-option/biz-option.js.map +1 -1
- package/dist-server/service/biz-option-detail/biz-option-detail-mutation.js +7 -6
- package/dist-server/service/biz-option-detail/biz-option-detail-mutation.js.map +1 -1
- package/dist-server/service/biz-option-detail/biz-option-detail-query.js +4 -6
- package/dist-server/service/biz-option-detail/biz-option-detail-query.js.map +1 -1
- package/dist-server/service/biz-option-detail/biz-option-detail-types.js +1 -2
- package/dist-server/service/biz-option-detail/biz-option-detail-types.js.map +1 -1
- package/dist-server/service/biz-option-detail/biz-option-detail.js +3 -4
- package/dist-server/service/biz-option-detail/biz-option-detail.js.map +1 -1
- package/dist-server/service/bizplace/bizplace-mutation.js +15 -16
- package/dist-server/service/bizplace/bizplace-mutation.js.map +1 -1
- package/dist-server/service/bizplace/bizplace-query.js +18 -16
- package/dist-server/service/bizplace/bizplace-query.js.map +1 -1
- package/dist-server/service/bizplace/bizplace-types.js +2 -3
- package/dist-server/service/bizplace/bizplace-types.js.map +1 -1
- package/dist-server/service/bizplace/bizplace.js +3 -4
- package/dist-server/service/bizplace/bizplace.js.map +1 -1
- package/dist-server/service/company/company-mutation.js +8 -8
- package/dist-server/service/company/company-mutation.js.map +1 -1
- package/dist-server/service/company/company-query.js +6 -7
- package/dist-server/service/company/company-query.js.map +1 -1
- package/dist-server/service/company/company.js +3 -4
- package/dist-server/service/company/company.js.map +1 -1
- package/dist-server/service/contact-point/contact-point-mutation.js +12 -12
- package/dist-server/service/contact-point/contact-point-mutation.js.map +1 -1
- package/dist-server/service/contact-point/contact-point-query.js +4 -6
- package/dist-server/service/contact-point/contact-point-query.js.map +1 -1
- package/dist-server/service/contact-point/contact-point-types.js +2 -3
- package/dist-server/service/contact-point/contact-point-types.js.map +1 -1
- package/dist-server/service/contact-point/contact-point.js +3 -4
- package/dist-server/service/contact-point/contact-point.js.map +1 -1
- package/dist-server/service/worker/worker-mutation.js +8 -7
- package/dist-server/service/worker/worker-mutation.js.map +1 -1
- package/dist-server/service/worker/worker-query.js +3 -4
- package/dist-server/service/worker/worker-query.js.map +1 -1
- package/dist-server/service/worker/worker-types.js +2 -3
- package/dist-server/service/worker/worker-types.js.map +1 -1
- package/dist-server/service/worker/worker.js +3 -4
- package/dist-server/service/worker/worker.js.map +1 -1
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/dist-server/utils/get-permitted-bizplaces.js +30 -24
- package/dist-server/utils/get-permitted-bizplaces.js.map +1 -1
- package/package.json +3 -3
- package/server/service/biz-option/biz-option-mutation.ts +26 -12
- package/server/service/biz-option/biz-option-query.ts +4 -5
- package/server/service/biz-option-detail/biz-option-detail-mutation.ts +13 -8
- package/server/service/biz-option-detail/biz-option-detail-query.ts +3 -4
- package/server/service/bizplace/bizplace-mutation.ts +11 -12
- package/server/service/bizplace/bizplace-query.ts +18 -12
- package/server/service/company/company-mutation.ts +15 -9
- package/server/service/company/company-query.ts +9 -9
- package/server/service/contact-point/contact-point-mutation.ts +17 -15
- package/server/service/contact-point/contact-point-query.ts +4 -5
- package/server/service/worker/worker-mutation.ts +10 -10
- package/server/service/worker/worker-query.ts +4 -4
- package/server/utils/get-permitted-bizplaces.ts +12 -6
|
@@ -4,26 +4,30 @@ exports.BizOptionMutation = void 0;
|
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const type_graphql_1 = require("type-graphql");
|
|
6
6
|
const typeorm_1 = require("typeorm");
|
|
7
|
+
const shell_1 = require("@things-factory/shell");
|
|
7
8
|
const biz_option_1 = require("./biz-option");
|
|
8
9
|
const biz_option_types_1 = require("./biz-option-types");
|
|
9
10
|
let BizOptionMutation = class BizOptionMutation {
|
|
10
11
|
async createBizOption(bizOption, context) {
|
|
11
|
-
|
|
12
|
+
const { domain, user } = context.state;
|
|
13
|
+
return await (0, shell_1.getRepository)(biz_option_1.BizOption).save(Object.assign(Object.assign({}, bizOption), { domain: domain, creator: user, updater: user }));
|
|
12
14
|
}
|
|
13
15
|
async updateBizOption(name, patch, context) {
|
|
14
|
-
const
|
|
16
|
+
const { domain, user } = context.state;
|
|
17
|
+
const repository = (0, shell_1.getRepository)(biz_option_1.BizOption);
|
|
15
18
|
const bizOption = await repository.findOne({
|
|
16
|
-
where: { domain:
|
|
19
|
+
where: { domain: { id: domain.id }, name }
|
|
17
20
|
});
|
|
18
|
-
return await repository.save(Object.assign(Object.assign(Object.assign({}, bizOption), patch), { updater:
|
|
21
|
+
return await repository.save(Object.assign(Object.assign(Object.assign({}, bizOption), patch), { updater: user }));
|
|
19
22
|
}
|
|
20
23
|
async deleteBizOption(name, context) {
|
|
21
|
-
|
|
24
|
+
const { domain } = context.state;
|
|
25
|
+
await (0, shell_1.getRepository)(biz_option_1.BizOption).delete({ domain: { id: domain.id }, name });
|
|
22
26
|
return true;
|
|
23
27
|
}
|
|
24
28
|
async deleteBizOptions(names, context) {
|
|
25
|
-
await (0,
|
|
26
|
-
domain: context.state.domain,
|
|
29
|
+
await (0, shell_1.getRepository)(biz_option_1.BizOption).delete({
|
|
30
|
+
domain: { id: context.state.domain.id },
|
|
27
31
|
name: (0, typeorm_1.In)(names)
|
|
28
32
|
});
|
|
29
33
|
return true;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"biz-option-mutation.js","sourceRoot":"","sources":["../../../server/service/biz-option/biz-option-mutation.ts"],"names":[],"mappings":";;;;AAAA,+CAA2D;AAC3D,
|
|
1
|
+
{"version":3,"file":"biz-option-m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esContent":["import { Arg, Ctx, Mutation, Resolver } from 'type-graphql'\nimport { In } from 'typeorm'\n\nimport { getRepository } from '@things-factory/shell'\n\nimport { BizOption } from './biz-option'\nimport { BizOptionPatch, NewBizOption } from './biz-option-types'\n\n@Resolver(BizOption)\nexport class BizOptionMutation {\n @Mutation(returns => BizOption)\n async createBizOption(\n @Arg('bizOption') bizOption: NewBizOption,\n @Ctx() context: ResolverContext\n ): Promise<BizOption> {\n const { domain, user } = context.state\n\n return await getRepository(BizOption).save({\n ...bizOption,\n domain: domain,\n creator: user,\n updater: user\n })\n }\n\n @Mutation(returns => BizOption)\n async updateBizOption(\n @Arg('name') name: string,\n @Arg('patch') patch: BizOptionPatch,\n @Ctx() context: ResolverContext\n ): Promise<BizOption> {\n const { domain, user } = context.state\n\n const repository = getRepository(BizOption)\n const bizOption = await repository.findOne({\n where: { domain: { id: domain.id }, name }\n })\n\n return await repository.save({\n ...bizOption,\n ...patch,\n updater: user\n })\n }\n\n @Mutation(returns => Boolean)\n async deleteBizOption(@Arg('name') name: string, @Ctx() context: ResolverContext): Promise<Boolean> {\n const { domain } = context.state\n\n await getRepository(BizOption).delete({ domain: { id: domain.id }, name })\n return true\n }\n\n @Mutation(returns => Boolean)\n async deleteBizOptions(\n @Arg('names', type => [String]) names: string[],\n @Ctx() context: ResolverContext\n ): Promise<Boolean> {\n await getRepository(BizOption).delete({\n domain: { id: context.state.domain.id },\n name: In(names)\n })\n return true\n }\n}\n"]}
|
|
@@ -1,23 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var _a;
|
|
3
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
3
|
exports.BizOptionQuery = void 0;
|
|
5
4
|
const tslib_1 = require("tslib");
|
|
6
5
|
const type_graphql_1 = require("type-graphql");
|
|
7
|
-
const typeorm_1 = require("typeorm");
|
|
8
6
|
const shell_1 = require("@things-factory/shell");
|
|
9
7
|
const biz_option_1 = require("./biz-option");
|
|
10
8
|
const biz_option_types_1 = require("./biz-option-types");
|
|
11
9
|
let BizOptionQuery = class BizOptionQuery {
|
|
12
10
|
async bizOption(name, context) {
|
|
13
|
-
return await (0,
|
|
14
|
-
where: { domain: context.state.domain, name },
|
|
11
|
+
return await (0, shell_1.getRepository)(biz_option_1.BizOption).findOne({
|
|
12
|
+
where: { domain: { id: context.state.domain.id }, name },
|
|
15
13
|
relations: ['domain', 'bizplace', 'bizOptionDetails', 'creator', 'updater']
|
|
16
14
|
});
|
|
17
15
|
}
|
|
18
16
|
async bizOptions(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)(biz_option_1.BizOption).findAndCount(Object.assign(Object.assign({}, convertedParams), { relations: ['domain', 'bizplace', 'bizOptionDetails', 'creator', 'updater'] }));
|
|
21
19
|
return { items, total };
|
|
22
20
|
}
|
|
23
21
|
};
|
|
@@ -34,7 +32,7 @@ tslib_1.__decorate([
|
|
|
34
32
|
tslib_1.__param(0, (0, type_graphql_1.Args)()),
|
|
35
33
|
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
|
36
34
|
tslib_1.__metadata("design:type", Function),
|
|
37
|
-
tslib_1.__metadata("design:paramtypes", [
|
|
35
|
+
tslib_1.__metadata("design:paramtypes", [shell_1.ListParam, Object]),
|
|
38
36
|
tslib_1.__metadata("design:returntype", Promise)
|
|
39
37
|
], BizOptionQuery.prototype, "bizOptions", null);
|
|
40
38
|
BizOptionQuery = tslib_1.__decorate([
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"biz-option-query.js","sourceRoot":"","sources":["../../../server/service/biz-option/biz-option-query.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"biz-option-query.js","sourceRoot":"","sources":["../../../server/service/biz-option/biz-option-query.ts"],"names":[],"mappings":";;;;AAAA,+CAA8D;AAE9D,iDAAmF;AAEnF,6CAAwC;AACxC,yDAAkD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":["import { Arg, Args, Ctx, Query, Resolver } from 'type-graphql'\n\nimport { convertListParams, getRepository, ListParam } from '@things-factory/shell'\n\nimport { BizOption } from './biz-option'\nimport { BizOptionList } from './biz-option-types'\n\n@Resolver(BizOption)\nexport class BizOptionQuery {\n @Query(returns => BizOption)\n async bizOption(@Arg('name') name: string, @Ctx() context: ResolverContext): Promise<BizOption> {\n return await getRepository(BizOption).findOne({\n where: { domain: { id: context.state.domain.id }, name },\n relations: ['domain', 'bizplace', 'bizOptionDetails', 'creator', 'updater']\n })\n }\n\n @Query(returns => BizOptionList)\n async bizOptions(@Args() params: ListParam, @Ctx() context: ResolverContext): Promise<BizOptionList> {\n const convertedParams = convertListParams(params)\n const [items, total] = await getRepository(BizOption).findAndCount({\n ...convertedParams,\n relations: ['domain', 'bizplace', 'bizOptionDetails', 'creator', 'updater']\n })\n return { items, total }\n }\n}\n"]}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var _a;
|
|
3
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
3
|
exports.NewBizOption = exports.BizOptionPatch = exports.BizOptionList = void 0;
|
|
5
4
|
const tslib_1 = require("tslib");
|
|
@@ -36,7 +35,7 @@ tslib_1.__decorate([
|
|
|
36
35
|
], BizOptionPatch.prototype, "description", void 0);
|
|
37
36
|
tslib_1.__decorate([
|
|
38
37
|
(0, type_graphql_1.Field)(type => shell_1.ObjectRef, { nullable: true }),
|
|
39
|
-
tslib_1.__metadata("design:type",
|
|
38
|
+
tslib_1.__metadata("design:type", shell_1.ObjectRef)
|
|
40
39
|
], BizOptionPatch.prototype, "bizplace", void 0);
|
|
41
40
|
tslib_1.__decorate([
|
|
42
41
|
(0, type_graphql_1.Field)(type => [shell_1.ObjectRef], { nullable: true }),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"biz-option-types.js","sourceRoot":"","sources":["../../../server/service/biz-option/biz-option-types.ts"],"names":[],"mappings":"
|
|
1
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;IADC,IAAA,oBAAK,GAAE;;0CACI;AAGZ;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;iDACN;AALT,YAAY;IADxB,IAAA,wBAAS,GAAE;GACC,YAAY,CAMxB;AANY,oCAAY","sourcesContent":["import { Field, InputType, Int, ObjectType } from 'type-graphql'\n\nimport { ObjectRef } from '@things-factory/shell'\n\nimport { BizOption } from './biz-option'\n\n@ObjectType()\nexport class BizOptionList {\n @Field(type => [BizOption], { nullable: true })\n items?: BizOption[]\n\n @Field(type => Int, { nullable: true })\n total?: number\n}\n\n@InputType()\nexport class BizOptionPatch {\n @Field({ nullable: true })\n id?: string\n\n @Field({ nullable: true })\n name?: string\n\n @Field({ nullable: true })\n description?: string\n\n @Field(type => ObjectRef, { nullable: true })\n bizplace?: ObjectRef\n\n @Field(type => [ObjectRef], { nullable: true })\n bizOptionDetails?: ObjectRef[]\n\n @Field({ nullable: true })\n cuFlag?: string\n}\n\n@InputType()\nexport class NewBizOption {\n @Field()\n name: string\n\n @Field({ nullable: true })\n description?: string\n}\n"]}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var _a, _b, _c;
|
|
3
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
3
|
exports.BizOption = void 0;
|
|
5
4
|
const tslib_1 = require("tslib");
|
|
@@ -19,7 +18,7 @@ tslib_1.__decorate([
|
|
|
19
18
|
tslib_1.__decorate([
|
|
20
19
|
(0, typeorm_1.ManyToOne)(type => shell_1.Domain, { nullable: true }),
|
|
21
20
|
(0, type_graphql_1.Field)({ nullable: true }),
|
|
22
|
-
tslib_1.__metadata("design:type",
|
|
21
|
+
tslib_1.__metadata("design:type", shell_1.Domain)
|
|
23
22
|
], BizOption.prototype, "domain", void 0);
|
|
24
23
|
tslib_1.__decorate([
|
|
25
24
|
(0, typeorm_1.Column)(),
|
|
@@ -60,14 +59,14 @@ 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
|
], BizOption.prototype, "creator", void 0);
|
|
65
64
|
tslib_1.__decorate([
|
|
66
65
|
(0, typeorm_1.ManyToOne)(type => auth_base_1.User, {
|
|
67
66
|
nullable: true
|
|
68
67
|
}),
|
|
69
68
|
(0, type_graphql_1.Field)({ nullable: true }),
|
|
70
|
-
tslib_1.__metadata("design:type",
|
|
69
|
+
tslib_1.__metadata("design:type", auth_base_1.User)
|
|
71
70
|
], BizOption.prototype, "updater", void 0);
|
|
72
71
|
BizOption = tslib_1.__decorate([
|
|
73
72
|
(0, typeorm_1.Entity)(),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"biz-option.js","sourceRoot":"","sources":["../../../server/service/biz-option/biz-option.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"biz-option.js","sourceRoot":"","sources":["../../../server/service/biz-option/biz-option.ts"],"names":[],"mappings":";;;;AAAA,+CAAoD;AACpD,qCASgB;AAEhB,yDAAgD;AAChD,iDAA8C;AAE9C,8EAAwE;AACxE,mDAA+C;AAK/C,IAAa,SAAS,GAAtB,MAAa,SAAS;CAgDrB,CAAA;AA7CC;IAFC,IAAA,gCAAsB,EAAC,MAAM,CAAC;IAC9B,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,iBAAE,CAAC;;qCACR;AAIV;IAFC,IAAA,mBAAS,EAAC,IAAI,CAAC,EAAE,CAAC,cAAM,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IAC7C,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;sCAClB,cAAM;yCAAA;AAId;IAFC,IAAA,gBAAM,GAAE;IACR,IAAA,oBAAK,GAAE;;uCACI;AAMZ;IAJC,IAAA,mBAAS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AC,iBAAiB,EAAE,CAAC,SAAoB,EAAE,EAAE,CAAC,CAAC,SAAS,CAAC,QAAQ,EAAE,SAAS,CAAC,IAAI,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;IAC1G,IAAA,yBAAU,GAAE;GACA,SAAS,CAgDrB;AAhDY,8BAAS","sourcesContent":["import { Field, ID, ObjectType } from 'type-graphql'\nimport {\n Column,\n CreateDateColumn,\n Entity,\n Index,\n ManyToOne,\n OneToMany,\n PrimaryGeneratedColumn,\n UpdateDateColumn\n} from 'typeorm'\n\nimport { User } from '@things-factory/auth-base'\nimport { Domain } from '@things-factory/shell'\n\nimport { BizOptionDetail } from '../biz-option-detail/biz-option-detail'\nimport { Bizplace } from '../bizplace/bizplace'\n\n@Entity()\n@Index('ix_biz-option_0', (bizOption: BizOption) => [bizOption.bizplace, bizOption.name], { unique: true })\n@ObjectType()\nexport class BizOption {\n @PrimaryGeneratedColumn('uuid')\n @Field(type => ID)\n id: string\n\n @ManyToOne(type => Domain, { nullable: true })\n @Field({ nullable: true })\n domain: Domain\n\n @Column()\n @Field()\n name: string\n\n @ManyToOne(type => Bizplace, {\n nullable: false\n })\n @Field(type => Bizplace, { nullable: true })\n bizplace: Bizplace\n\n @OneToMany(type => BizOptionDetail, bizOptionDetail => bizOptionDetail.bizOption)\n @Field(type => BizOptionDetail, { nullable: true })\n bizOptionDetails: BizOptionDetail[]\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 @ManyToOne(type => User, {\n nullable: true\n })\n @Field({ nullable: true })\n updater: User\n}\n"]}
|
|
@@ -4,26 +4,27 @@ exports.BizOptionDetailMutation = void 0;
|
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const type_graphql_1 = require("type-graphql");
|
|
6
6
|
const typeorm_1 = require("typeorm");
|
|
7
|
+
const shell_1 = require("@things-factory/shell");
|
|
7
8
|
const biz_option_detail_1 = require("./biz-option-detail");
|
|
8
9
|
const biz_option_detail_types_1 = require("./biz-option-detail-types");
|
|
9
10
|
let BizOptionDetailMutation = class BizOptionDetailMutation {
|
|
10
11
|
async createBizOptionDetail(bizOptionDetail, context) {
|
|
11
|
-
return await (0,
|
|
12
|
+
return await (0, shell_1.getRepository)(biz_option_detail_1.BizOptionDetail).save(Object.assign(Object.assign({}, bizOptionDetail), { domain: context.state.domain, creator: context.state.user, updater: context.state.user }));
|
|
12
13
|
}
|
|
13
14
|
async updateBizOptionDetail(name, patch, context) {
|
|
14
|
-
const repository = (0,
|
|
15
|
+
const repository = (0, shell_1.getRepository)(biz_option_detail_1.BizOptionDetail);
|
|
15
16
|
const bizOptionDetail = await repository.findOne({
|
|
16
|
-
where: { domain: context.state.domain, name }
|
|
17
|
+
where: { domain: { id: context.state.domain.id }, name }
|
|
17
18
|
});
|
|
18
19
|
return await repository.save(Object.assign(Object.assign(Object.assign({}, bizOptionDetail), patch), { updater: context.state.user }));
|
|
19
20
|
}
|
|
20
21
|
async deleteBizOptionDetail(name, context) {
|
|
21
|
-
await (0,
|
|
22
|
+
await (0, shell_1.getRepository)(biz_option_detail_1.BizOptionDetail).delete({ domain: { id: context.state.domain.id }, name });
|
|
22
23
|
return true;
|
|
23
24
|
}
|
|
24
25
|
async deleteBizOptionDetails(names, context) {
|
|
25
|
-
await (0,
|
|
26
|
-
domain: context.state.domain,
|
|
26
|
+
await (0, shell_1.getRepository)(biz_option_detail_1.BizOptionDetail).delete({
|
|
27
|
+
domain: { id: context.state.domain.id },
|
|
27
28
|
name: (0, typeorm_1.In)(names)
|
|
28
29
|
});
|
|
29
30
|
return true;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"biz-option-detail-mutation.js","sourceRoot":"","sources":["../../../server/service/biz-option-detail/biz-option-detail-mutation.ts"],"names":[],"mappings":";;;;AAAA,+CAA2D;AAC3D,
|
|
1
|
+
{"version":3,"file":"biz-option-detail-mutation.js","sourceRoot":"","sources":["../../../server/service/biz-option-detail/biz-option-detail-mutation.ts"],"names":[],"mappings":";;;;AAAA,+CAA2D;AAC3D,qCAA4B;AAE5B,iDAAqD;AAErD,2DAAqD;AACrD,uEAAoF;AAGpF,IAAa,uBAAuB,GAApC,MAAa,uBAAuB;IAElC,KAAK,CAAC,qBAAqB,CACD,eAAmC,EACpD,OAAwB;QAE/B,OAAO,MAAM,IAAA,qBAAa,EAAC,mCAAe,CAAC,CAAC,IAAI,iCAC3C,eAAe,KAClB,MAAM,EAAE,OAAO,CAAC,KAAK,CAAC,MAAM,EAC5B,OAAO,EAAE,OAAO,CAAC,KAAK,CAAC,IAAI,EAC3B,OAAO,EAAE,OAAO,CAAC,KAAK,CAAC,IAAI,IAC3B,CAAA;IACJ,CAAC;IAGD,KAAK,CAAC,qBAAqB,CACZ,IAAY,EACX,KAA2B,EAClC,OAAwB;QAE/B,MAAM,UAAU,GAAG,IAAA,qBAAa,EAAC,mCAAe,CAAC,CAAA;QACjD,MAAM,eAAe,GAAG,MAAM,UAAU,CAAC,OAAO,CAAC;YAC/C,KAAK,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE;SACzD,CAAC,CAAA;QAEF,OAAO,MAAM,UAAU,CAAC,IAAI,+CACvB,eAAe,GACf,KAAK,KACR,OAAO,EAAE,OAAO,CAAC,KAAK,CAAC,IAAI,IAC3B,CAAA;IACJ,CAAC;IAGD,KAAK,CAAC,qBAAqB,CAAc,IAAY,EAAS,OAAwB;QACpF,MAAM,IAAA,qBAAa,EAAC,mCAAe,CAAC,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,EAAE,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CAAC;GACb,uBAAuB,CAiDnC;AAjDY,0DAAuB","sourcesContent":["import { Arg, Ctx, Mutation, Resolver } from 'type-graphql'\nimport { In } from 'typeorm'\n\nimport { getRepository } from '@things-factory/shell'\n\nimport { BizOptionDetail } from './biz-option-detail'\nimport { BizOptionDetailPatch, NewBizOptionDetail } from './biz-option-detail-types'\n\n@Resolver(BizOptionDetail)\nexport class BizOptionDetailMutation {\n @Mutation(returns => BizOptionDetail)\n async createBizOptionDetail(\n @Arg('bizOptionDetail') bizOptionDetail: NewBizOptionDetail,\n @Ctx() context: ResolverContext\n ): Promise<BizOptionDetail> {\n return await getRepository(BizOptionDetail).save({\n ...bizOptionDetail,\n domain: context.state.domain,\n creator: context.state.user,\n updater: context.state.user\n })\n }\n\n @Mutation(returns => BizOptionDetail)\n async updateBizOptionDetail(\n @Arg('name') name: string,\n @Arg('patch') patch: BizOptionDetailPatch,\n @Ctx() context: ResolverContext\n ): Promise<BizOptionDetail> {\n const repository = getRepository(BizOptionDetail)\n const bizOptionDetail = await repository.findOne({\n where: { domain: { id: context.state.domain.id }, name }\n })\n\n return await repository.save({\n ...bizOptionDetail,\n ...patch,\n updater: context.state.user\n })\n }\n\n @Mutation(returns => Boolean)\n async deleteBizOptionDetail(@Arg('name') name: string, @Ctx() context: ResolverContext): Promise<Boolean> {\n await getRepository(BizOptionDetail).delete({ domain: { id: context.state.domain.id }, name })\n return true\n }\n\n @Mutation(returns => Boolean)\n async deleteBizOptionDetails(\n @Arg('names', type => [String]) names: string[],\n @Ctx() context: ResolverContext\n ): Promise<Boolean> {\n await getRepository(BizOptionDetail).delete({\n domain: { id: context.state.domain.id },\n name: In(names)\n })\n return true\n }\n}\n"]}
|
|
@@ -1,23 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var _a;
|
|
3
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
3
|
exports.BizOptionDetailQuery = void 0;
|
|
5
4
|
const tslib_1 = require("tslib");
|
|
6
5
|
const type_graphql_1 = require("type-graphql");
|
|
7
|
-
const typeorm_1 = require("typeorm");
|
|
8
6
|
const shell_1 = require("@things-factory/shell");
|
|
9
7
|
const biz_option_detail_1 = require("./biz-option-detail");
|
|
10
8
|
const biz_option_detail_types_1 = require("./biz-option-detail-types");
|
|
11
9
|
let BizOptionDetailQuery = class BizOptionDetailQuery {
|
|
12
10
|
async bizOptionDetail(name, context) {
|
|
13
|
-
return await (0,
|
|
14
|
-
where: { domain: context.state.domain, name },
|
|
11
|
+
return await (0, shell_1.getRepository)(biz_option_detail_1.BizOptionDetail).findOne({
|
|
12
|
+
where: { domain: { id: context.state.domain.id }, name },
|
|
15
13
|
relations: ['domain', 'bizOption', 'creator', 'updater']
|
|
16
14
|
});
|
|
17
15
|
}
|
|
18
16
|
async bizOptionDetails(params) {
|
|
19
17
|
const convertedParams = (0, shell_1.convertListParams)(params);
|
|
20
|
-
const [items, total] = await (0,
|
|
18
|
+
const [items, total] = await (0, shell_1.getRepository)(biz_option_detail_1.BizOptionDetail).findAndCount(Object.assign(Object.assign({}, convertedParams), { relations: ['domain', 'bizOption', 'creator', 'updater'] }));
|
|
21
19
|
return { items, total };
|
|
22
20
|
}
|
|
23
21
|
};
|
|
@@ -33,7 +31,7 @@ tslib_1.__decorate([
|
|
|
33
31
|
(0, type_graphql_1.Query)(returns => biz_option_detail_types_1.BizOptionDetailList),
|
|
34
32
|
tslib_1.__param(0, (0, type_graphql_1.Args)()),
|
|
35
33
|
tslib_1.__metadata("design:type", Function),
|
|
36
|
-
tslib_1.__metadata("design:paramtypes", [
|
|
34
|
+
tslib_1.__metadata("design:paramtypes", [shell_1.ListParam]),
|
|
37
35
|
tslib_1.__metadata("design:returntype", Promise)
|
|
38
36
|
], BizOptionDetailQuery.prototype, "bizOptionDetails", null);
|
|
39
37
|
BizOptionDetailQuery = tslib_1.__decorate([
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"biz-option-detail-query.js","sourceRoot":"","sources":["../../../server/service/biz-option-detail/biz-option-detail-query.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"biz-option-detail-query.js","sourceRoot":"","sources":["../../../server/service/biz-option-detail/biz-option-detail-query.ts"],"names":[],"mappings":";;;;AAAA,+CAA8D;AAE9D,iDAAmF;AAEnF,2DAAqD;AACrD,uEAA+D;AAG/D,IAAa,oBAAoB,GAAjC,MAAa,oBAAoB;IAE/B,KAAK,CAAC,eAAe,CAAc,IAAY,EAAS,OAAwB;QAC9E,OAAO,MAAM,IAAA,qBAAa,EAAC,mCAAe,CAAC,CAAC,OAAO,CAAC;YAClD,KAAK,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE;YACxD,SAAS,EAAE,CAAC,QAAQ,EAAE,WAAW,EAAE,SAAS,EAAE,SAAS,CAAC;SACzD,CAAC,CAAA;IACJ,CAAC;IAGD,KAAK,CAAC,gBAAgB,CAAS,MAAiB;QAC9C,MAAM,eAAe,GAAG,IAAA,yBAAiB,EAAC,MAAM,CAAC,CAAA;QACjD,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,GAAG,MAAM,IAAA,qBAAa,EAAC,mCAAe,CAAC,CAAC,YAAY,iCACnE,eAAe,KAClB,SAAS,EAAE,CAAC,QAAQ,EAAE,WAAW,EAAE,SAAS,EAAE,SAAS,CAAC,IACxD,CAAA;QACF,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,CAAA;IACzB,CAAC;CACF,CAAA;AAhBC;IADC,IAAA,oBAAK,EAAC,OAAO,CAAC,EAAE,CAAC,mCAAe,CAAC;IACX,mBAAA,IAAA,kBAAG,EAAC,MAAM,CAAC,CAAA;IAAgB,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;2DAKtD;AAGD;IADC,IAAA,oBAAK,EAAC,OAAO,CAAC,EAAE,CAAC,6CAAmB,CAAC;IACd,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAS,iBAAS;;4DAO/C;AAjBU,oBAAoB;IADhC,IAAA,uBAAQ,EAAC,mCAAe,CAAC;GACb,oBAAoB,CAkBhC;AAlBY,oDAAoB","sourcesContent":["import { Arg, Args, Ctx, Query, Resolver } from 'type-graphql'\n\nimport { convertListParams, getRepository, ListParam } from '@things-factory/shell'\n\nimport { BizOptionDetail } from './biz-option-detail'\nimport { BizOptionDetailList } from './biz-option-detail-types'\n\n@Resolver(BizOptionDetail)\nexport class BizOptionDetailQuery {\n @Query(returns => BizOptionDetail)\n async bizOptionDetail(@Arg('name') name: string, @Ctx() context: ResolverContext): Promise<BizOptionDetail> {\n return await getRepository(BizOptionDetail).findOne({\n where: { domain: { id: context.state.domain.id }, name },\n relations: ['domain', 'bizOption', 'creator', 'updater']\n })\n }\n\n @Query(returns => BizOptionDetailList)\n async bizOptionDetails(@Args() params: ListParam): Promise<BizOptionDetailList> {\n const convertedParams = convertListParams(params)\n const [items, total] = await getRepository(BizOptionDetail).findAndCount({\n ...convertedParams,\n relations: ['domain', 'bizOption', 'creator', 'updater']\n })\n return { items, total }\n }\n}\n"]}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var _a;
|
|
3
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
3
|
exports.BizOptionDetailPatch = exports.NewBizOptionDetail = exports.BizOptionDetailList = void 0;
|
|
5
4
|
const tslib_1 = require("tslib");
|
|
@@ -50,7 +49,7 @@ tslib_1.__decorate([
|
|
|
50
49
|
], BizOptionDetailPatch.prototype, "description", void 0);
|
|
51
50
|
tslib_1.__decorate([
|
|
52
51
|
(0, type_graphql_1.Field)({ nullable: true }),
|
|
53
|
-
tslib_1.__metadata("design:type",
|
|
52
|
+
tslib_1.__metadata("design:type", shell_1.ObjectRef)
|
|
54
53
|
], BizOptionDetailPatch.prototype, "bizOption", void 0);
|
|
55
54
|
BizOptionDetailPatch = tslib_1.__decorate([
|
|
56
55
|
(0, type_graphql_1.InputType)()
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"biz-option-detail-types.js","sourceRoot":"","sources":["../../../server/service/biz-option-detail/biz-option-detail-types.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"biz-option-detail-types.js","sourceRoot":"","sources":["../../../server/service/biz-option-detail/biz-option-detail-types.ts"],"names":[],"mappings":";;;;AAAA,+CAAgE;AAEhE,iDAAiD;AAEjD,2DAAqD;AAGrD,IAAa,mBAAmB,GAAhC,MAAa,mBAAmB;CAM/B,CAAA;AAJC;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,CAAC,mCAAe,CAAC,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;kDAC5B;AAGzB;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,kBAAG,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;kDACzB;AALH,mBAAmB;IAD/B,IAAA,yBAAU,GAAE;GACA,mBAAmB,CAM/B;AANY,kDAAmB;AAShC,IAAa,kBAAkB,GAA/B,MAAa,kBAAkB;CAM9B,CAAA;AAJC;IADC,IAAA,oBAAK,GAAE;;gDACI;AAGZ;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;uDACN;AALT,kBAAkB;IAD9B,IAAA,wBAAS,GAAE;GACC,kBAAkB,CAM9B;AANY,gDAAkB;AAS/B,IAAa,oBAAoB,GAAjC,MAAa,oBAAoB;CAYhC,CAAA;AAVC;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;gDACf;AAGX;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;kDACb;AAGb;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;yDACN;AAGpB;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;sCACd,iBAAS;uDAAA;AAXV,oBAAoB;IADhC,IAAA,wBAAS,GAAE;GACC,oBAAoB,CAYhC;AAZY,oDAAoB","sourcesContent":["import { Field, InputType, Int, ObjectType } from 'type-graphql'\n\nimport { ObjectRef } from '@things-factory/shell'\n\nimport { BizOptionDetail } from './biz-option-detail'\n\n@ObjectType()\nexport class BizOptionDetailList {\n @Field(type => [BizOptionDetail], { nullable: true })\n items?: BizOptionDetail[]\n\n @Field(type => Int, { nullable: true })\n total?: number\n}\n\n@InputType()\nexport class NewBizOptionDetail {\n @Field()\n name: string\n\n @Field({ nullable: true })\n description?: string\n}\n\n@InputType()\nexport class BizOptionDetailPatch {\n @Field({ nullable: true })\n id?: string\n\n @Field({ nullable: true })\n name?: string\n\n @Field({ nullable: true })\n description?: string\n\n @Field({ nullable: true })\n bizOption?: ObjectRef\n}\n"]}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var _a, _b, _c;
|
|
3
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
3
|
exports.BizOptionDetail = void 0;
|
|
5
4
|
const tslib_1 = require("tslib");
|
|
@@ -18,7 +17,7 @@ tslib_1.__decorate([
|
|
|
18
17
|
tslib_1.__decorate([
|
|
19
18
|
(0, typeorm_1.ManyToOne)(type => shell_1.Domain, { nullable: true }),
|
|
20
19
|
(0, type_graphql_1.Field)({ nullable: true }),
|
|
21
|
-
tslib_1.__metadata("design:type",
|
|
20
|
+
tslib_1.__metadata("design:type", shell_1.Domain)
|
|
22
21
|
], BizOptionDetail.prototype, "domain", void 0);
|
|
23
22
|
tslib_1.__decorate([
|
|
24
23
|
(0, typeorm_1.Column)(),
|
|
@@ -54,14 +53,14 @@ tslib_1.__decorate([
|
|
|
54
53
|
nullable: true
|
|
55
54
|
}),
|
|
56
55
|
(0, type_graphql_1.Field)({ nullable: true }),
|
|
57
|
-
tslib_1.__metadata("design:type",
|
|
56
|
+
tslib_1.__metadata("design:type", auth_base_1.User)
|
|
58
57
|
], BizOptionDetail.prototype, "creator", void 0);
|
|
59
58
|
tslib_1.__decorate([
|
|
60
59
|
(0, typeorm_1.ManyToOne)(type => auth_base_1.User, {
|
|
61
60
|
nullable: true
|
|
62
61
|
}),
|
|
63
62
|
(0, type_graphql_1.Field)({ nullable: true }),
|
|
64
|
-
tslib_1.__metadata("design:type",
|
|
63
|
+
tslib_1.__metadata("design:type", auth_base_1.User)
|
|
65
64
|
], BizOptionDetail.prototype, "updater", void 0);
|
|
66
65
|
BizOptionDetail = tslib_1.__decorate([
|
|
67
66
|
(0, typeorm_1.Entity)(),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"biz-option-detail.js","sourceRoot":"","sources":["../../../server/service/biz-option-detail/biz-option-detail.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"biz-option-detail.js","sourceRoot":"","sources":["../../../server/service/biz-option-detail/biz-option-detail.ts"],"names":[],"mappings":";;;;AAAA,+CAAoD;AACpD,qCAAsH;AAEtH,yDAAgD;AAChD,iDAA8C;AAE9C,yDAAoD;AAWpD,IAAa,eAAe,GAA5B,MAAa,eAAe;CA4C3B,CAAA;AAzCC;IAFC,IAAA,gCAAsB,EAAC,MAAM,CAAC;IAC9B,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,iBAAE,CAAC;;2CACR;AAIV;IAFC,IAAA,mBAAS,EAAC,IAAI,CAAC,EAAE,CAAC,cAAM,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IAC7C,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;sCAClB,cAAM;+CAAA;AAId;IAFC,IAAA,gBAAM,GAAE;IACR,IAAA,oBAAK,GAAE;;6CACI;AAMZ;IAJC,IAAA,mBAAS,EAAC,IAAI,CAAC,EAAE,CAAC,sBAAS,EAAE,SAAS,CAAC,EAAE,CAAC,SAAS,CAAC,gBAAgB,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ToOne, PrimaryGeneratedColumn, UpdateDateColumn } from 'typeorm'\n\nimport { User } from '@things-factory/auth-base'\nimport { Domain } from '@things-factory/shell'\n\nimport { BizOption } from '../biz-option/biz-option'\n\n@Entity()\n@Index(\n 'ix_biz-option-detail_0',\n (bizOptionDetail: BizOptionDetail) => [bizOptionDetail.bizOption, bizOptionDetail.name],\n {\n unique: true\n }\n)\n@ObjectType()\nexport class BizOptionDetail {\n @PrimaryGeneratedColumn('uuid')\n @Field(type => ID)\n id: string\n\n @ManyToOne(type => Domain, { nullable: true })\n @Field({ nullable: true })\n domain: Domain\n\n @Column()\n @Field()\n name: string\n\n @ManyToOne(type => BizOption, bizOption => bizOption.bizOptionDetails, {\n nullable: false\n })\n @Field(type => BizOption, { nullable: true })\n bizOption: BizOption\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 @ManyToOne(type => User, {\n nullable: true\n })\n @Field({ nullable: true })\n updater: User\n}\n"]}
|
|
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.BizplaceMutation = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const type_graphql_1 = require("type-graphql");
|
|
6
|
-
const typeorm_1 = require("typeorm");
|
|
7
6
|
const shell_1 = require("@things-factory/shell");
|
|
8
7
|
const utils_1 = require("@things-factory/utils");
|
|
9
8
|
const company_1 = require("../company/company");
|
|
@@ -13,28 +12,28 @@ let BizplaceMutation = class BizplaceMutation {
|
|
|
13
12
|
async createBizplace(bizplace, context) {
|
|
14
13
|
const { domain, user } = context.state;
|
|
15
14
|
if (bizplace.company && bizplace.company.id) {
|
|
16
|
-
bizplace.company = await (0,
|
|
15
|
+
bizplace.company = await (0, shell_1.getRepository)(company_1.Company).findOneBy({ id: bizplace.company.id });
|
|
17
16
|
}
|
|
18
|
-
return await (0,
|
|
17
|
+
return await (0, shell_1.getRepository)(bizplace_1.Bizplace).save(Object.assign(Object.assign({}, bizplace), { domain, creator: user, updater: user }));
|
|
19
18
|
}
|
|
20
19
|
async updateBizplace(name, patch, context) {
|
|
21
|
-
const bizplace = await (0,
|
|
20
|
+
const bizplace = await (0, shell_1.getRepository)(bizplace_1.Bizplace).findOneBy({ domain: context.state.domain, name });
|
|
22
21
|
if (patch.company && patch.company.id) {
|
|
23
|
-
patch.company = await (0,
|
|
22
|
+
patch.company = await (0, shell_1.getRepository)(company_1.Company).findOneBy({ id: patch.company.id });
|
|
24
23
|
}
|
|
25
|
-
return await (0,
|
|
24
|
+
return await (0, shell_1.getRepository)(bizplace_1.Bizplace).save(Object.assign(Object.assign(Object.assign({}, bizplace), patch), { updater: context.state.user }));
|
|
26
25
|
}
|
|
27
26
|
async updateMultipleBizplace(patches, context) {
|
|
28
27
|
let results = [];
|
|
29
28
|
const _createRecords = patches.filter((patch) => patch.cuFlag.toUpperCase() === '+');
|
|
30
29
|
const _updateRecords = patches.filter((patch) => patch.cuFlag.toUpperCase() === 'M');
|
|
31
|
-
const bizplaceRepo = (0,
|
|
32
|
-
const companyRepo = (0,
|
|
30
|
+
const bizplaceRepo = (0, shell_1.getRepository)(bizplace_1.Bizplace);
|
|
31
|
+
const companyRepo = (0, shell_1.getRepository)(company_1.Company);
|
|
33
32
|
if (_createRecords.length > 0) {
|
|
34
33
|
for (let i = 0; i < _createRecords.length; i++) {
|
|
35
34
|
const newRecord = _createRecords[i];
|
|
36
35
|
if (newRecord.company && newRecord.company.id) {
|
|
37
|
-
newRecord.company = await companyRepo.
|
|
36
|
+
newRecord.company = await companyRepo.findOneBy({ id: newRecord.company.id });
|
|
38
37
|
}
|
|
39
38
|
const result = await bizplaceRepo.save(Object.assign({ domain: context.state.domain, creator: context.state.user, updater: context.state.user }, newRecord));
|
|
40
39
|
results.push(Object.assign(Object.assign({}, result), { cuFlag: '+' }));
|
|
@@ -43,9 +42,9 @@ let BizplaceMutation = class BizplaceMutation {
|
|
|
43
42
|
if (_updateRecords.length > 0) {
|
|
44
43
|
for (let i = 0; i < _updateRecords.length; i++) {
|
|
45
44
|
const newRecord = _updateRecords[i];
|
|
46
|
-
const bizplace = await bizplaceRepo.
|
|
45
|
+
const bizplace = await bizplaceRepo.findOneBy({ id: newRecord.id });
|
|
47
46
|
if (newRecord.company && newRecord.company.id) {
|
|
48
|
-
newRecord.company = await companyRepo.
|
|
47
|
+
newRecord.company = await companyRepo.findOneBy({ id: newRecord.company.id });
|
|
49
48
|
}
|
|
50
49
|
const result = await bizplaceRepo.save(Object.assign(Object.assign(Object.assign({}, bizplace), newRecord), { updater: context.state.user }));
|
|
51
50
|
results.push(Object.assign(Object.assign({}, result), { cuFlag: 'M' }));
|
|
@@ -54,21 +53,21 @@ let BizplaceMutation = class BizplaceMutation {
|
|
|
54
53
|
return results;
|
|
55
54
|
}
|
|
56
55
|
async updateBizplaceCheckDomain(name, patch, context) {
|
|
57
|
-
let bizplace = await (0,
|
|
56
|
+
let bizplace = await (0, shell_1.getRepository)(bizplace_1.Bizplace).findOne({ where: { name }, relations: ['domain'] });
|
|
58
57
|
let domain = bizplace.domain;
|
|
59
58
|
if (domain) {
|
|
60
59
|
if (bizplace.name !== patch.name) {
|
|
61
|
-
domain = await (0,
|
|
60
|
+
domain = await (0, shell_1.getRepository)(shell_1.Domain).save(Object.assign(Object.assign({}, domain), { name: patch.name, subdomain: (0, utils_1.slugger)(patch.name) }));
|
|
62
61
|
}
|
|
63
62
|
}
|
|
64
|
-
return await (0,
|
|
63
|
+
return await (0, shell_1.getRepository)(bizplace_1.Bizplace).save(Object.assign(Object.assign(Object.assign({}, bizplace), patch), { updater: context.state.user }));
|
|
65
64
|
}
|
|
66
65
|
async deleteBizplace(id) {
|
|
67
|
-
await (0,
|
|
66
|
+
await (0, shell_1.getRepository)(bizplace_1.Bizplace).delete(id);
|
|
68
67
|
return true;
|
|
69
68
|
}
|
|
70
69
|
async deleteBizplaces(ids) {
|
|
71
|
-
await (0,
|
|
70
|
+
await (0, shell_1.getRepository)(bizplace_1.Bizplace).delete(ids);
|
|
72
71
|
return true;
|
|
73
72
|
}
|
|
74
73
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bizplace-mutation.js","sourceRoot":"","sources":["../../../server/service/bizplace/bizplace-mutation.ts"],"names":[],"mappings":";;;;AAAA,+CAAsE;
|
|
1
|
+
{"version":3,"file":"bizplace-mutation.js","sourceRoot":"","sources":["../../../server/service/bizplace/bizplace-mutation.ts"],"names":[],"mappings":";;;;AAAA,+CAAsE;AAEtE,iDAA6D;AAC7D,iDAA+C;AAE/C,gDAA4C;AAC5C,yCAAqC;AACrC,qDAA6D;AAG7D,IAAa,gBAAgB,GAA7B,MAAa,gBAAgB;IAG3B,KAAK,CAAC,cAAc,CAAkB,QAAqB,EAAS,OAAwB;QAC1F,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QACtC,IAAI,QAAQ,CAAC,OAAO,IAAI,QAAQ,CAAC,OAAO,CAAC,EAAE,EAAE;YAC3C,QAAQ,CAAC,OAAO,GAAG,MAAM,IAAA,qBAAa,EAAC,iBAAO,CAAC,CAAC,SAAS,CAAC,EAAE,EAAE,EAAE,QAAQ,CAAC,OAAO,CAAC,EAAE,EAAE,CAAC,CAAA;SACvF;QAED,OAAO,MAAM,IAAA,qBAAa,EAAC,mBAAQ,CAAC,CAAC,IAAI,iCACpC,QAAQ,KACX,MAAM,EACN,OAAO,EAAE,IAAI,EACb,OAAO,EAAE,IAAI,IACb,CAAA;IACJ,CAAC;IAID,KAAK,CAAC,cAAc,CACL,IAAY,EACX,KAAoB,EAC3B,OAAwB;QAE/B,MAAM,QAAQ,GAAG,MAAM,IAAA,qBAAa,EAAC,mBAAQ,CAAC,CAAC,SAAS,CAAC,EAAE,MA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;;;uDAIlD;AAnIU,gBAAgB;IAD5B,IAAA,uBAAQ,EAAC,mBAAQ,CAAC;GACN,gBAAgB,CAoI5B;AApIY,4CAAgB","sourcesContent":["import { Arg, Ctx, Directive, Mutation, Resolver } from 'type-graphql'\n\nimport { Domain, getRepository } from '@things-factory/shell'\nimport { slugger } from '@things-factory/utils'\n\nimport { Company } from '../company/company'\nimport { Bizplace } from './bizplace'\nimport { BizplacePatch, NewBizplace } from './bizplace-types'\n\n@Resolver(Bizplace)\nexport class BizplaceMutation {\n @Directive('@privilege(category: \"bizplace\", privilege: \"mutation\")')\n @Mutation(returns => Bizplace)\n async createBizplace(@Arg('bizplace') bizplace: NewBizplace, @Ctx() context: ResolverContext): Promise<Bizplace> {\n const { domain, user } = context.state\n if (bizplace.company && bizplace.company.id) {\n bizplace.company = await getRepository(Company).findOneBy({ id: bizplace.company.id })\n }\n\n return await getRepository(Bizplace).save({\n ...bizplace,\n domain,\n creator: user,\n updater: user\n })\n }\n\n @Directive('@privilege(category: \"bizplace\", privilege: \"mutation\")')\n @Mutation(returns => Bizplace)\n async updateBizplace(\n @Arg('name') name: string,\n @Arg('patch') patch: BizplacePatch,\n @Ctx() context: ResolverContext\n ): Promise<Bizplace> {\n const bizplace = await getRepository(Bizplace).findOneBy({ domain: context.state.domain, name })\n\n if (patch.company && patch.company.id) {\n patch.company = await getRepository(Company).findOneBy({ id: patch.company.id })\n }\n\n return await getRepository(Bizplace).save({\n ...bizplace,\n ...patch,\n updater: context.state.user\n })\n }\n\n @Directive('@privilege(category: \"bizplace\", privilege: \"mutation\")')\n @Mutation(returns => [Bizplace])\n async updateMultipleBizplace(\n @Arg('patches', type => [BizplacePatch]) patches: BizplacePatch[],\n @Ctx() context: ResolverContext\n ): Promise<Bizplace[]> {\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 bizplaceRepo = getRepository(Bizplace)\n const companyRepo = getRepository(Company)\n\n if (_createRecords.length > 0) {\n for (let i = 0; i < _createRecords.length; i++) {\n const newRecord = _createRecords[i]\n\n if (newRecord.company && newRecord.company.id) {\n newRecord.company = await companyRepo.findOneBy({ id: newRecord.company.id })\n }\n\n const result = await bizplaceRepo.save({\n domain: context.state.domain,\n creator: context.state.user,\n updater: context.state.user,\n ...newRecord\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 bizplace = await bizplaceRepo.findOneBy({ id: newRecord.id })\n\n if (newRecord.company && newRecord.company.id) {\n newRecord.company = await companyRepo.findOneBy({ id: newRecord.company.id })\n }\n\n const result = await bizplaceRepo.save({\n ...bizplace,\n ...newRecord,\n updater: context.state.user\n })\n\n results.push({ ...result, cuFlag: 'M' })\n }\n }\n\n return results\n }\n\n @Directive('@privilege(category: \"bizplace\", privilege: \"mutation\")')\n @Mutation(returns => Bizplace)\n async updateBizplaceCheckDomain(\n @Arg('name') name: string,\n @Arg('patch') patch: BizplacePatch,\n @Ctx() context: ResolverContext\n ): Promise<Bizplace> {\n let bizplace: Bizplace = await getRepository(Bizplace).findOne({ where: { name }, relations: ['domain'] })\n let domain: Domain = bizplace.domain\n\n if (domain) {\n if (bizplace.name !== patch.name) {\n domain = await getRepository(Domain).save({\n ...domain,\n name: patch.name,\n subdomain: slugger(patch.name)\n })\n }\n }\n\n return await getRepository(Bizplace).save({\n ...bizplace,\n ...patch,\n updater: context.state.user\n })\n }\n\n @Directive('@privilege(category: \"bizplace\", privilege: \"mutation\")')\n @Mutation(returns => Boolean)\n async deleteBizplace(@Arg('id') id: string): Promise<Boolean> {\n await getRepository(Bizplace).delete(id)\n\n return true\n }\n\n @Directive('@privilege(category: \"bizplace\", privilege: \"mutation\")')\n @Mutation(returns => Boolean)\n async deleteBizplaces(@Arg('ids', type => [String]) ids: string[]): Promise<Boolean> {\n await getRepository(Bizplace).delete(ids)\n\n return true\n }\n}\n"]}
|