@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,108 +1,100 @@
|
|
|
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
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
exports.NewCompany = exports.CompanyPatch = exports.CompanyList = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
13
5
|
const type_graphql_1 = require("type-graphql");
|
|
14
6
|
const company_1 = require("./company");
|
|
15
7
|
let CompanyList = class CompanyList {
|
|
16
8
|
};
|
|
17
|
-
__decorate([
|
|
9
|
+
tslib_1.__decorate([
|
|
18
10
|
(0, type_graphql_1.Field)(type => [company_1.Company], { nullable: true }),
|
|
19
|
-
__metadata("design:type", Array)
|
|
11
|
+
tslib_1.__metadata("design:type", Array)
|
|
20
12
|
], CompanyList.prototype, "items", void 0);
|
|
21
|
-
__decorate([
|
|
13
|
+
tslib_1.__decorate([
|
|
22
14
|
(0, type_graphql_1.Field)(type => type_graphql_1.Int, { nullable: true }),
|
|
23
|
-
__metadata("design:type", Number)
|
|
15
|
+
tslib_1.__metadata("design:type", Number)
|
|
24
16
|
], CompanyList.prototype, "total", void 0);
|
|
25
|
-
CompanyList = __decorate([
|
|
17
|
+
CompanyList = tslib_1.__decorate([
|
|
26
18
|
(0, type_graphql_1.ObjectType)()
|
|
27
19
|
], CompanyList);
|
|
28
20
|
exports.CompanyList = CompanyList;
|
|
29
21
|
let CompanyPatch = class CompanyPatch {
|
|
30
22
|
};
|
|
31
|
-
__decorate([
|
|
23
|
+
tslib_1.__decorate([
|
|
32
24
|
(0, type_graphql_1.Field)({ nullable: true }),
|
|
33
|
-
__metadata("design:type", String)
|
|
25
|
+
tslib_1.__metadata("design:type", String)
|
|
34
26
|
], CompanyPatch.prototype, "id", void 0);
|
|
35
|
-
__decorate([
|
|
27
|
+
tslib_1.__decorate([
|
|
36
28
|
(0, type_graphql_1.Field)({ nullable: true }),
|
|
37
|
-
__metadata("design:type", String)
|
|
29
|
+
tslib_1.__metadata("design:type", String)
|
|
38
30
|
], CompanyPatch.prototype, "name", void 0);
|
|
39
|
-
__decorate([
|
|
31
|
+
tslib_1.__decorate([
|
|
40
32
|
(0, type_graphql_1.Field)({ nullable: true }),
|
|
41
|
-
__metadata("design:type", String)
|
|
33
|
+
tslib_1.__metadata("design:type", String)
|
|
42
34
|
], CompanyPatch.prototype, "description", void 0);
|
|
43
|
-
__decorate([
|
|
35
|
+
tslib_1.__decorate([
|
|
44
36
|
(0, type_graphql_1.Field)({ nullable: true }),
|
|
45
|
-
__metadata("design:type", String)
|
|
37
|
+
tslib_1.__metadata("design:type", String)
|
|
46
38
|
], CompanyPatch.prototype, "countryCode", void 0);
|
|
47
|
-
__decorate([
|
|
39
|
+
tslib_1.__decorate([
|
|
48
40
|
(0, type_graphql_1.Field)({ nullable: true }),
|
|
49
|
-
__metadata("design:type", String)
|
|
41
|
+
tslib_1.__metadata("design:type", String)
|
|
50
42
|
], CompanyPatch.prototype, "brn", void 0);
|
|
51
|
-
__decorate([
|
|
43
|
+
tslib_1.__decorate([
|
|
52
44
|
(0, type_graphql_1.Field)({ nullable: true }),
|
|
53
|
-
__metadata("design:type", String)
|
|
45
|
+
tslib_1.__metadata("design:type", String)
|
|
54
46
|
], CompanyPatch.prototype, "address", void 0);
|
|
55
|
-
__decorate([
|
|
47
|
+
tslib_1.__decorate([
|
|
56
48
|
(0, type_graphql_1.Field)({ nullable: true }),
|
|
57
|
-
__metadata("design:type", String)
|
|
49
|
+
tslib_1.__metadata("design:type", String)
|
|
58
50
|
], CompanyPatch.prototype, "postalCode", void 0);
|
|
59
|
-
__decorate([
|
|
51
|
+
tslib_1.__decorate([
|
|
60
52
|
(0, type_graphql_1.Field)({ nullable: true }),
|
|
61
|
-
__metadata("design:type", String)
|
|
53
|
+
tslib_1.__metadata("design:type", String)
|
|
62
54
|
], CompanyPatch.prototype, "status", void 0);
|
|
63
|
-
__decorate([
|
|
55
|
+
tslib_1.__decorate([
|
|
64
56
|
(0, type_graphql_1.Field)({ nullable: true }),
|
|
65
|
-
__metadata("design:type", String)
|
|
57
|
+
tslib_1.__metadata("design:type", String)
|
|
66
58
|
], CompanyPatch.prototype, "cuFlag", void 0);
|
|
67
|
-
CompanyPatch = __decorate([
|
|
59
|
+
CompanyPatch = tslib_1.__decorate([
|
|
68
60
|
(0, type_graphql_1.InputType)()
|
|
69
61
|
], CompanyPatch);
|
|
70
62
|
exports.CompanyPatch = CompanyPatch;
|
|
71
63
|
let NewCompany = class NewCompany {
|
|
72
64
|
};
|
|
73
|
-
__decorate([
|
|
65
|
+
tslib_1.__decorate([
|
|
74
66
|
(0, type_graphql_1.Field)(),
|
|
75
|
-
__metadata("design:type", String)
|
|
67
|
+
tslib_1.__metadata("design:type", String)
|
|
76
68
|
], NewCompany.prototype, "name", void 0);
|
|
77
|
-
__decorate([
|
|
69
|
+
tslib_1.__decorate([
|
|
78
70
|
(0, type_graphql_1.Field)({ nullable: true }),
|
|
79
|
-
__metadata("design:type", String)
|
|
71
|
+
tslib_1.__metadata("design:type", String)
|
|
80
72
|
], NewCompany.prototype, "description", void 0);
|
|
81
|
-
__decorate([
|
|
73
|
+
tslib_1.__decorate([
|
|
82
74
|
(0, type_graphql_1.Field)(),
|
|
83
|
-
__metadata("design:type", String)
|
|
75
|
+
tslib_1.__metadata("design:type", String)
|
|
84
76
|
], NewCompany.prototype, "countryCode", void 0);
|
|
85
|
-
__decorate([
|
|
77
|
+
tslib_1.__decorate([
|
|
86
78
|
(0, type_graphql_1.Field)(),
|
|
87
|
-
__metadata("design:type", String)
|
|
79
|
+
tslib_1.__metadata("design:type", String)
|
|
88
80
|
], NewCompany.prototype, "brn", void 0);
|
|
89
|
-
__decorate([
|
|
81
|
+
tslib_1.__decorate([
|
|
90
82
|
(0, type_graphql_1.Field)(),
|
|
91
|
-
__metadata("design:type", String)
|
|
83
|
+
tslib_1.__metadata("design:type", String)
|
|
92
84
|
], NewCompany.prototype, "address", void 0);
|
|
93
|
-
__decorate([
|
|
85
|
+
tslib_1.__decorate([
|
|
94
86
|
(0, type_graphql_1.Field)({ nullable: true }),
|
|
95
|
-
__metadata("design:type", String)
|
|
87
|
+
tslib_1.__metadata("design:type", String)
|
|
96
88
|
], NewCompany.prototype, "postalCode", void 0);
|
|
97
|
-
__decorate([
|
|
89
|
+
tslib_1.__decorate([
|
|
98
90
|
(0, type_graphql_1.Field)({ nullable: true }),
|
|
99
|
-
__metadata("design:type", String)
|
|
91
|
+
tslib_1.__metadata("design:type", String)
|
|
100
92
|
], NewCompany.prototype, "type", void 0);
|
|
101
|
-
__decorate([
|
|
93
|
+
tslib_1.__decorate([
|
|
102
94
|
(0, type_graphql_1.Field)(),
|
|
103
|
-
__metadata("design:type", String)
|
|
95
|
+
tslib_1.__metadata("design:type", String)
|
|
104
96
|
], NewCompany.prototype, "status", void 0);
|
|
105
|
-
NewCompany = __decorate([
|
|
97
|
+
NewCompany = tslib_1.__decorate([
|
|
106
98
|
(0, type_graphql_1.InputType)()
|
|
107
99
|
], NewCompany);
|
|
108
100
|
exports.NewCompany = NewCompany;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"company-types.js","sourceRoot":"","sources":["../../../server/service/company/company-types.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"company-types.js","sourceRoot":"","sources":["../../../server/service/company/company-types.ts"],"names":[],"mappings":";;;;AAAA,+CAAgE;AAChE,uCAAmC;AAGnC,IAAa,WAAW,GAAxB,MAAa,WAAW;CAMvB,CAAA;AAJC;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,CAAC,iBAAO,CAAC,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;0CAC5B;AAGjB;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,kBAAG,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;0CACzB;AALH,WAAW;IADvB,IAAA,yBAAU,GAAE;GACA,WAAW,CAMvB;AANY,kCAAW;AASxB,IAAa,YAAY,GAAzB,MAAa,YAAY;CA2BxB,CAAA;AAzBC;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;wCACf;AAGX;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;0CACb;AAGb;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;iDACN;AAGpB;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;iDACN;AAGpB;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;yCACd;AAGZ;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;6CACV;AAGhB;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;gDACP;AAGnB;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;4CACX;AAGf;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;4CACX;AA1BJ,YAAY;IADxB,IAAA,wBAAS,GAAE;GACC,YAAY,CA2BxB;AA3BY,oCAAY;AA8BzB,IAAa,UAAU,GAAvB,MAAa,UAAU;CAwBtB,CAAA;AAtBC;IADC,IAAA,oBAAK,GAAE;;wCACI;AAGZ;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;+CACN;AAGpB;IADC,IAAA,oBAAK,GAAE;;+CACW;AAGnB;IADC,IAAA,oBAAK,GAAE;;uCACG;AAGX;IADC,IAAA,oBAAK,GAAE;;2CACO;AAGf;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;8CACR;AAGlB;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;wCACb;AAGb;IADC,IAAA,oBAAK,GAAE;;0CACM;AAvBH,UAAU;IADtB,IAAA,wBAAS,GAAE;GACC,UAAU,CAwBtB;AAxBY,gCAAU","sourcesContent":["import { ObjectType, InputType, Field, Int } from 'type-graphql'\nimport { Company } from './company'\n\n@ObjectType()\nexport class CompanyList {\n @Field(type => [Company], { nullable: true })\n items?: Company[]\n\n @Field(type => Int, { nullable: true })\n total?: number\n}\n\n@InputType()\nexport class CompanyPatch {\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 countryCode?: string\n\n @Field({ nullable: true })\n brn?: string\n\n @Field({ nullable: true })\n address?: string\n\n @Field({ nullable: true })\n postalCode?: string\n\n @Field({ nullable: true })\n status?: string\n\n @Field({ nullable: true })\n cuFlag?: string\n}\n\n@InputType()\nexport class NewCompany {\n @Field()\n name: string\n\n @Field({ nullable: true })\n description?: string\n\n @Field()\n countryCode: string\n\n @Field()\n brn: string\n\n @Field()\n address: string\n\n @Field({ nullable: true })\n postalCode: string\n\n @Field({ nullable: true })\n type?: string\n\n @Field()\n status: string\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.Company = 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,107 +9,107 @@ const shell_1 = require("@things-factory/shell");
|
|
|
18
9
|
const bizplace_1 = require("../bizplace/bizplace");
|
|
19
10
|
let Company = class Company {
|
|
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
|
], Company.prototype, "id", void 0);
|
|
26
|
-
__decorate([
|
|
17
|
+
tslib_1.__decorate([
|
|
27
18
|
(0, typeorm_1.ManyToOne)(type => shell_1.Domain),
|
|
28
19
|
(0, type_graphql_1.Field)(type => shell_1.Domain),
|
|
29
|
-
__metadata("design:type",
|
|
20
|
+
tslib_1.__metadata("design:type", shell_1.Domain)
|
|
30
21
|
], Company.prototype, "domain", void 0);
|
|
31
|
-
__decorate([
|
|
22
|
+
tslib_1.__decorate([
|
|
32
23
|
(0, typeorm_1.RelationId)((company) => company.domain),
|
|
33
24
|
(0, type_graphql_1.Field)(),
|
|
34
|
-
__metadata("design:type", String)
|
|
25
|
+
tslib_1.__metadata("design:type", String)
|
|
35
26
|
], Company.prototype, "domainId", void 0);
|
|
36
|
-
__decorate([
|
|
27
|
+
tslib_1.__decorate([
|
|
37
28
|
(0, typeorm_1.Column)(),
|
|
38
29
|
(0, type_graphql_1.Field)(),
|
|
39
|
-
__metadata("design:type", String)
|
|
30
|
+
tslib_1.__metadata("design:type", String)
|
|
40
31
|
], Company.prototype, "name", void 0);
|
|
41
|
-
__decorate([
|
|
32
|
+
tslib_1.__decorate([
|
|
42
33
|
(0, typeorm_1.Column)({
|
|
43
34
|
nullable: true
|
|
44
35
|
}),
|
|
45
36
|
(0, type_graphql_1.Field)({ nullable: true }),
|
|
46
|
-
__metadata("design:type", String)
|
|
37
|
+
tslib_1.__metadata("design:type", String)
|
|
47
38
|
], Company.prototype, "description", void 0);
|
|
48
|
-
__decorate([
|
|
39
|
+
tslib_1.__decorate([
|
|
49
40
|
(0, typeorm_1.Column)(),
|
|
50
41
|
(0, type_graphql_1.Field)(),
|
|
51
|
-
__metadata("design:type", String)
|
|
42
|
+
tslib_1.__metadata("design:type", String)
|
|
52
43
|
], Company.prototype, "countryCode", void 0);
|
|
53
|
-
__decorate([
|
|
44
|
+
tslib_1.__decorate([
|
|
54
45
|
(0, typeorm_1.Column)(),
|
|
55
46
|
(0, type_graphql_1.Field)(),
|
|
56
|
-
__metadata("design:type", String)
|
|
47
|
+
tslib_1.__metadata("design:type", String)
|
|
57
48
|
], Company.prototype, "brn", void 0);
|
|
58
|
-
__decorate([
|
|
49
|
+
tslib_1.__decorate([
|
|
59
50
|
(0, typeorm_1.Column)(),
|
|
60
51
|
(0, type_graphql_1.Field)(),
|
|
61
|
-
__metadata("design:type", String)
|
|
52
|
+
tslib_1.__metadata("design:type", String)
|
|
62
53
|
], Company.prototype, "address", void 0);
|
|
63
|
-
__decorate([
|
|
54
|
+
tslib_1.__decorate([
|
|
64
55
|
(0, typeorm_1.Column)({
|
|
65
56
|
nullable: true
|
|
66
57
|
}),
|
|
67
58
|
(0, type_graphql_1.Field)({ nullable: true }),
|
|
68
|
-
__metadata("design:type", String)
|
|
59
|
+
tslib_1.__metadata("design:type", String)
|
|
69
60
|
], Company.prototype, "postalCode", void 0);
|
|
70
|
-
__decorate([
|
|
61
|
+
tslib_1.__decorate([
|
|
71
62
|
(0, typeorm_1.Column)({
|
|
72
63
|
nullable: true
|
|
73
64
|
}),
|
|
74
65
|
(0, type_graphql_1.Field)({ nullable: true }),
|
|
75
|
-
__metadata("design:type", String)
|
|
66
|
+
tslib_1.__metadata("design:type", String)
|
|
76
67
|
], Company.prototype, "type", void 0);
|
|
77
|
-
__decorate([
|
|
68
|
+
tslib_1.__decorate([
|
|
78
69
|
(0, typeorm_1.Column)({
|
|
79
70
|
nullable: true
|
|
80
71
|
}),
|
|
81
72
|
(0, type_graphql_1.Field)({ nullable: true }),
|
|
82
|
-
__metadata("design:type", String)
|
|
73
|
+
tslib_1.__metadata("design:type", String)
|
|
83
74
|
], Company.prototype, "status", void 0);
|
|
84
|
-
__decorate([
|
|
75
|
+
tslib_1.__decorate([
|
|
85
76
|
(0, typeorm_1.OneToMany)(type => bizplace_1.Bizplace, bizplace => bizplace.company),
|
|
86
77
|
(0, type_graphql_1.Field)(type => [bizplace_1.Bizplace]),
|
|
87
|
-
__metadata("design:type", Array)
|
|
78
|
+
tslib_1.__metadata("design:type", Array)
|
|
88
79
|
], Company.prototype, "bizplaces", void 0);
|
|
89
|
-
__decorate([
|
|
80
|
+
tslib_1.__decorate([
|
|
90
81
|
(0, typeorm_1.ManyToOne)(type => auth_base_1.User, {
|
|
91
82
|
nullable: true
|
|
92
83
|
}),
|
|
93
84
|
(0, type_graphql_1.Field)(type => auth_base_1.User, { nullable: true }),
|
|
94
|
-
__metadata("design:type",
|
|
85
|
+
tslib_1.__metadata("design:type", auth_base_1.User)
|
|
95
86
|
], Company.prototype, "creator", void 0);
|
|
96
|
-
__decorate([
|
|
87
|
+
tslib_1.__decorate([
|
|
97
88
|
(0, typeorm_1.RelationId)((company) => company.creator),
|
|
98
|
-
__metadata("design:type", String)
|
|
89
|
+
tslib_1.__metadata("design:type", String)
|
|
99
90
|
], Company.prototype, "creatorId", void 0);
|
|
100
|
-
__decorate([
|
|
91
|
+
tslib_1.__decorate([
|
|
101
92
|
(0, typeorm_1.ManyToOne)(type => auth_base_1.User, {
|
|
102
93
|
nullable: true
|
|
103
94
|
}),
|
|
104
95
|
(0, type_graphql_1.Field)(type => auth_base_1.User, { nullable: true }),
|
|
105
|
-
__metadata("design:type",
|
|
96
|
+
tslib_1.__metadata("design:type", auth_base_1.User)
|
|
106
97
|
], Company.prototype, "updater", void 0);
|
|
107
|
-
__decorate([
|
|
98
|
+
tslib_1.__decorate([
|
|
108
99
|
(0, typeorm_1.RelationId)((company) => company.updater),
|
|
109
|
-
__metadata("design:type", String)
|
|
100
|
+
tslib_1.__metadata("design:type", String)
|
|
110
101
|
], Company.prototype, "updaterId", void 0);
|
|
111
|
-
__decorate([
|
|
102
|
+
tslib_1.__decorate([
|
|
112
103
|
(0, typeorm_1.CreateDateColumn)(),
|
|
113
104
|
(0, type_graphql_1.Field)({ nullable: true }),
|
|
114
|
-
__metadata("design:type", Date)
|
|
105
|
+
tslib_1.__metadata("design:type", Date)
|
|
115
106
|
], Company.prototype, "createdAt", void 0);
|
|
116
|
-
__decorate([
|
|
107
|
+
tslib_1.__decorate([
|
|
117
108
|
(0, typeorm_1.UpdateDateColumn)(),
|
|
118
109
|
(0, type_graphql_1.Field)({ nullable: true }),
|
|
119
|
-
__metadata("design:type", Date)
|
|
110
|
+
tslib_1.__metadata("design:type", Date)
|
|
120
111
|
], Company.prototype, "updatedAt", void 0);
|
|
121
|
-
Company = __decorate([
|
|
112
|
+
Company = tslib_1.__decorate([
|
|
122
113
|
(0, typeorm_1.Entity)(),
|
|
123
114
|
(0, typeorm_1.Index)('ix_companies_0', (company) => [company.name], { unique: true }),
|
|
124
115
|
(0, typeorm_1.Index)('ix_companies_1', (company) => [company.domain], { unique: false }),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"company.js","sourceRoot":"","sources":["../../../server/service/company/company.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"company.js","sourceRoot":"","sources":["../../../server/service/company/company.ts"],"names":[],"mappings":";;;;AAAA,+CAAoD;AACpD,qCAUgB;AAEhB,yDAAgD;AAChD,iDAA8C;AAE9C,mDAA+C;AAM/C,IAAa,OAAO,GAApB,MAAa,OAAO;CAkFnB,CAAA;AA/EC;IAFC,IAAA,gCAAsB,EAAC,MAAM,CAAC;IAC9B,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,iBAAE,CAAC;;mCACC;AAInB;IAFC,IAAA,mBAAS,EAAC,IAAI,CAAC,EAAE,CAAC,cAAM,CAAC;IACzB,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,cAAM,CAAC;sCACd,cAAM;uCAAA;AAId;IAFC,IAAA,oBAAU,EAAC,CAAC,OAAgB,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC;IAChD,IAAA,oBAAK,GAAE;;yCACQ;AAIhB;IAFC,IAAA,gBAAM,GAAE;IACR,IAAA,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AAE,CAAC,OAAO,CAAC,OAAO,CAAC;;0CACjC;AAMjB;IAJC,IAAA,mBAAS,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,EAAE;QACvB,QAAQ,EAAE,IAAI;KACf,CAAC;IACD,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;sCAC/B,gBAAI;wCAAA;AAGb;IADC,IAAA,oBAAU,EAAC,CAAC,OAAgB,EAAE,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC;;0CACjC;AAIjB;IAFC,IAAA,0BAAgB,GAAE;IAClB,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;sCACf,IAAI;0CAAA;AAIf;IAFC,IAAA,0BAAgB,GAAE;IAClB,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;sCACf,IAAI;0CAAA;AAjFJ,OAAO;IAJnB,IAAA,gBAAM,GAAE;IACR,IAAA,eAAK,EAAC,gBAAgB,EAAE,CAAC,OAAgB,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;IAC/E,IAAA,eAAK,EAAC,gBAAgB,EAAE,CAAC,OAAgB,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;IAClF,IAAA,yBAAU,GAAE;GACA,OAAO,CAkFnB;AAlFY,0BAAO","sourcesContent":["import { Field, ID, ObjectType } from 'type-graphql'\nimport {\n Column,\n CreateDateColumn,\n Entity,\n Index,\n ManyToOne,\n OneToMany,\n PrimaryGeneratedColumn,\n RelationId,\n UpdateDateColumn\n} from 'typeorm'\n\nimport { User } from '@things-factory/auth-base'\nimport { Domain } from '@things-factory/shell'\n\nimport { Bizplace } from '../bizplace/bizplace'\n\n@Entity()\n@Index('ix_companies_0', (company: Company) => [company.name], { unique: true })\n@Index('ix_companies_1', (company: Company) => [company.domain], { unique: false })\n@ObjectType()\nexport class Company {\n @PrimaryGeneratedColumn('uuid')\n @Field(type => ID)\n readonly id: string\n\n @ManyToOne(type => Domain)\n @Field(type => Domain)\n domain: Domain\n\n @RelationId((company: Company) => company.domain)\n @Field()\n domainId: string\n\n @Column()\n @Field()\n name: string\n\n @Column({\n nullable: true\n })\n @Field({ nullable: true })\n description: string\n\n @Column()\n @Field()\n countryCode: string\n\n @Column()\n @Field()\n brn: string\n\n @Column()\n @Field()\n address: string\n\n @Column({\n nullable: true\n })\n @Field({ nullable: true })\n postalCode: string\n\n @Column({\n nullable: true\n })\n @Field({ nullable: true })\n type: string\n\n @Column({\n nullable: true\n })\n @Field({ nullable: true })\n status: string\n\n @OneToMany(type => Bizplace, bizplace => bizplace.company)\n @Field(type => [Bizplace])\n bizplaces: Bizplace[]\n\n @ManyToOne(type => User, {\n nullable: true\n })\n @Field(type => User, { nullable: true })\n creator: User\n\n @RelationId((company: Company) => company.creator)\n creatorId: string\n\n @ManyToOne(type => User, {\n nullable: true\n })\n @Field(type => User, { nullable: true })\n updater: User\n\n @RelationId((company: Company) => company.updater)\n updaterId: string\n\n @CreateDateColumn()\n @Field({ nullable: true })\n createdAt: Date\n\n @UpdateDateColumn()\n @Field({ nullable: true })\n updatedAt: Date\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../server/service/company/index.ts"],"names":[],"mappings":";;;AAAA,uCAAmC;AACnC,yDAAoD;AACpD,mDAA8C;AAEjC,QAAA,QAAQ,GAAG,CAAC,iBAAO,CAAC,CAAA;AACpB,QAAA,SAAS,GAAG,CAAC,4BAAY,EAAE,kCAAe,CAAC,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../server/service/company/index.ts"],"names":[],"mappings":";;;AAAA,uCAAmC;AACnC,yDAAoD;AACpD,mDAA8C;AAEjC,QAAA,QAAQ,GAAG,CAAC,iBAAO,CAAC,CAAA;AACpB,QAAA,SAAS,GAAG,CAAC,4BAAY,EAAE,kCAAe,CAAC,CAAA","sourcesContent":["import { Company } from './company'\nimport { CompanyMutation } from './company-mutation'\nimport { CompanyQuery } from './company-query'\n\nexport const entities = [Company]\nexport const resolvers = [CompanyQuery, CompanyMutation]\n"]}
|
|
@@ -1,20 +1,9 @@
|
|
|
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.deleteContactPoint = exports.updateContactPoint = exports.createContactPoint = exports.ContactPointMutation = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
16
5
|
const type_graphql_1 = require("type-graphql");
|
|
17
|
-
const
|
|
6
|
+
const shell_1 = require("@things-factory/shell");
|
|
18
7
|
const bizplace_1 = require("../bizplace/bizplace");
|
|
19
8
|
const contact_point_1 = require("./contact-point");
|
|
20
9
|
const contact_point_types_1 = require("./contact-point-types");
|
|
@@ -23,11 +12,11 @@ let ContactPointMutation = class ContactPointMutation {
|
|
|
23
12
|
return await createContactPoint(contactPoint, context);
|
|
24
13
|
}
|
|
25
14
|
async updateContactPoint(id, patch, context) {
|
|
26
|
-
const contactPoint = await (0,
|
|
15
|
+
const contactPoint = await (0, shell_1.getRepository)(contact_point_1.ContactPoint).findOneBy({ id });
|
|
27
16
|
if (patch.bizplace && patch.bizplace.id) {
|
|
28
|
-
patch.bizplace = await (0,
|
|
17
|
+
patch.bizplace = await (0, shell_1.getRepository)(bizplace_1.Bizplace).findOneBy({ id: patch.bizplace.id });
|
|
29
18
|
}
|
|
30
|
-
return await (0,
|
|
19
|
+
return await (0, shell_1.getRepository)(contact_point_1.ContactPoint).save(Object.assign(Object.assign(Object.assign({}, contactPoint), patch), { updater: context.state.user }));
|
|
31
20
|
}
|
|
32
21
|
async updateMultipleContactPoint(patches, context) {
|
|
33
22
|
const { tx } = context.state;
|
|
@@ -73,91 +62,91 @@ let ContactPointMutation = class ContactPointMutation {
|
|
|
73
62
|
return true;
|
|
74
63
|
}
|
|
75
64
|
async deleteContactPoints(ids, context) {
|
|
76
|
-
await (0,
|
|
65
|
+
await (0, shell_1.getRepository)(contact_point_1.ContactPoint).delete(ids);
|
|
77
66
|
return true;
|
|
78
67
|
}
|
|
79
68
|
};
|
|
80
|
-
__decorate([
|
|
69
|
+
tslib_1.__decorate([
|
|
81
70
|
(0, type_graphql_1.Directive)('@privilege(category: "contact_point", privilege: "mutation")'),
|
|
82
71
|
(0, type_graphql_1.Mutation)(returns => contact_point_1.ContactPoint),
|
|
83
|
-
__param(0, (0, type_graphql_1.Arg)('contactPoint')),
|
|
84
|
-
__param(1, (0, type_graphql_1.Ctx)()),
|
|
85
|
-
__metadata("design:type", Function),
|
|
86
|
-
__metadata("design:paramtypes", [contact_point_types_1.NewContactPoint, Object]),
|
|
87
|
-
__metadata("design:returntype", Promise)
|
|
72
|
+
tslib_1.__param(0, (0, type_graphql_1.Arg)('contactPoint')),
|
|
73
|
+
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
|
74
|
+
tslib_1.__metadata("design:type", Function),
|
|
75
|
+
tslib_1.__metadata("design:paramtypes", [contact_point_types_1.NewContactPoint, Object]),
|
|
76
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
88
77
|
], ContactPointMutation.prototype, "createContactPoint", null);
|
|
89
|
-
__decorate([
|
|
78
|
+
tslib_1.__decorate([
|
|
90
79
|
(0, type_graphql_1.Directive)('@privilege(category: "contact_point", privilege: "mutation")'),
|
|
91
80
|
(0, type_graphql_1.Mutation)(returns => contact_point_1.ContactPoint),
|
|
92
|
-
__param(0, (0, type_graphql_1.Arg)('id')),
|
|
93
|
-
__param(1, (0, type_graphql_1.Arg)('patch')),
|
|
94
|
-
__param(2, (0, type_graphql_1.Ctx)()),
|
|
95
|
-
__metadata("design:type", Function),
|
|
96
|
-
__metadata("design:paramtypes", [String, contact_point_types_1.ContactPointPatch, Object]),
|
|
97
|
-
__metadata("design:returntype", Promise)
|
|
81
|
+
tslib_1.__param(0, (0, type_graphql_1.Arg)('id')),
|
|
82
|
+
tslib_1.__param(1, (0, type_graphql_1.Arg)('patch')),
|
|
83
|
+
tslib_1.__param(2, (0, type_graphql_1.Ctx)()),
|
|
84
|
+
tslib_1.__metadata("design:type", Function),
|
|
85
|
+
tslib_1.__metadata("design:paramtypes", [String, contact_point_types_1.ContactPointPatch, Object]),
|
|
86
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
98
87
|
], ContactPointMutation.prototype, "updateContactPoint", null);
|
|
99
|
-
__decorate([
|
|
88
|
+
tslib_1.__decorate([
|
|
100
89
|
(0, type_graphql_1.Directive)('@privilege(category: "contact_point", privilege: "mutation")'),
|
|
101
90
|
(0, type_graphql_1.Mutation)(returns => [contact_point_1.ContactPoint]),
|
|
102
|
-
__param(0, (0, type_graphql_1.Arg)('patches', type => [contact_point_types_1.ContactPointPatch])),
|
|
103
|
-
__param(1, (0, type_graphql_1.Ctx)()),
|
|
104
|
-
__metadata("design:type", Function),
|
|
105
|
-
__metadata("design:paramtypes", [Array, Object]),
|
|
106
|
-
__metadata("design:returntype", Promise)
|
|
91
|
+
tslib_1.__param(0, (0, type_graphql_1.Arg)('patches', type => [contact_point_types_1.ContactPointPatch])),
|
|
92
|
+
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
|
93
|
+
tslib_1.__metadata("design:type", Function),
|
|
94
|
+
tslib_1.__metadata("design:paramtypes", [Array, Object]),
|
|
95
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
107
96
|
], ContactPointMutation.prototype, "updateMultipleContactPoint", null);
|
|
108
|
-
__decorate([
|
|
97
|
+
tslib_1.__decorate([
|
|
109
98
|
(0, type_graphql_1.Directive)('@privilege(category: "contact_point", privilege: "mutation")'),
|
|
110
99
|
(0, type_graphql_1.Mutation)(returns => Boolean),
|
|
111
|
-
__param(0, (0, type_graphql_1.Arg)('id')),
|
|
112
|
-
__param(1, (0, type_graphql_1.Ctx)()),
|
|
113
|
-
__metadata("design:type", Function),
|
|
114
|
-
__metadata("design:paramtypes", [String, Object]),
|
|
115
|
-
__metadata("design:returntype", Promise)
|
|
100
|
+
tslib_1.__param(0, (0, type_graphql_1.Arg)('id')),
|
|
101
|
+
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
|
102
|
+
tslib_1.__metadata("design:type", Function),
|
|
103
|
+
tslib_1.__metadata("design:paramtypes", [String, Object]),
|
|
104
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
116
105
|
], ContactPointMutation.prototype, "deleteContactPoint", null);
|
|
117
|
-
__decorate([
|
|
106
|
+
tslib_1.__decorate([
|
|
118
107
|
(0, type_graphql_1.Directive)('@privilege(category: "contact_point", privilege: "mutation")'),
|
|
119
108
|
(0, type_graphql_1.Mutation)(returns => Boolean),
|
|
120
|
-
__param(0, (0, type_graphql_1.Arg)('ids', type => [String])),
|
|
121
|
-
__param(1, (0, type_graphql_1.Ctx)()),
|
|
122
|
-
__metadata("design:type", Function),
|
|
123
|
-
__metadata("design:paramtypes", [Array, Object]),
|
|
124
|
-
__metadata("design:returntype", Promise)
|
|
109
|
+
tslib_1.__param(0, (0, type_graphql_1.Arg)('ids', type => [String])),
|
|
110
|
+
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
|
111
|
+
tslib_1.__metadata("design:type", Function),
|
|
112
|
+
tslib_1.__metadata("design:paramtypes", [Array, Object]),
|
|
113
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
125
114
|
], ContactPointMutation.prototype, "deleteContactPoints", null);
|
|
126
|
-
ContactPointMutation = __decorate([
|
|
115
|
+
ContactPointMutation = tslib_1.__decorate([
|
|
127
116
|
(0, type_graphql_1.Resolver)(contact_point_1.ContactPoint)
|
|
128
117
|
], ContactPointMutation);
|
|
129
118
|
exports.ContactPointMutation = ContactPointMutation;
|
|
130
119
|
async function createContactPoint(contactPoint, context, tx) {
|
|
131
120
|
var _a;
|
|
132
121
|
const { domain, user } = context.state;
|
|
133
|
-
const bizplaceRepo = (tx === null || tx === void 0 ? void 0 : tx.getRepository(bizplace_1.Bizplace)) || (0,
|
|
134
|
-
const contactPointRepo = (tx === null || tx === void 0 ? void 0 : tx.getRepository(contact_point_1.ContactPoint)) || (0,
|
|
122
|
+
const bizplaceRepo = (tx === null || tx === void 0 ? void 0 : tx.getRepository(bizplace_1.Bizplace)) || (0, shell_1.getRepository)(bizplace_1.Bizplace);
|
|
123
|
+
const contactPointRepo = (tx === null || tx === void 0 ? void 0 : tx.getRepository(contact_point_1.ContactPoint)) || (0, shell_1.getRepository)(contact_point_1.ContactPoint);
|
|
135
124
|
if (!((_a = contactPoint.bizplace) === null || _a === void 0 ? void 0 : _a.id)) {
|
|
136
125
|
contactPoint.bizplace = await bizplaceRepo.findOne({ where: { name: domain.name } });
|
|
137
126
|
}
|
|
138
127
|
else {
|
|
139
|
-
contactPoint.bizplace = await bizplaceRepo.
|
|
128
|
+
contactPoint.bizplace = await bizplaceRepo.findOneBy({ id: contactPoint.bizplace.id });
|
|
140
129
|
}
|
|
141
130
|
return await contactPointRepo.save(Object.assign(Object.assign({}, contactPoint), { domain, creator: user, updater: user }));
|
|
142
131
|
}
|
|
143
132
|
exports.createContactPoint = createContactPoint;
|
|
144
133
|
async function updateContactPoint(id, patch, context, tx) {
|
|
145
134
|
var _a, _b;
|
|
146
|
-
const bizplaceRepo = (tx === null || tx === void 0 ? void 0 : tx.getRepository(bizplace_1.Bizplace)) || (0,
|
|
147
|
-
const contactPointRepo = (tx === null || tx === void 0 ? void 0 : tx.getRepository(contact_point_1.ContactPoint)) || (0,
|
|
135
|
+
const bizplaceRepo = (tx === null || tx === void 0 ? void 0 : tx.getRepository(bizplace_1.Bizplace)) || (0, shell_1.getRepository)(bizplace_1.Bizplace);
|
|
136
|
+
const contactPointRepo = (tx === null || tx === void 0 ? void 0 : tx.getRepository(contact_point_1.ContactPoint)) || (0, shell_1.getRepository)(contact_point_1.ContactPoint);
|
|
148
137
|
const { domain, user } = context.state;
|
|
149
138
|
let contactPoint = await contactPointRepo.findOne({ where: { id }, relations: ['bizplace'] });
|
|
150
139
|
if (!((_a = contactPoint === null || contactPoint === void 0 ? void 0 : contactPoint.bizplace) === null || _a === void 0 ? void 0 : _a.id)) {
|
|
151
140
|
patch.bizplace = await bizplaceRepo.findOne({ where: { name: domain.name } });
|
|
152
141
|
}
|
|
153
142
|
if ((_b = patch === null || patch === void 0 ? void 0 : patch.bizplace) === null || _b === void 0 ? void 0 : _b.id) {
|
|
154
|
-
patch.bizplace = await bizplaceRepo.
|
|
143
|
+
patch.bizplace = await bizplaceRepo.findOneBy({ id: patch.bizplace.id });
|
|
155
144
|
}
|
|
156
145
|
return await contactPointRepo.save(Object.assign(Object.assign(Object.assign({}, contactPoint), patch), { updater: user }));
|
|
157
146
|
}
|
|
158
147
|
exports.updateContactPoint = updateContactPoint;
|
|
159
148
|
async function deleteContactPoint(id, tx) {
|
|
160
|
-
const contactPointRepo = (tx === null || tx === void 0 ? void 0 : tx.getRepository(contact_point_1.ContactPoint)) || (0,
|
|
149
|
+
const contactPointRepo = (tx === null || tx === void 0 ? void 0 : tx.getRepository(contact_point_1.ContactPoint)) || (0, shell_1.getRepository)(contact_point_1.ContactPoint);
|
|
161
150
|
await contactPointRepo.delete(id);
|
|
162
151
|
}
|
|
163
152
|
exports.deleteContactPoint = deleteContactPoint;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contact-point-mutation.js","sourceRoot":"","sources":["../../../server/service/contact-point/contact-point-mutation.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,+CAAsE;AACtE,qCAAkE;AAKlE,mDAA+C;AAC/C,mDAA8C;AAC9C,+DAA0E;AAG1E,IAAa,oBAAoB,GAAjC,MAAa,oBAAoB;IAG/B,KAAK,CAAC,kBAAkB,CACD,YAA6B,EAC3C,OAAY;QAEnB,OAAO,MAAM,kBAAkB,CAAC,YAAY,EAAE,OAAO,CAAC,CAAA;IACxD,CAAC;IAID,KAAK,CAAC,kBAAkB,CACX,EAAU,EACP,KAAwB,EAC/B,OAAY;QAEnB,MAAM,YAAY,GAAG,MAAM,IAAA,uBAAa,EAAC,4BAAY,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,CAAA;QAElE,IAAI,KAAK,CAAC,QAAQ,IAAI,KAAK,CAAC,QAAQ,CAAC,EAAE,EAAE;YACvC,KAAK,CAAC,QAAQ,GAAG,MAAM,IAAA,uBAAa,EAAC,mBAAQ,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAA;SAC1E;QAED,OAAO,MAAM,IAAA,uBAAa,EAAC,4BAAY,CAAC,CAAC,IAAI,+CACxC,YAAY,GACZ,KAAK,KACR,OAAO,EAAE,OAAO,CAAC,KAAK,CAAC,IAAI,IAC3B,CAAA;IACJ,CAAC;IAID,KAAK,CAAC,0BAA0B,CACe,OAA4B,EAClE,OAAY;QAEnB,MAAM,EAAE,EAAE,EAAE,GAA0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/B,KAAK,CAAC,QAAQ,GAAG,MAAM,YAAY,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,EAAE,CAAC,CAAA;KAC9E;IAED,IAAI,MAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,QAAQ,0CAAE,EAAE,EAAE;QACvB,KAAK,CAAC,QAAQ,GAAG,MAAM,YAAY,CAAC,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAA;KAC/D;IAED,OAAO,MAAM,gBAAgB,CAAC,IAAI,+CAC7B,YAAY,GACZ,KAAK,KACR,OAAO,EAAE,IAAI,IACb,CAAA;AACJ,CAAC;AAzBD,gDAyBC;AAEM,KAAK,UAAU,kBAAkB,CAAC,EAAU,EAAE,EAAkB;IACrE,MAAM,gBAAgB,GAA6B,CAAA,EAAE,aAAF,EAAE,uBAAF,EAAE,CAAE,aAAa,CAAC,4BAAY,CAAC,KAAI,IAAA,uBAAa,EAAC,4BAAY,CAAC,CAAA;IACjH,MAAM,gBAAgB,CAAC,MAAM,CAAC,EAAE,CAAC,CAAA;AACnC,CAAC;AAHD,gDAGC"}
|
|
1
|
+
{"version":3,"file":"contact-point-mutation.js","sourceRoot":"","sources":["../../../server/service/contact-point/contact-point-mutation.ts"],"names":[],"mappings":";;;;AAAA,+CAAsE;AAGtE,iDAAqD;AAErD,mDAA+C;AAC/C,mDAA8C;AAC9C,+DAA0E;AAG1E,IAAa,oBAAoB,GAAjC,MAAa,oBAAoB;IAG/B,KAAK,CAAC,kBAAkB,CACD,YAA6B,EAC3C,OAAwB;QAE/B,OAAO,MAAM,kBAAkB,CAAC,YAAmB,EAAE,OAAO,CAAC,CAAA;IAC/D,CAAC;IAID,KAAK,CAAC,kBAAkB,CACX,EAAU,EACP,KAAwB,EAC/B,OAAwB;QAE/B,MAAM,YAAY,GAAG,MAAM,IAAA,qBAAa,EAAC,4BAAY,CAAC,CAAC,SAAS,CAA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jH,MAAM,gBAAgB,CAAC,MAAM,CAAC,EAAE,CAAC,CAAA;AACnC,CAAC;AAHD,gDAGC","sourcesContent":["import { Arg, Ctx, Directive, Mutation, Resolver } from 'type-graphql'\nimport { EntityManager, Repository } from 'typeorm'\n\nimport { getRepository } from '@things-factory/shell'\n\nimport { Bizplace } from '../bizplace/bizplace'\nimport { ContactPoint } from './contact-point'\nimport { ContactPointPatch, NewContactPoint } from './contact-point-types'\n\n@Resolver(ContactPoint)\nexport class ContactPointMutation {\n @Directive('@privilege(category: \"contact_point\", privilege: \"mutation\")')\n @Mutation(returns => ContactPoint)\n async createContactPoint(\n @Arg('contactPoint') contactPoint: NewContactPoint,\n @Ctx() context: ResolverContext\n ): Promise<ContactPoint> {\n return await createContactPoint(contactPoint as any, context)\n }\n\n @Directive('@privilege(category: \"contact_point\", privilege: \"mutation\")')\n @Mutation(returns => ContactPoint)\n async updateContactPoint(\n @Arg('id') id: string,\n @Arg('patch') patch: ContactPointPatch,\n @Ctx() context: ResolverContext\n ): Promise<ContactPoint> {\n const contactPoint = await getRepository(ContactPoint).findOneBy({ id })\n\n if (patch.bizplace && patch.bizplace.id) {\n patch.bizplace = await getRepository(Bizplace).findOneBy({ id: patch.bizplace.id })\n }\n\n return await getRepository(ContactPoint).save({\n ...contactPoint,\n ...patch,\n updater: context.state.user\n })\n }\n\n @Directive('@privilege(category: \"contact_point\", privilege: \"mutation\")')\n @Mutation(returns => [ContactPoint])\n async updateMultipleContactPoint(\n @Arg('patches', type => [ContactPointPatch]) patches: ContactPointPatch[],\n @Ctx() context: ResolverContext\n ): Promise<ContactPoint[]> {\n const { tx } = context.state\n let results = []\n const { createRecords, updateRecords, deleteRecords } = patches.reduce(\n (records, patch) => {\n if (patch.cuFlag.toUpperCase() === '+') {\n records.createRecords.push(patch)\n } else if (patch.cuFlag.toUpperCase() === 'M') {\n records.updateRecords.push(patch)\n } else {\n records.deleteRecords.push(patch)\n }\n return records\n },\n {\n createRecords: [],\n updateRecords: [],\n deleteRecords: []\n }\n )\n\n if (createRecords.length > 0) {\n for (let i = 0; i < createRecords.length; i++) {\n const result = await createContactPoint(createRecords[i], context, tx)\n results.push(result)\n }\n }\n\n if (updateRecords.length > 0) {\n for (let i = 0; i < updateRecords.length; i++) {\n const result = await updateContactPoint(updateRecords[i].id, updateRecords[i], context, tx)\n results.push(result)\n }\n }\n\n if (deleteRecords.length > 0) {\n for (let i = 0; i < deleteRecords.length; i++) {\n await deleteContactPoint(deleteRecords[i].id, tx)\n results.push(deleteRecords[i])\n }\n }\n\n return results\n }\n\n @Directive('@privilege(category: \"contact_point\", privilege: \"mutation\")')\n @Mutation(returns => Boolean)\n async deleteContactPoint(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<Boolean> {\n await deleteContactPoint(id, context.state.tx)\n\n return true\n }\n\n @Directive('@privilege(category: \"contact_point\", privilege: \"mutation\")')\n @Mutation(returns => Boolean)\n async deleteContactPoints(\n @Arg('ids', type => [String]) ids: string[],\n @Ctx() context: ResolverContext\n ): Promise<Boolean> {\n await getRepository(ContactPoint).delete(ids)\n\n return true\n }\n}\n\nexport async function createContactPoint(\n contactPoint: Partial<ContactPoint>,\n context: any,\n tx?: EntityManager\n): Promise<ContactPoint> {\n const { domain, user } = context.state\n\n const bizplaceRepo: Repository<Bizplace> = tx?.getRepository(Bizplace) || getRepository(Bizplace)\n const contactPointRepo: Repository<ContactPoint> = tx?.getRepository(ContactPoint) || getRepository(ContactPoint)\n\n if (!contactPoint.bizplace?.id) {\n contactPoint.bizplace = await bizplaceRepo.findOne({ where: { name: domain.name } })\n } else {\n contactPoint.bizplace = await bizplaceRepo.findOneBy({ id: contactPoint.bizplace.id })\n }\n\n return await contactPointRepo.save({\n ...contactPoint,\n domain,\n creator: user,\n updater: user\n })\n}\n\nexport async function updateContactPoint(\n id: string,\n patch: Partial<ContactPoint>,\n context: any,\n tx?: EntityManager\n): Promise<ContactPoint> {\n const bizplaceRepo: Repository<Bizplace> = tx?.getRepository(Bizplace) || getRepository(Bizplace)\n const contactPointRepo: Repository<ContactPoint> = tx?.getRepository(ContactPoint) || getRepository(ContactPoint)\n\n const { domain, user } = context.state\n let contactPoint: ContactPoint = await contactPointRepo.findOne({ where: { id }, relations: ['bizplace'] })\n\n if (!contactPoint?.bizplace?.id) {\n patch.bizplace = await bizplaceRepo.findOne({ where: { name: domain.name } })\n }\n\n if (patch?.bizplace?.id) {\n patch.bizplace = await bizplaceRepo.findOneBy({ id: patch.bizplace.id })\n }\n\n return await contactPointRepo.save({\n ...contactPoint,\n ...patch,\n updater: user\n })\n}\n\nexport async function deleteContactPoint(id: string, tx?: EntityManager): Promise<void> {\n const contactPointRepo: Repository<ContactPoint> = tx?.getRepository(ContactPoint) || getRepository(ContactPoint)\n await contactPointRepo.delete(id)\n}\n"]}
|