@things-factory/biz-base 5.0.7 → 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/index.js +4 -17
- package/dist-server/index.js.map +1 -1
- package/dist-server/middlewares/index.js.map +1 -1
- package/dist-server/migrations/index.js.map +1 -1
- package/dist-server/service/biz-option/biz-option-mutation.js +38 -45
- package/dist-server/service/biz-option/biz-option-mutation.js.map +1 -1
- package/dist-server/service/biz-option/biz-option-query.js +17 -30
- package/dist-server/service/biz-option/biz-option-query.js.map +1 -1
- package/dist-server/service/biz-option/biz-option-types.js +24 -33
- package/dist-server/service/biz-option/biz-option-types.js.map +1 -1
- package/dist-server/service/biz-option/biz-option.js +22 -31
- package/dist-server/service/biz-option/biz-option.js.map +1 -1
- package/dist-server/service/biz-option/index.js.map +1 -1
- package/dist-server/service/biz-option-detail/biz-option-detail-mutation.js +34 -44
- 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 +16 -29
- 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 +20 -29
- 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 +20 -29
- package/dist-server/service/biz-option-detail/biz-option-detail.js.map +1 -1
- package/dist-server/service/biz-option-detail/index.js.map +1 -1
- package/dist-server/service/bizplace/bizplace-mutation.js +53 -65
- package/dist-server/service/bizplace/bizplace-mutation.js.map +1 -1
- package/dist-server/service/bizplace/bizplace-query.js +79 -88
- package/dist-server/service/bizplace/bizplace-query.js.map +1 -1
- package/dist-server/service/bizplace/bizplace-types.js +53 -62
- package/dist-server/service/bizplace/bizplace-types.js.map +1 -1
- package/dist-server/service/bizplace/bizplace.js +33 -42
- package/dist-server/service/bizplace/bizplace.js.map +1 -1
- package/dist-server/service/bizplace/index.js.map +1 -1
- package/dist-server/service/company/company-mutation.js +40 -51
- package/dist-server/service/company/company-mutation.js.map +1 -1
- package/dist-server/service/company/company-query.js +28 -44
- package/dist-server/service/company/company-query.js.map +1 -1
- package/dist-server/service/company/company-types.js +42 -50
- package/dist-server/service/company/company-types.js.map +1 -1
- package/dist-server/service/company/company.js +38 -47
- package/dist-server/service/company/company.js.map +1 -1
- package/dist-server/service/company/index.js.map +1 -1
- package/dist-server/service/contact-point/contact-point-mutation.js +45 -56
- package/dist-server/service/contact-point/contact-point-mutation.js.map +1 -1
- package/dist-server/service/contact-point/contact-point-query.js +17 -30
- package/dist-server/service/contact-point/contact-point-query.js.map +1 -1
- package/dist-server/service/contact-point/contact-point-types.js +80 -89
- package/dist-server/service/contact-point/contact-point-types.js.map +1 -1
- package/dist-server/service/contact-point/contact-point.js +48 -57
- package/dist-server/service/contact-point/contact-point.js.map +1 -1
- package/dist-server/service/contact-point/index.js.map +1 -1
- package/dist-server/service/index.js +13 -26
- package/dist-server/service/index.js.map +1 -1
- package/dist-server/service/worker/index.js.map +1 -1
- package/dist-server/service/worker/worker-mutation.js +40 -50
- package/dist-server/service/worker/worker-mutation.js.map +1 -1
- package/dist-server/service/worker/worker-query.js +16 -28
- package/dist-server/service/worker/worker-query.js.map +1 -1
- package/dist-server/service/worker/worker-types.js +28 -37
- package/dist-server/service/worker/worker-types.js.map +1 -1
- package/dist-server/service/worker/worker.js +22 -31
- package/dist-server/service/worker/worker.js.map +1 -1
- package/dist-server/tsconfig.tsbuildinfo +1 -0
- package/dist-server/utils/get-permitted-bizplaces.js +30 -24
- package/dist-server/utils/get-permitted-bizplaces.js.map +1 -1
- package/dist-server/utils/index.js +2 -15
- package/dist-server/utils/index.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 +44 -37
- package/server/service/company/company-mutation.ts +15 -9
- package/server/service/company/company-query.ts +9 -14
- package/server/service/contact-point/contact-point-mutation.ts +18 -16
- 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 +15 -9
|
@@ -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":"
|
|
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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BAAA,IAAA,kBAAG,EAAC,MAAM,CAAC,CAAA;IAAgB,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;oEAG5D;AAGD;IADC,IAAA,uBAAQ,EAAC,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC;IAE1B,mBAAA,IAAA,kBAAG,EAAC,OAAO,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAA;IAC9B,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;qEAOP;AAhDU,uBAAuB;IADnC,IAAA,uBAAQ,EAAC,mCAAe,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,53 +1,40 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
-
};
|
|
11
|
-
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
-
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
-
};
|
|
14
|
-
var _a;
|
|
15
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
3
|
exports.BizOptionDetailQuery = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
17
5
|
const type_graphql_1 = require("type-graphql");
|
|
18
|
-
const typeorm_1 = require("typeorm");
|
|
19
6
|
const shell_1 = require("@things-factory/shell");
|
|
20
7
|
const biz_option_detail_1 = require("./biz-option-detail");
|
|
21
8
|
const biz_option_detail_types_1 = require("./biz-option-detail-types");
|
|
22
9
|
let BizOptionDetailQuery = class BizOptionDetailQuery {
|
|
23
10
|
async bizOptionDetail(name, context) {
|
|
24
|
-
return await (0,
|
|
25
|
-
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 },
|
|
26
13
|
relations: ['domain', 'bizOption', 'creator', 'updater']
|
|
27
14
|
});
|
|
28
15
|
}
|
|
29
16
|
async bizOptionDetails(params) {
|
|
30
17
|
const convertedParams = (0, shell_1.convertListParams)(params);
|
|
31
|
-
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'] }));
|
|
32
19
|
return { items, total };
|
|
33
20
|
}
|
|
34
21
|
};
|
|
35
|
-
__decorate([
|
|
22
|
+
tslib_1.__decorate([
|
|
36
23
|
(0, type_graphql_1.Query)(returns => biz_option_detail_1.BizOptionDetail),
|
|
37
|
-
__param(0, (0, type_graphql_1.Arg)('name')),
|
|
38
|
-
__param(1, (0, type_graphql_1.Ctx)()),
|
|
39
|
-
__metadata("design:type", Function),
|
|
40
|
-
__metadata("design:paramtypes", [String, Object]),
|
|
41
|
-
__metadata("design:returntype", Promise)
|
|
24
|
+
tslib_1.__param(0, (0, type_graphql_1.Arg)('name')),
|
|
25
|
+
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
|
26
|
+
tslib_1.__metadata("design:type", Function),
|
|
27
|
+
tslib_1.__metadata("design:paramtypes", [String, Object]),
|
|
28
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
42
29
|
], BizOptionDetailQuery.prototype, "bizOptionDetail", null);
|
|
43
|
-
__decorate([
|
|
30
|
+
tslib_1.__decorate([
|
|
44
31
|
(0, type_graphql_1.Query)(returns => biz_option_detail_types_1.BizOptionDetailList),
|
|
45
|
-
__param(0, (0, type_graphql_1.Args)()),
|
|
46
|
-
__metadata("design:type", Function),
|
|
47
|
-
__metadata("design:paramtypes", [
|
|
48
|
-
__metadata("design:returntype", Promise)
|
|
32
|
+
tslib_1.__param(0, (0, type_graphql_1.Args)()),
|
|
33
|
+
tslib_1.__metadata("design:type", Function),
|
|
34
|
+
tslib_1.__metadata("design:paramtypes", [shell_1.ListParam]),
|
|
35
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
49
36
|
], BizOptionDetailQuery.prototype, "bizOptionDetails", null);
|
|
50
|
-
BizOptionDetailQuery = __decorate([
|
|
37
|
+
BizOptionDetailQuery = tslib_1.__decorate([
|
|
51
38
|
(0, type_graphql_1.Resolver)(biz_option_detail_1.BizOptionDetail)
|
|
52
39
|
], BizOptionDetailQuery);
|
|
53
40
|
exports.BizOptionDetailQuery = BizOptionDetailQuery;
|
|
@@ -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,66 +1,57 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
-
};
|
|
11
|
-
var _a;
|
|
12
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
3
|
exports.BizOptionDetailPatch = exports.NewBizOptionDetail = exports.BizOptionDetailList = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
14
5
|
const type_graphql_1 = require("type-graphql");
|
|
15
6
|
const shell_1 = require("@things-factory/shell");
|
|
16
7
|
const biz_option_detail_1 = require("./biz-option-detail");
|
|
17
8
|
let BizOptionDetailList = class BizOptionDetailList {
|
|
18
9
|
};
|
|
19
|
-
__decorate([
|
|
10
|
+
tslib_1.__decorate([
|
|
20
11
|
(0, type_graphql_1.Field)(type => [biz_option_detail_1.BizOptionDetail], { nullable: true }),
|
|
21
|
-
__metadata("design:type", Array)
|
|
12
|
+
tslib_1.__metadata("design:type", Array)
|
|
22
13
|
], BizOptionDetailList.prototype, "items", void 0);
|
|
23
|
-
__decorate([
|
|
14
|
+
tslib_1.__decorate([
|
|
24
15
|
(0, type_graphql_1.Field)(type => type_graphql_1.Int, { nullable: true }),
|
|
25
|
-
__metadata("design:type", Number)
|
|
16
|
+
tslib_1.__metadata("design:type", Number)
|
|
26
17
|
], BizOptionDetailList.prototype, "total", void 0);
|
|
27
|
-
BizOptionDetailList = __decorate([
|
|
18
|
+
BizOptionDetailList = tslib_1.__decorate([
|
|
28
19
|
(0, type_graphql_1.ObjectType)()
|
|
29
20
|
], BizOptionDetailList);
|
|
30
21
|
exports.BizOptionDetailList = BizOptionDetailList;
|
|
31
22
|
let NewBizOptionDetail = class NewBizOptionDetail {
|
|
32
23
|
};
|
|
33
|
-
__decorate([
|
|
24
|
+
tslib_1.__decorate([
|
|
34
25
|
(0, type_graphql_1.Field)(),
|
|
35
|
-
__metadata("design:type", String)
|
|
26
|
+
tslib_1.__metadata("design:type", String)
|
|
36
27
|
], NewBizOptionDetail.prototype, "name", void 0);
|
|
37
|
-
__decorate([
|
|
28
|
+
tslib_1.__decorate([
|
|
38
29
|
(0, type_graphql_1.Field)({ nullable: true }),
|
|
39
|
-
__metadata("design:type", String)
|
|
30
|
+
tslib_1.__metadata("design:type", String)
|
|
40
31
|
], NewBizOptionDetail.prototype, "description", void 0);
|
|
41
|
-
NewBizOptionDetail = __decorate([
|
|
32
|
+
NewBizOptionDetail = tslib_1.__decorate([
|
|
42
33
|
(0, type_graphql_1.InputType)()
|
|
43
34
|
], NewBizOptionDetail);
|
|
44
35
|
exports.NewBizOptionDetail = NewBizOptionDetail;
|
|
45
36
|
let BizOptionDetailPatch = class BizOptionDetailPatch {
|
|
46
37
|
};
|
|
47
|
-
__decorate([
|
|
38
|
+
tslib_1.__decorate([
|
|
48
39
|
(0, type_graphql_1.Field)({ nullable: true }),
|
|
49
|
-
__metadata("design:type", String)
|
|
40
|
+
tslib_1.__metadata("design:type", String)
|
|
50
41
|
], BizOptionDetailPatch.prototype, "id", void 0);
|
|
51
|
-
__decorate([
|
|
42
|
+
tslib_1.__decorate([
|
|
52
43
|
(0, type_graphql_1.Field)({ nullable: true }),
|
|
53
|
-
__metadata("design:type", String)
|
|
44
|
+
tslib_1.__metadata("design:type", String)
|
|
54
45
|
], BizOptionDetailPatch.prototype, "name", void 0);
|
|
55
|
-
__decorate([
|
|
46
|
+
tslib_1.__decorate([
|
|
56
47
|
(0, type_graphql_1.Field)({ nullable: true }),
|
|
57
|
-
__metadata("design:type", String)
|
|
48
|
+
tslib_1.__metadata("design:type", String)
|
|
58
49
|
], BizOptionDetailPatch.prototype, "description", void 0);
|
|
59
|
-
__decorate([
|
|
50
|
+
tslib_1.__decorate([
|
|
60
51
|
(0, type_graphql_1.Field)({ nullable: true }),
|
|
61
|
-
__metadata("design:type",
|
|
52
|
+
tslib_1.__metadata("design:type", shell_1.ObjectRef)
|
|
62
53
|
], BizOptionDetailPatch.prototype, "bizOption", void 0);
|
|
63
|
-
BizOptionDetailPatch = __decorate([
|
|
54
|
+
BizOptionDetailPatch = tslib_1.__decorate([
|
|
64
55
|
(0, type_graphql_1.InputType)()
|
|
65
56
|
], BizOptionDetailPatch);
|
|
66
57
|
exports.BizOptionDetailPatch = BizOptionDetailPatch;
|
|
@@ -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,16 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
-
};
|
|
11
|
-
var _a, _b, _c;
|
|
12
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
3
|
exports.BizOptionDetail = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
14
5
|
const type_graphql_1 = require("type-graphql");
|
|
15
6
|
const typeorm_1 = require("typeorm");
|
|
16
7
|
const auth_base_1 = require("@things-factory/auth-base");
|
|
@@ -18,60 +9,60 @@ const shell_1 = require("@things-factory/shell");
|
|
|
18
9
|
const biz_option_1 = require("../biz-option/biz-option");
|
|
19
10
|
let BizOptionDetail = class BizOptionDetail {
|
|
20
11
|
};
|
|
21
|
-
__decorate([
|
|
12
|
+
tslib_1.__decorate([
|
|
22
13
|
(0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
|
|
23
14
|
(0, type_graphql_1.Field)(type => type_graphql_1.ID),
|
|
24
|
-
__metadata("design:type", String)
|
|
15
|
+
tslib_1.__metadata("design:type", String)
|
|
25
16
|
], BizOptionDetail.prototype, "id", void 0);
|
|
26
|
-
__decorate([
|
|
17
|
+
tslib_1.__decorate([
|
|
27
18
|
(0, typeorm_1.ManyToOne)(type => shell_1.Domain, { nullable: true }),
|
|
28
19
|
(0, type_graphql_1.Field)({ nullable: true }),
|
|
29
|
-
__metadata("design:type",
|
|
20
|
+
tslib_1.__metadata("design:type", shell_1.Domain)
|
|
30
21
|
], BizOptionDetail.prototype, "domain", void 0);
|
|
31
|
-
__decorate([
|
|
22
|
+
tslib_1.__decorate([
|
|
32
23
|
(0, typeorm_1.Column)(),
|
|
33
24
|
(0, type_graphql_1.Field)(),
|
|
34
|
-
__metadata("design:type", String)
|
|
25
|
+
tslib_1.__metadata("design:type", String)
|
|
35
26
|
], BizOptionDetail.prototype, "name", void 0);
|
|
36
|
-
__decorate([
|
|
27
|
+
tslib_1.__decorate([
|
|
37
28
|
(0, typeorm_1.ManyToOne)(type => biz_option_1.BizOption, bizOption => bizOption.bizOptionDetails, {
|
|
38
29
|
nullable: false
|
|
39
30
|
}),
|
|
40
31
|
(0, type_graphql_1.Field)(type => biz_option_1.BizOption, { nullable: true }),
|
|
41
|
-
__metadata("design:type", biz_option_1.BizOption)
|
|
32
|
+
tslib_1.__metadata("design:type", biz_option_1.BizOption)
|
|
42
33
|
], BizOptionDetail.prototype, "bizOption", void 0);
|
|
43
|
-
__decorate([
|
|
34
|
+
tslib_1.__decorate([
|
|
44
35
|
(0, typeorm_1.Column)({
|
|
45
36
|
nullable: true
|
|
46
37
|
}),
|
|
47
38
|
(0, type_graphql_1.Field)({ nullable: true }),
|
|
48
|
-
__metadata("design:type", String)
|
|
39
|
+
tslib_1.__metadata("design:type", String)
|
|
49
40
|
], BizOptionDetail.prototype, "description", void 0);
|
|
50
|
-
__decorate([
|
|
41
|
+
tslib_1.__decorate([
|
|
51
42
|
(0, typeorm_1.CreateDateColumn)(),
|
|
52
43
|
(0, type_graphql_1.Field)({ nullable: true }),
|
|
53
|
-
__metadata("design:type", Date)
|
|
44
|
+
tslib_1.__metadata("design:type", Date)
|
|
54
45
|
], BizOptionDetail.prototype, "createdAt", void 0);
|
|
55
|
-
__decorate([
|
|
46
|
+
tslib_1.__decorate([
|
|
56
47
|
(0, typeorm_1.UpdateDateColumn)(),
|
|
57
48
|
(0, type_graphql_1.Field)({ nullable: true }),
|
|
58
|
-
__metadata("design:type", Date)
|
|
49
|
+
tslib_1.__metadata("design:type", Date)
|
|
59
50
|
], BizOptionDetail.prototype, "updatedAt", void 0);
|
|
60
|
-
__decorate([
|
|
51
|
+
tslib_1.__decorate([
|
|
61
52
|
(0, typeorm_1.ManyToOne)(type => auth_base_1.User, {
|
|
62
53
|
nullable: true
|
|
63
54
|
}),
|
|
64
55
|
(0, type_graphql_1.Field)({ nullable: true }),
|
|
65
|
-
__metadata("design:type",
|
|
56
|
+
tslib_1.__metadata("design:type", auth_base_1.User)
|
|
66
57
|
], BizOptionDetail.prototype, "creator", void 0);
|
|
67
|
-
__decorate([
|
|
58
|
+
tslib_1.__decorate([
|
|
68
59
|
(0, typeorm_1.ManyToOne)(type => auth_base_1.User, {
|
|
69
60
|
nullable: true
|
|
70
61
|
}),
|
|
71
62
|
(0, type_graphql_1.Field)({ nullable: true }),
|
|
72
|
-
__metadata("design:type",
|
|
63
|
+
tslib_1.__metadata("design:type", auth_base_1.User)
|
|
73
64
|
], BizOptionDetail.prototype, "updater", void 0);
|
|
74
|
-
BizOptionDetail = __decorate([
|
|
65
|
+
BizOptionDetail = tslib_1.__decorate([
|
|
75
66
|
(0, typeorm_1.Entity)(),
|
|
76
67
|
(0, typeorm_1.Index)('ix_biz-option-detail_0', (bizOptionDetail) => [bizOptionDetail.bizOption, bizOptionDetail.name], {
|
|
77
68
|
unique: true
|
|
@@ -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,g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gBAAI,EAAE;QACvB,QAAQ,EAAE,IAAI;KACf,CAAC;IACD,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;sCACjB,gBAAI;gDAAA;AA3CF,eAAe;IAT3B,IAAA,gBAAM,GAAE;IACR,IAAA,eAAK,EACJ,wBAAwB,EACxB,CAAC,eAAgC,EAAE,EAAE,CAAC,CAAC,eAAe,CAAC,SAAS,EAAE,eAAe,CAAC,IAAI,CAAC,EACvF;QACE,MAAM,EAAE,IAAI;KACb,CACF;IACA,IAAA,yBAAU,GAAE;GACA,eAAe,CA4C3B;AA5CY,0CAAe","sourcesContent":["import { Field, ID, ObjectType } from 'type-graphql'\nimport { Column, CreateDateColumn, Entity, Index, ManyToOne, 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"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../server/service/biz-option-detail/index.ts"],"names":[],"mappings":";;;AAAA,2DAAqD;AACrD,6EAAsE;AACtE,uEAAgE;AAEnD,QAAA,QAAQ,GAAG,CAAC,mCAAe,CAAC,CAAA;AAC5B,QAAA,SAAS,GAAG,CAAC,8CAAoB,EAAE,oDAAuB,CAAC,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../server/service/biz-option-detail/index.ts"],"names":[],"mappings":";;;AAAA,2DAAqD;AACrD,6EAAsE;AACtE,uEAAgE;AAEnD,QAAA,QAAQ,GAAG,CAAC,mCAAe,CAAC,CAAA;AAC5B,QAAA,SAAS,GAAG,CAAC,8CAAoB,EAAE,oDAAuB,CAAC,CAAA","sourcesContent":["import { BizOptionDetail } from './biz-option-detail'\nimport { BizOptionDetailMutation } from './biz-option-detail-mutation'\nimport { BizOptionDetailQuery } from './biz-option-detail-query'\n\nexport const entities = [BizOptionDetail]\nexport const resolvers = [BizOptionDetailQuery, BizOptionDetailMutation]\n"]}
|
|
@@ -1,20 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
-
};
|
|
11
|
-
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
-
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
-
};
|
|
14
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
3
|
exports.BizplaceMutation = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
16
5
|
const type_graphql_1 = require("type-graphql");
|
|
17
|
-
const typeorm_1 = require("typeorm");
|
|
18
6
|
const shell_1 = require("@things-factory/shell");
|
|
19
7
|
const utils_1 = require("@things-factory/utils");
|
|
20
8
|
const company_1 = require("../company/company");
|
|
@@ -24,28 +12,28 @@ let BizplaceMutation = class BizplaceMutation {
|
|
|
24
12
|
async createBizplace(bizplace, context) {
|
|
25
13
|
const { domain, user } = context.state;
|
|
26
14
|
if (bizplace.company && bizplace.company.id) {
|
|
27
|
-
bizplace.company = await (0,
|
|
15
|
+
bizplace.company = await (0, shell_1.getRepository)(company_1.Company).findOneBy({ id: bizplace.company.id });
|
|
28
16
|
}
|
|
29
|
-
return await (0,
|
|
17
|
+
return await (0, shell_1.getRepository)(bizplace_1.Bizplace).save(Object.assign(Object.assign({}, bizplace), { domain, creator: user, updater: user }));
|
|
30
18
|
}
|
|
31
19
|
async updateBizplace(name, patch, context) {
|
|
32
|
-
const bizplace = await (0,
|
|
20
|
+
const bizplace = await (0, shell_1.getRepository)(bizplace_1.Bizplace).findOneBy({ domain: context.state.domain, name });
|
|
33
21
|
if (patch.company && patch.company.id) {
|
|
34
|
-
patch.company = await (0,
|
|
22
|
+
patch.company = await (0, shell_1.getRepository)(company_1.Company).findOneBy({ id: patch.company.id });
|
|
35
23
|
}
|
|
36
|
-
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 }));
|
|
37
25
|
}
|
|
38
26
|
async updateMultipleBizplace(patches, context) {
|
|
39
27
|
let results = [];
|
|
40
28
|
const _createRecords = patches.filter((patch) => patch.cuFlag.toUpperCase() === '+');
|
|
41
29
|
const _updateRecords = patches.filter((patch) => patch.cuFlag.toUpperCase() === 'M');
|
|
42
|
-
const bizplaceRepo = (0,
|
|
43
|
-
const companyRepo = (0,
|
|
30
|
+
const bizplaceRepo = (0, shell_1.getRepository)(bizplace_1.Bizplace);
|
|
31
|
+
const companyRepo = (0, shell_1.getRepository)(company_1.Company);
|
|
44
32
|
if (_createRecords.length > 0) {
|
|
45
33
|
for (let i = 0; i < _createRecords.length; i++) {
|
|
46
34
|
const newRecord = _createRecords[i];
|
|
47
35
|
if (newRecord.company && newRecord.company.id) {
|
|
48
|
-
newRecord.company = await companyRepo.
|
|
36
|
+
newRecord.company = await companyRepo.findOneBy({ id: newRecord.company.id });
|
|
49
37
|
}
|
|
50
38
|
const result = await bizplaceRepo.save(Object.assign({ domain: context.state.domain, creator: context.state.user, updater: context.state.user }, newRecord));
|
|
51
39
|
results.push(Object.assign(Object.assign({}, result), { cuFlag: '+' }));
|
|
@@ -54,9 +42,9 @@ let BizplaceMutation = class BizplaceMutation {
|
|
|
54
42
|
if (_updateRecords.length > 0) {
|
|
55
43
|
for (let i = 0; i < _updateRecords.length; i++) {
|
|
56
44
|
const newRecord = _updateRecords[i];
|
|
57
|
-
const bizplace = await bizplaceRepo.
|
|
45
|
+
const bizplace = await bizplaceRepo.findOneBy({ id: newRecord.id });
|
|
58
46
|
if (newRecord.company && newRecord.company.id) {
|
|
59
|
-
newRecord.company = await companyRepo.
|
|
47
|
+
newRecord.company = await companyRepo.findOneBy({ id: newRecord.company.id });
|
|
60
48
|
}
|
|
61
49
|
const result = await bizplaceRepo.save(Object.assign(Object.assign(Object.assign({}, bizplace), newRecord), { updater: context.state.user }));
|
|
62
50
|
results.push(Object.assign(Object.assign({}, result), { cuFlag: 'M' }));
|
|
@@ -65,79 +53,79 @@ let BizplaceMutation = class BizplaceMutation {
|
|
|
65
53
|
return results;
|
|
66
54
|
}
|
|
67
55
|
async updateBizplaceCheckDomain(name, patch, context) {
|
|
68
|
-
let bizplace = await (0,
|
|
56
|
+
let bizplace = await (0, shell_1.getRepository)(bizplace_1.Bizplace).findOne({ where: { name }, relations: ['domain'] });
|
|
69
57
|
let domain = bizplace.domain;
|
|
70
58
|
if (domain) {
|
|
71
59
|
if (bizplace.name !== patch.name) {
|
|
72
|
-
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) }));
|
|
73
61
|
}
|
|
74
62
|
}
|
|
75
|
-
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 }));
|
|
76
64
|
}
|
|
77
65
|
async deleteBizplace(id) {
|
|
78
|
-
await (0,
|
|
66
|
+
await (0, shell_1.getRepository)(bizplace_1.Bizplace).delete(id);
|
|
79
67
|
return true;
|
|
80
68
|
}
|
|
81
69
|
async deleteBizplaces(ids) {
|
|
82
|
-
await (0,
|
|
70
|
+
await (0, shell_1.getRepository)(bizplace_1.Bizplace).delete(ids);
|
|
83
71
|
return true;
|
|
84
72
|
}
|
|
85
73
|
};
|
|
86
|
-
__decorate([
|
|
74
|
+
tslib_1.__decorate([
|
|
87
75
|
(0, type_graphql_1.Directive)('@privilege(category: "bizplace", privilege: "mutation")'),
|
|
88
76
|
(0, type_graphql_1.Mutation)(returns => bizplace_1.Bizplace),
|
|
89
|
-
__param(0, (0, type_graphql_1.Arg)('bizplace')),
|
|
90
|
-
__param(1, (0, type_graphql_1.Ctx)()),
|
|
91
|
-
__metadata("design:type", Function),
|
|
92
|
-
__metadata("design:paramtypes", [bizplace_types_1.NewBizplace, Object]),
|
|
93
|
-
__metadata("design:returntype", Promise)
|
|
77
|
+
tslib_1.__param(0, (0, type_graphql_1.Arg)('bizplace')),
|
|
78
|
+
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
|
79
|
+
tslib_1.__metadata("design:type", Function),
|
|
80
|
+
tslib_1.__metadata("design:paramtypes", [bizplace_types_1.NewBizplace, Object]),
|
|
81
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
94
82
|
], BizplaceMutation.prototype, "createBizplace", null);
|
|
95
|
-
__decorate([
|
|
83
|
+
tslib_1.__decorate([
|
|
96
84
|
(0, type_graphql_1.Directive)('@privilege(category: "bizplace", privilege: "mutation")'),
|
|
97
85
|
(0, type_graphql_1.Mutation)(returns => bizplace_1.Bizplace),
|
|
98
|
-
__param(0, (0, type_graphql_1.Arg)('name')),
|
|
99
|
-
__param(1, (0, type_graphql_1.Arg)('patch')),
|
|
100
|
-
__param(2, (0, type_graphql_1.Ctx)()),
|
|
101
|
-
__metadata("design:type", Function),
|
|
102
|
-
__metadata("design:paramtypes", [String, bizplace_types_1.BizplacePatch, Object]),
|
|
103
|
-
__metadata("design:returntype", Promise)
|
|
86
|
+
tslib_1.__param(0, (0, type_graphql_1.Arg)('name')),
|
|
87
|
+
tslib_1.__param(1, (0, type_graphql_1.Arg)('patch')),
|
|
88
|
+
tslib_1.__param(2, (0, type_graphql_1.Ctx)()),
|
|
89
|
+
tslib_1.__metadata("design:type", Function),
|
|
90
|
+
tslib_1.__metadata("design:paramtypes", [String, bizplace_types_1.BizplacePatch, Object]),
|
|
91
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
104
92
|
], BizplaceMutation.prototype, "updateBizplace", null);
|
|
105
|
-
__decorate([
|
|
93
|
+
tslib_1.__decorate([
|
|
106
94
|
(0, type_graphql_1.Directive)('@privilege(category: "bizplace", privilege: "mutation")'),
|
|
107
95
|
(0, type_graphql_1.Mutation)(returns => [bizplace_1.Bizplace]),
|
|
108
|
-
__param(0, (0, type_graphql_1.Arg)('patches', type => [bizplace_types_1.BizplacePatch])),
|
|
109
|
-
__param(1, (0, type_graphql_1.Ctx)()),
|
|
110
|
-
__metadata("design:type", Function),
|
|
111
|
-
__metadata("design:paramtypes", [Array, Object]),
|
|
112
|
-
__metadata("design:returntype", Promise)
|
|
96
|
+
tslib_1.__param(0, (0, type_graphql_1.Arg)('patches', type => [bizplace_types_1.BizplacePatch])),
|
|
97
|
+
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
|
98
|
+
tslib_1.__metadata("design:type", Function),
|
|
99
|
+
tslib_1.__metadata("design:paramtypes", [Array, Object]),
|
|
100
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
113
101
|
], BizplaceMutation.prototype, "updateMultipleBizplace", null);
|
|
114
|
-
__decorate([
|
|
102
|
+
tslib_1.__decorate([
|
|
115
103
|
(0, type_graphql_1.Directive)('@privilege(category: "bizplace", privilege: "mutation")'),
|
|
116
104
|
(0, type_graphql_1.Mutation)(returns => bizplace_1.Bizplace),
|
|
117
|
-
__param(0, (0, type_graphql_1.Arg)('name')),
|
|
118
|
-
__param(1, (0, type_graphql_1.Arg)('patch')),
|
|
119
|
-
__param(2, (0, type_graphql_1.Ctx)()),
|
|
120
|
-
__metadata("design:type", Function),
|
|
121
|
-
__metadata("design:paramtypes", [String, bizplace_types_1.BizplacePatch, Object]),
|
|
122
|
-
__metadata("design:returntype", Promise)
|
|
105
|
+
tslib_1.__param(0, (0, type_graphql_1.Arg)('name')),
|
|
106
|
+
tslib_1.__param(1, (0, type_graphql_1.Arg)('patch')),
|
|
107
|
+
tslib_1.__param(2, (0, type_graphql_1.Ctx)()),
|
|
108
|
+
tslib_1.__metadata("design:type", Function),
|
|
109
|
+
tslib_1.__metadata("design:paramtypes", [String, bizplace_types_1.BizplacePatch, Object]),
|
|
110
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
123
111
|
], BizplaceMutation.prototype, "updateBizplaceCheckDomain", null);
|
|
124
|
-
__decorate([
|
|
112
|
+
tslib_1.__decorate([
|
|
125
113
|
(0, type_graphql_1.Directive)('@privilege(category: "bizplace", privilege: "mutation")'),
|
|
126
114
|
(0, type_graphql_1.Mutation)(returns => Boolean),
|
|
127
|
-
__param(0, (0, type_graphql_1.Arg)('id')),
|
|
128
|
-
__metadata("design:type", Function),
|
|
129
|
-
__metadata("design:paramtypes", [String]),
|
|
130
|
-
__metadata("design:returntype", Promise)
|
|
115
|
+
tslib_1.__param(0, (0, type_graphql_1.Arg)('id')),
|
|
116
|
+
tslib_1.__metadata("design:type", Function),
|
|
117
|
+
tslib_1.__metadata("design:paramtypes", [String]),
|
|
118
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
131
119
|
], BizplaceMutation.prototype, "deleteBizplace", null);
|
|
132
|
-
__decorate([
|
|
120
|
+
tslib_1.__decorate([
|
|
133
121
|
(0, type_graphql_1.Directive)('@privilege(category: "bizplace", privilege: "mutation")'),
|
|
134
122
|
(0, type_graphql_1.Mutation)(returns => Boolean),
|
|
135
|
-
__param(0, (0, type_graphql_1.Arg)('ids', type => [String])),
|
|
136
|
-
__metadata("design:type", Function),
|
|
137
|
-
__metadata("design:paramtypes", [Array]),
|
|
138
|
-
__metadata("design:returntype", Promise)
|
|
123
|
+
tslib_1.__param(0, (0, type_graphql_1.Arg)('ids', type => [String])),
|
|
124
|
+
tslib_1.__metadata("design:type", Function),
|
|
125
|
+
tslib_1.__metadata("design:paramtypes", [Array]),
|
|
126
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
139
127
|
], BizplaceMutation.prototype, "deleteBizplaces", null);
|
|
140
|
-
BizplaceMutation = __decorate([
|
|
128
|
+
BizplaceMutation = tslib_1.__decorate([
|
|
141
129
|
(0, type_graphql_1.Resolver)(bizplace_1.Bizplace)
|
|
142
130
|
], BizplaceMutation);
|
|
143
131
|
exports.BizplaceMutation = BizplaceMutation;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bizplace-mutation.js","sourceRoot":"","sources":["../../../server/service/bizplace/bizplace-mutation.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"bizplace-mutation.js","sourceRoot":"","sources":["../../../server/service/bizplace/bizplace-mutation.ts"],"names":[],"mappings":";;;;AAAA,+CAAsE;AAEtE,iDA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AA,kBAAG,EAAC,SAAS,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,8BAAa,CAAC,CAAC,CAAA;IACvC,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;8DA+CP;AAID;IAFC,IAAA,wBAAS,EAAC,yDAAyD,CAAC;IACpE,IAAA,uBAAQ,EAAC,OAAO,CAAC,EAAE,CAAC,mBAAQ,CAAC;IAE3B,mBAAA,IAAA,kBAAG,EAAC,MAAM,CAAC,CAAA;IACX,mBAAA,IAAA,kBAAG,EAAC,OAAO,CAAC,CAAA;IACZ,mBAAA,IAAA,kBAAG,GAAE,CAAA;;qDADe,8BAAa;;iEAqBnC;AAID;IAFC,IAAA,wBAAS,EAAC,yDAAyD,CAAC;IACpE,IAAA,uBAAQ,EAAC,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC;IACP,mBAAA,IAAA,kBAAG,EAAC,IAAI,CAAC,CAAA;;;;sDAI9B;AAID;IAFC,IAAA,wBAAS,EAAC,yDAAyD,CAAC;IACpE,IAAA,uBAAQ,EAAC,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC;IACN,mBAAA,IAAA,kBAAG,EAAC,KAAK,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAA;;;;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"]}
|