@things-factory/biz-base 4.3.671 → 4.3.672
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 +20 -0
- package/dist-server/index.js.map +1 -0
- package/dist-server/middlewares/index.js +1 -0
- package/dist-server/middlewares/index.js.map +1 -0
- package/dist-server/migrations/index.js +12 -0
- package/dist-server/migrations/index.js.map +1 -0
- package/dist-server/service/biz-option/biz-option-mutation.js +80 -0
- package/dist-server/service/biz-option/biz-option-mutation.js.map +1 -0
- package/dist-server/service/biz-option/biz-option-query.js +55 -0
- package/dist-server/service/biz-option/biz-option-query.js.map +1 -0
- package/dist-server/service/biz-option/biz-option-types.js +75 -0
- package/dist-server/service/biz-option/biz-option-types.js.map +1 -0
- package/dist-server/service/biz-option/biz-option.js +86 -0
- package/dist-server/service/biz-option/biz-option.js.map +1 -0
- package/dist-server/service/biz-option/index.js +9 -0
- package/dist-server/service/biz-option/index.js.map +1 -0
- package/dist-server/service/biz-option-detail/biz-option-detail-mutation.js +80 -0
- package/dist-server/service/biz-option-detail/biz-option-detail-mutation.js.map +1 -0
- package/dist-server/service/biz-option-detail/biz-option-detail-query.js +54 -0
- package/dist-server/service/biz-option-detail/biz-option-detail-query.js.map +1 -0
- package/dist-server/service/biz-option-detail/biz-option-detail-types.js +67 -0
- package/dist-server/service/biz-option-detail/biz-option-detail-types.js.map +1 -0
- package/dist-server/service/biz-option-detail/biz-option-detail.js +82 -0
- package/dist-server/service/biz-option-detail/biz-option-detail.js.map +1 -0
- package/dist-server/service/biz-option-detail/index.js +9 -0
- package/dist-server/service/biz-option-detail/index.js.map +1 -0
- package/dist-server/service/bizplace/bizplace-mutation.js +144 -0
- package/dist-server/service/bizplace/bizplace-mutation.js.map +1 -0
- package/dist-server/service/bizplace/bizplace-query.js +284 -0
- package/dist-server/service/bizplace/bizplace-query.js.map +1 -0
- package/dist-server/service/bizplace/bizplace-types.js +189 -0
- package/dist-server/service/bizplace/bizplace-types.js.map +1 -0
- package/dist-server/service/bizplace/bizplace.js +194 -0
- package/dist-server/service/bizplace/bizplace.js.map +1 -0
- package/dist-server/service/bizplace/index.js +9 -0
- package/dist-server/service/bizplace/index.js.map +1 -0
- package/dist-server/service/company/company-mutation.js +141 -0
- package/dist-server/service/company/company-mutation.js.map +1 -0
- package/dist-server/service/company/company-query.js +102 -0
- package/dist-server/service/company/company-query.js.map +1 -0
- package/dist-server/service/company/company-types.js +109 -0
- package/dist-server/service/company/company-types.js.map +1 -0
- package/dist-server/service/company/company.js +135 -0
- package/dist-server/service/company/company.js.map +1 -0
- package/dist-server/service/company/index.js +9 -0
- package/dist-server/service/company/index.js.map +1 -0
- package/dist-server/service/contact-point/contact-point-mutation.js +164 -0
- package/dist-server/service/contact-point/contact-point-mutation.js.map +1 -0
- package/dist-server/service/contact-point/contact-point-query.js +63 -0
- package/dist-server/service/contact-point/contact-point-query.js.map +1 -0
- package/dist-server/service/contact-point/contact-point-types.js +171 -0
- package/dist-server/service/contact-point/contact-point-types.js.map +1 -0
- package/dist-server/service/contact-point/contact-point.js +139 -0
- package/dist-server/service/contact-point/contact-point.js.map +1 -0
- package/dist-server/service/contact-point/index.js +9 -0
- package/dist-server/service/contact-point/index.js.map +1 -0
- package/dist-server/service/index.js +67 -0
- package/dist-server/service/index.js.map +1 -0
- package/dist-server/service/worker/index.js +9 -0
- package/dist-server/service/worker/index.js.map +1 -0
- package/dist-server/service/worker/worker-mutation.js +134 -0
- package/dist-server/service/worker/worker-mutation.js.map +1 -0
- package/dist-server/service/worker/worker-query.js +63 -0
- package/dist-server/service/worker/worker-query.js.map +1 -0
- package/dist-server/service/worker/worker-types.js +83 -0
- package/dist-server/service/worker/worker-types.js.map +1 -0
- package/dist-server/service/worker/worker.js +83 -0
- package/dist-server/service/worker/worker.js.map +1 -0
- package/dist-server/utils/get-permitted-bizplaces.js +285 -0
- package/dist-server/utils/get-permitted-bizplaces.js.map +1 -0
- package/dist-server/utils/index.js +18 -0
- package/dist-server/utils/index.js.map +1 -0
- package/package.json +3 -3
|
@@ -0,0 +1,102 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.CompanyQuery = void 0;
|
|
17
|
+
const type_graphql_1 = require("type-graphql");
|
|
18
|
+
const typeorm_1 = require("typeorm");
|
|
19
|
+
const auth_base_1 = require("@things-factory/auth-base");
|
|
20
|
+
const shell_1 = require("@things-factory/shell");
|
|
21
|
+
const bizplace_1 = require("../bizplace/bizplace");
|
|
22
|
+
const bizplace_types_1 = require("../bizplace/bizplace-types");
|
|
23
|
+
const company_1 = require("./company");
|
|
24
|
+
const company_types_1 = require("./company-types");
|
|
25
|
+
const debug = require('debug')('things-factory:biz-base:company-resolver');
|
|
26
|
+
let CompanyQuery = class CompanyQuery {
|
|
27
|
+
async company(context) {
|
|
28
|
+
const { domain } = context.state;
|
|
29
|
+
debug('company', domain === null || domain === void 0 ? void 0 : domain.subdomain);
|
|
30
|
+
const foundCompany = await (0, typeorm_1.getRepository)(company_1.Company).findOne({
|
|
31
|
+
domain
|
|
32
|
+
});
|
|
33
|
+
if (!foundCompany)
|
|
34
|
+
throw new Error(context.t('error.no x found', { x: context.t('field.company') }));
|
|
35
|
+
return foundCompany;
|
|
36
|
+
}
|
|
37
|
+
async companies(params, context) {
|
|
38
|
+
const convertedParams = (0, shell_1.convertListParams)(params, context.state.domain.id);
|
|
39
|
+
const [items, total] = await (0, typeorm_1.getRepository)(company_1.Company).findAndCount(Object.assign(Object.assign({}, convertedParams), { relations: ['domain', 'creator', 'updater'] }));
|
|
40
|
+
return { items, total };
|
|
41
|
+
}
|
|
42
|
+
async companyBizplaces(context) {
|
|
43
|
+
const { domain, user } = context.state;
|
|
44
|
+
debug('companyBizplaces', domain === null || domain === void 0 ? void 0 : domain.subdomain);
|
|
45
|
+
const userDomains = await (0, auth_base_1.getUserDomains)(user);
|
|
46
|
+
const company = await (0, typeorm_1.getRepository)(company_1.Company).findOne({
|
|
47
|
+
domain
|
|
48
|
+
});
|
|
49
|
+
const [items, total] = await (0, typeorm_1.getRepository)(bizplace_1.Bizplace).findAndCount({
|
|
50
|
+
where: { company, domain: (0, typeorm_1.In)(userDomains.map(({ id }) => id)) },
|
|
51
|
+
relations: ['domain']
|
|
52
|
+
});
|
|
53
|
+
return { items, total };
|
|
54
|
+
}
|
|
55
|
+
async companyUsers(context) {
|
|
56
|
+
const { domain } = context.state;
|
|
57
|
+
debug('companyUsers', domain === null || domain === void 0 ? void 0 : domain.subdomain);
|
|
58
|
+
const items = await (0, auth_base_1.getDomainUsers)(domain);
|
|
59
|
+
return {
|
|
60
|
+
items,
|
|
61
|
+
total: items.length
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
__decorate([
|
|
66
|
+
(0, type_graphql_1.Directive)('@privilege(category: "company", privilege: "query", domainOwnerGranted: true)'),
|
|
67
|
+
(0, type_graphql_1.Query)(returns => company_1.Company),
|
|
68
|
+
__param(0, (0, type_graphql_1.Ctx)()),
|
|
69
|
+
__metadata("design:type", Function),
|
|
70
|
+
__metadata("design:paramtypes", [Object]),
|
|
71
|
+
__metadata("design:returntype", Promise)
|
|
72
|
+
], CompanyQuery.prototype, "company", null);
|
|
73
|
+
__decorate([
|
|
74
|
+
(0, type_graphql_1.Directive)('@privilege(category: "company", privilege: "query")'),
|
|
75
|
+
(0, type_graphql_1.Query)(returns => company_types_1.CompanyList),
|
|
76
|
+
__param(0, (0, type_graphql_1.Args)()),
|
|
77
|
+
__param(1, (0, type_graphql_1.Ctx)()),
|
|
78
|
+
__metadata("design:type", Function),
|
|
79
|
+
__metadata("design:paramtypes", [typeof (_a = typeof shell_1.ListParam !== "undefined" && shell_1.ListParam) === "function" ? _a : Object, Object]),
|
|
80
|
+
__metadata("design:returntype", Promise)
|
|
81
|
+
], CompanyQuery.prototype, "companies", null);
|
|
82
|
+
__decorate([
|
|
83
|
+
(0, type_graphql_1.Directive)('@privilege(category: "company", privilege: "query", domainOwnerGranted: true)'),
|
|
84
|
+
(0, type_graphql_1.Query)(returns => bizplace_types_1.BizplaceList),
|
|
85
|
+
__param(0, (0, type_graphql_1.Ctx)()),
|
|
86
|
+
__metadata("design:type", Function),
|
|
87
|
+
__metadata("design:paramtypes", [Object]),
|
|
88
|
+
__metadata("design:returntype", Promise)
|
|
89
|
+
], CompanyQuery.prototype, "companyBizplaces", null);
|
|
90
|
+
__decorate([
|
|
91
|
+
(0, type_graphql_1.Directive)('@privilege(category: "company", privilege: "query", domainOwnerGranted: true)'),
|
|
92
|
+
(0, type_graphql_1.Query)(returns => auth_base_1.UserList),
|
|
93
|
+
__param(0, (0, type_graphql_1.Ctx)()),
|
|
94
|
+
__metadata("design:type", Function),
|
|
95
|
+
__metadata("design:paramtypes", [Object]),
|
|
96
|
+
__metadata("design:returntype", Promise)
|
|
97
|
+
], CompanyQuery.prototype, "companyUsers", null);
|
|
98
|
+
CompanyQuery = __decorate([
|
|
99
|
+
(0, type_graphql_1.Resolver)(company_1.Company)
|
|
100
|
+
], CompanyQuery);
|
|
101
|
+
exports.CompanyQuery = CompanyQuery;
|
|
102
|
+
//# sourceMappingURL=company-query.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"company-query.js","sourceRoot":"","sources":["../../../server/service/company/company-query.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+CAAoE;AACpE,qCAA2C;AAE3C,yDAA0F;AAC1F,iDAA4E;AAE5E,mDAA+C;AAC/C,+DAAyD;AACzD,uCAAmC;AACnC,mDAA6C;AAE7C,MAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,0CAA0C,CAAC,CAAA;AAGnE,IAAM,YAAY,GAAlB,MAAM,YAAY;IAGjB,AAAN,KAAK,CAAC,OAAO,CAAQ,OAAY;QAC/B,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAChC,KAAK,CAAC,SAAS,EAAE,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,SAAS,CAAC,CAAA;QAEnC,MAAM,YAAY,GAAmB,MAAM,IAAA,uBAAa,EAAC,iBAAO,CAAC,CAAC,OAAO,CAAC;YACxE,MAAM;SACP,CAAC,CAAA;QAEF,IAAI,CAAC,YAAY;YAAE,MAAM,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,kBAAkB,EAAE,EAAE,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,eAAe,CAAC,EAAE,CAAC,CAAC,CAAA;QACpG,OAAO,YAAY,CAAA;IACrB,CAAC;IAIK,AAAN,KAAK,CAAC,SAAS,CAAS,MAAiB,EAAS,OAAY;QAC5D,MAAM,eAAe,GAAG,IAAA,yBAAiB,EAAC,MAAM,EAAE,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC,CAAA;QAE1E,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,GAAG,MAAM,IAAA,uBAAa,EAAC,iBAAO,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AAC,MAAM;SACpB,CAAA;IACH,CAAC;CACF,CAAA;AAxDO;IAFL,IAAA,wBAAS,EAAC,+EAA+E,CAAC;IAC1F,IAAA,oBAAK,EAAC,OAAO,CAAC,EAAE,CAAC,iBAAO,CAAC;IACX,WAAA,IAAA,kBAAG,GAAE,CAAA;;;;2CAUnB;AAIK;IAFL,IAAA,wBAAS,EAAC,qDAAqD,CAAC;IAChE,IAAA,oBAAK,EAAC,OAAO,CAAC,EAAE,CAAC,2BAAW,CAAC;IACb,WAAA,IAAA,mBAAI,GAAE,CAAA;IAAqB,WAAA,IAAA,kBAAG,GAAE,CAAA;;yDAAjB,iBAAS,oBAAT,iBAAS;;6CAQxC;AAIK;IAFL,IAAA,wBAAS,EAAC,+EAA+E,CAAC;IAC1F,IAAA,oBAAK,EAAC,OAAO,CAAC,EAAE,CAAC,6BAAY,CAAC;IACP,WAAA,IAAA,kBAAG,GAAE,CAAA;;;;oDAe5B;AAIK;IAFL,IAAA,wBAAS,EAAC,+EAA+E,CAAC;IAC1F,IAAA,oBAAK,EAAC,OAAO,CAAC,EAAE,CAAC,oBAAQ,CAAC;IACP,WAAA,IAAA,kBAAG,GAAE,CAAA;;;;gDAUxB;AA1DU,YAAY;IADxB,IAAA,uBAAQ,EAAC,iBAAO,CAAC;GACL,YAAY,CA2DxB;AA3DY,oCAAY"}
|
|
@@ -0,0 +1,109 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.NewCompany = exports.CompanyPatch = exports.CompanyList = void 0;
|
|
13
|
+
const type_graphql_1 = require("type-graphql");
|
|
14
|
+
const company_1 = require("./company");
|
|
15
|
+
let CompanyList = class CompanyList {
|
|
16
|
+
};
|
|
17
|
+
__decorate([
|
|
18
|
+
(0, type_graphql_1.Field)(type => [company_1.Company], { nullable: true }),
|
|
19
|
+
__metadata("design:type", Array)
|
|
20
|
+
], CompanyList.prototype, "items", void 0);
|
|
21
|
+
__decorate([
|
|
22
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.Int, { nullable: true }),
|
|
23
|
+
__metadata("design:type", Number)
|
|
24
|
+
], CompanyList.prototype, "total", void 0);
|
|
25
|
+
CompanyList = __decorate([
|
|
26
|
+
(0, type_graphql_1.ObjectType)()
|
|
27
|
+
], CompanyList);
|
|
28
|
+
exports.CompanyList = CompanyList;
|
|
29
|
+
let CompanyPatch = class CompanyPatch {
|
|
30
|
+
};
|
|
31
|
+
__decorate([
|
|
32
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
|
33
|
+
__metadata("design:type", String)
|
|
34
|
+
], CompanyPatch.prototype, "id", void 0);
|
|
35
|
+
__decorate([
|
|
36
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
|
37
|
+
__metadata("design:type", String)
|
|
38
|
+
], CompanyPatch.prototype, "name", void 0);
|
|
39
|
+
__decorate([
|
|
40
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
|
41
|
+
__metadata("design:type", String)
|
|
42
|
+
], CompanyPatch.prototype, "description", void 0);
|
|
43
|
+
__decorate([
|
|
44
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
|
45
|
+
__metadata("design:type", String)
|
|
46
|
+
], CompanyPatch.prototype, "countryCode", void 0);
|
|
47
|
+
__decorate([
|
|
48
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
|
49
|
+
__metadata("design:type", String)
|
|
50
|
+
], CompanyPatch.prototype, "brn", void 0);
|
|
51
|
+
__decorate([
|
|
52
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
|
53
|
+
__metadata("design:type", String)
|
|
54
|
+
], CompanyPatch.prototype, "address", void 0);
|
|
55
|
+
__decorate([
|
|
56
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
|
57
|
+
__metadata("design:type", String)
|
|
58
|
+
], CompanyPatch.prototype, "postalCode", void 0);
|
|
59
|
+
__decorate([
|
|
60
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
|
61
|
+
__metadata("design:type", String)
|
|
62
|
+
], CompanyPatch.prototype, "status", void 0);
|
|
63
|
+
__decorate([
|
|
64
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
|
65
|
+
__metadata("design:type", String)
|
|
66
|
+
], CompanyPatch.prototype, "cuFlag", void 0);
|
|
67
|
+
CompanyPatch = __decorate([
|
|
68
|
+
(0, type_graphql_1.InputType)()
|
|
69
|
+
], CompanyPatch);
|
|
70
|
+
exports.CompanyPatch = CompanyPatch;
|
|
71
|
+
let NewCompany = class NewCompany {
|
|
72
|
+
};
|
|
73
|
+
__decorate([
|
|
74
|
+
(0, type_graphql_1.Field)(),
|
|
75
|
+
__metadata("design:type", String)
|
|
76
|
+
], NewCompany.prototype, "name", void 0);
|
|
77
|
+
__decorate([
|
|
78
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
|
79
|
+
__metadata("design:type", String)
|
|
80
|
+
], NewCompany.prototype, "description", void 0);
|
|
81
|
+
__decorate([
|
|
82
|
+
(0, type_graphql_1.Field)(),
|
|
83
|
+
__metadata("design:type", String)
|
|
84
|
+
], NewCompany.prototype, "countryCode", void 0);
|
|
85
|
+
__decorate([
|
|
86
|
+
(0, type_graphql_1.Field)(),
|
|
87
|
+
__metadata("design:type", String)
|
|
88
|
+
], NewCompany.prototype, "brn", void 0);
|
|
89
|
+
__decorate([
|
|
90
|
+
(0, type_graphql_1.Field)(),
|
|
91
|
+
__metadata("design:type", String)
|
|
92
|
+
], NewCompany.prototype, "address", void 0);
|
|
93
|
+
__decorate([
|
|
94
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
|
95
|
+
__metadata("design:type", String)
|
|
96
|
+
], NewCompany.prototype, "postalCode", void 0);
|
|
97
|
+
__decorate([
|
|
98
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
|
99
|
+
__metadata("design:type", String)
|
|
100
|
+
], NewCompany.prototype, "type", void 0);
|
|
101
|
+
__decorate([
|
|
102
|
+
(0, type_graphql_1.Field)(),
|
|
103
|
+
__metadata("design:type", String)
|
|
104
|
+
], NewCompany.prototype, "status", void 0);
|
|
105
|
+
NewCompany = __decorate([
|
|
106
|
+
(0, type_graphql_1.InputType)()
|
|
107
|
+
], NewCompany);
|
|
108
|
+
exports.NewCompany = NewCompany;
|
|
109
|
+
//# sourceMappingURL=company-types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"company-types.js","sourceRoot":"","sources":["../../../server/service/company/company-types.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+CAAgE;AAChE,uCAAmC;AAG5B,IAAM,WAAW,GAAjB,MAAM,WAAW;CAMvB,CAAA;AALC;IAAC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,CAAC,iBAAO,CAAC,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;0CAC5B;AAEjB;IAAC,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;AASjB,IAAM,YAAY,GAAlB,MAAM,YAAY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AAA,oBAAK,GAAE;;0CACM;AAvBH,UAAU;IADtB,IAAA,wBAAS,GAAE;GACC,UAAU,CAwBtB;AAxBY,gCAAU"}
|
|
@@ -0,0 +1,135 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
exports.Company = void 0;
|
|
14
|
+
const type_graphql_1 = require("type-graphql");
|
|
15
|
+
const typeorm_1 = require("typeorm");
|
|
16
|
+
const auth_base_1 = require("@things-factory/auth-base");
|
|
17
|
+
const shell_1 = require("@things-factory/shell");
|
|
18
|
+
const bizplace_1 = require("../bizplace/bizplace");
|
|
19
|
+
let Company = class Company {
|
|
20
|
+
};
|
|
21
|
+
__decorate([
|
|
22
|
+
(0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
|
|
23
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.ID),
|
|
24
|
+
__metadata("design:type", String)
|
|
25
|
+
], Company.prototype, "id", void 0);
|
|
26
|
+
__decorate([
|
|
27
|
+
(0, typeorm_1.ManyToOne)(type => shell_1.Domain),
|
|
28
|
+
(0, type_graphql_1.Field)(type => shell_1.Domain),
|
|
29
|
+
__metadata("design:type", typeof (_a = typeof shell_1.Domain !== "undefined" && shell_1.Domain) === "function" ? _a : Object)
|
|
30
|
+
], Company.prototype, "domain", void 0);
|
|
31
|
+
__decorate([
|
|
32
|
+
(0, typeorm_1.RelationId)((company) => company.domain),
|
|
33
|
+
(0, type_graphql_1.Field)(),
|
|
34
|
+
__metadata("design:type", String)
|
|
35
|
+
], Company.prototype, "domainId", void 0);
|
|
36
|
+
__decorate([
|
|
37
|
+
(0, typeorm_1.Column)(),
|
|
38
|
+
(0, type_graphql_1.Field)(),
|
|
39
|
+
__metadata("design:type", String)
|
|
40
|
+
], Company.prototype, "name", void 0);
|
|
41
|
+
__decorate([
|
|
42
|
+
(0, typeorm_1.Column)({
|
|
43
|
+
nullable: true
|
|
44
|
+
}),
|
|
45
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
|
46
|
+
__metadata("design:type", String)
|
|
47
|
+
], Company.prototype, "description", void 0);
|
|
48
|
+
__decorate([
|
|
49
|
+
(0, typeorm_1.Column)(),
|
|
50
|
+
(0, type_graphql_1.Field)(),
|
|
51
|
+
__metadata("design:type", String)
|
|
52
|
+
], Company.prototype, "countryCode", void 0);
|
|
53
|
+
__decorate([
|
|
54
|
+
(0, typeorm_1.Column)(),
|
|
55
|
+
(0, type_graphql_1.Field)(),
|
|
56
|
+
__metadata("design:type", String)
|
|
57
|
+
], Company.prototype, "brn", void 0);
|
|
58
|
+
__decorate([
|
|
59
|
+
(0, typeorm_1.Column)(),
|
|
60
|
+
(0, type_graphql_1.Field)(),
|
|
61
|
+
__metadata("design:type", String)
|
|
62
|
+
], Company.prototype, "address", void 0);
|
|
63
|
+
__decorate([
|
|
64
|
+
(0, typeorm_1.Column)({
|
|
65
|
+
nullable: true
|
|
66
|
+
}),
|
|
67
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
|
68
|
+
__metadata("design:type", String)
|
|
69
|
+
], Company.prototype, "postalCode", void 0);
|
|
70
|
+
__decorate([
|
|
71
|
+
(0, typeorm_1.Column)({
|
|
72
|
+
nullable: true
|
|
73
|
+
}),
|
|
74
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
|
75
|
+
__metadata("design:type", String)
|
|
76
|
+
], Company.prototype, "type", void 0);
|
|
77
|
+
__decorate([
|
|
78
|
+
(0, typeorm_1.Column)({
|
|
79
|
+
nullable: true
|
|
80
|
+
}),
|
|
81
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
|
82
|
+
__metadata("design:type", String)
|
|
83
|
+
], Company.prototype, "status", void 0);
|
|
84
|
+
__decorate([
|
|
85
|
+
(0, typeorm_1.Column)({
|
|
86
|
+
nullable: true
|
|
87
|
+
}),
|
|
88
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
|
89
|
+
__metadata("design:type", String)
|
|
90
|
+
], Company.prototype, "refCompanyId", void 0);
|
|
91
|
+
__decorate([
|
|
92
|
+
(0, typeorm_1.OneToMany)(type => bizplace_1.Bizplace, bizplace => bizplace.company),
|
|
93
|
+
(0, type_graphql_1.Field)(type => [bizplace_1.Bizplace]),
|
|
94
|
+
__metadata("design:type", Array)
|
|
95
|
+
], Company.prototype, "bizplaces", void 0);
|
|
96
|
+
__decorate([
|
|
97
|
+
(0, typeorm_1.ManyToOne)(type => auth_base_1.User, {
|
|
98
|
+
nullable: true
|
|
99
|
+
}),
|
|
100
|
+
(0, type_graphql_1.Field)(type => auth_base_1.User, { nullable: true }),
|
|
101
|
+
__metadata("design:type", typeof (_b = typeof auth_base_1.User !== "undefined" && auth_base_1.User) === "function" ? _b : Object)
|
|
102
|
+
], Company.prototype, "creator", void 0);
|
|
103
|
+
__decorate([
|
|
104
|
+
(0, typeorm_1.RelationId)((company) => company.creator),
|
|
105
|
+
__metadata("design:type", String)
|
|
106
|
+
], Company.prototype, "creatorId", void 0);
|
|
107
|
+
__decorate([
|
|
108
|
+
(0, typeorm_1.ManyToOne)(type => auth_base_1.User, {
|
|
109
|
+
nullable: true
|
|
110
|
+
}),
|
|
111
|
+
(0, type_graphql_1.Field)(type => auth_base_1.User, { nullable: true }),
|
|
112
|
+
__metadata("design:type", typeof (_c = typeof auth_base_1.User !== "undefined" && auth_base_1.User) === "function" ? _c : Object)
|
|
113
|
+
], Company.prototype, "updater", void 0);
|
|
114
|
+
__decorate([
|
|
115
|
+
(0, typeorm_1.RelationId)((company) => company.updater),
|
|
116
|
+
__metadata("design:type", String)
|
|
117
|
+
], Company.prototype, "updaterId", void 0);
|
|
118
|
+
__decorate([
|
|
119
|
+
(0, typeorm_1.CreateDateColumn)(),
|
|
120
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
|
121
|
+
__metadata("design:type", Date)
|
|
122
|
+
], Company.prototype, "createdAt", void 0);
|
|
123
|
+
__decorate([
|
|
124
|
+
(0, typeorm_1.UpdateDateColumn)(),
|
|
125
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
|
126
|
+
__metadata("design:type", Date)
|
|
127
|
+
], Company.prototype, "updatedAt", void 0);
|
|
128
|
+
Company = __decorate([
|
|
129
|
+
(0, typeorm_1.Entity)(),
|
|
130
|
+
(0, typeorm_1.Index)('ix_companies_0', (company) => [company.name], { unique: true }),
|
|
131
|
+
(0, typeorm_1.Index)('ix_companies_1', (company) => [company.domain], { unique: false }),
|
|
132
|
+
(0, type_graphql_1.ObjectType)()
|
|
133
|
+
], Company);
|
|
134
|
+
exports.Company = Company;
|
|
135
|
+
//# sourceMappingURL=company.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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;AAMxC,IAAM,OAAO,GAAb,MAAM,OAAO;CAwFnB,CAAA;AAvFC;IAAC,IAAA,gCAAsB,EAAC,MAAM,CAAC;IAC9B,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,iBA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AC,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,CAwFnB;AAxFY,0BAAO"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.resolvers = exports.entities = void 0;
|
|
4
|
+
const company_1 = require("./company");
|
|
5
|
+
const company_mutation_1 = require("./company-mutation");
|
|
6
|
+
const company_query_1 = require("./company-query");
|
|
7
|
+
exports.entities = [company_1.Company];
|
|
8
|
+
exports.resolvers = [company_query_1.CompanyQuery, company_mutation_1.CompanyMutation];
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +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"}
|
|
@@ -0,0 +1,164 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.deleteContactPoint = exports.updateContactPoint = exports.createContactPoint = exports.ContactPointMutation = void 0;
|
|
16
|
+
const type_graphql_1 = require("type-graphql");
|
|
17
|
+
const typeorm_1 = require("typeorm");
|
|
18
|
+
const bizplace_1 = require("../bizplace/bizplace");
|
|
19
|
+
const contact_point_1 = require("./contact-point");
|
|
20
|
+
const contact_point_types_1 = require("./contact-point-types");
|
|
21
|
+
let ContactPointMutation = class ContactPointMutation {
|
|
22
|
+
async createContactPoint(contactPoint, context) {
|
|
23
|
+
return await createContactPoint(contactPoint, context);
|
|
24
|
+
}
|
|
25
|
+
async updateContactPoint(id, patch, context) {
|
|
26
|
+
const contactPoint = await (0, typeorm_1.getRepository)(contact_point_1.ContactPoint).findOne(id);
|
|
27
|
+
if (patch.bizplace && patch.bizplace.id) {
|
|
28
|
+
patch.bizplace = await (0, typeorm_1.getRepository)(bizplace_1.Bizplace).findOne(patch.bizplace.id);
|
|
29
|
+
}
|
|
30
|
+
return await (0, typeorm_1.getRepository)(contact_point_1.ContactPoint).save(Object.assign(Object.assign(Object.assign({}, contactPoint), patch), { updater: context.state.user }));
|
|
31
|
+
}
|
|
32
|
+
async updateMultipleContactPoint(patches, context) {
|
|
33
|
+
const { tx } = context.state;
|
|
34
|
+
let results = [];
|
|
35
|
+
const { createRecords, updateRecords, deleteRecords } = patches.reduce((records, patch) => {
|
|
36
|
+
if (patch.cuFlag.toUpperCase() === '+') {
|
|
37
|
+
records.createRecords.push(patch);
|
|
38
|
+
}
|
|
39
|
+
else if (patch.cuFlag.toUpperCase() === 'M') {
|
|
40
|
+
records.updateRecords.push(patch);
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
records.deleteRecords.push(patch);
|
|
44
|
+
}
|
|
45
|
+
return records;
|
|
46
|
+
}, {
|
|
47
|
+
createRecords: [],
|
|
48
|
+
updateRecords: [],
|
|
49
|
+
deleteRecords: []
|
|
50
|
+
});
|
|
51
|
+
if (createRecords.length > 0) {
|
|
52
|
+
for (let i = 0; i < createRecords.length; i++) {
|
|
53
|
+
const result = await createContactPoint(createRecords[i], context, tx);
|
|
54
|
+
results.push(result);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
if (updateRecords.length > 0) {
|
|
58
|
+
for (let i = 0; i < updateRecords.length; i++) {
|
|
59
|
+
const result = await updateContactPoint(updateRecords[i].id, updateRecords[i], context, tx);
|
|
60
|
+
results.push(result);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
if (deleteRecords.length > 0) {
|
|
64
|
+
for (let i = 0; i < deleteRecords.length; i++) {
|
|
65
|
+
await deleteContactPoint(deleteRecords[i].id, tx);
|
|
66
|
+
results.push(deleteRecords[i]);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
return results;
|
|
70
|
+
}
|
|
71
|
+
async deleteContactPoint(id, context) {
|
|
72
|
+
await deleteContactPoint(id, context.state.tx);
|
|
73
|
+
return true;
|
|
74
|
+
}
|
|
75
|
+
async deleteContactPoints(ids, context) {
|
|
76
|
+
await (0, typeorm_1.getRepository)(contact_point_1.ContactPoint).delete(ids);
|
|
77
|
+
return true;
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
__decorate([
|
|
81
|
+
(0, type_graphql_1.Directive)('@privilege(category: "contact_point", privilege: "mutation")'),
|
|
82
|
+
(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)
|
|
88
|
+
], ContactPointMutation.prototype, "createContactPoint", null);
|
|
89
|
+
__decorate([
|
|
90
|
+
(0, type_graphql_1.Directive)('@privilege(category: "contact_point", privilege: "mutation")'),
|
|
91
|
+
(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)
|
|
98
|
+
], ContactPointMutation.prototype, "updateContactPoint", null);
|
|
99
|
+
__decorate([
|
|
100
|
+
(0, type_graphql_1.Directive)('@privilege(category: "contact_point", privilege: "mutation")'),
|
|
101
|
+
(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)
|
|
107
|
+
], ContactPointMutation.prototype, "updateMultipleContactPoint", null);
|
|
108
|
+
__decorate([
|
|
109
|
+
(0, type_graphql_1.Directive)('@privilege(category: "contact_point", privilege: "mutation")'),
|
|
110
|
+
(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)
|
|
116
|
+
], ContactPointMutation.prototype, "deleteContactPoint", null);
|
|
117
|
+
__decorate([
|
|
118
|
+
(0, type_graphql_1.Directive)('@privilege(category: "contact_point", privilege: "mutation")'),
|
|
119
|
+
(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)
|
|
125
|
+
], ContactPointMutation.prototype, "deleteContactPoints", null);
|
|
126
|
+
ContactPointMutation = __decorate([
|
|
127
|
+
(0, type_graphql_1.Resolver)(contact_point_1.ContactPoint)
|
|
128
|
+
], ContactPointMutation);
|
|
129
|
+
exports.ContactPointMutation = ContactPointMutation;
|
|
130
|
+
async function createContactPoint(contactPoint, context, tx) {
|
|
131
|
+
var _a;
|
|
132
|
+
const { domain, user } = context.state;
|
|
133
|
+
const bizplaceRepo = (tx === null || tx === void 0 ? void 0 : tx.getRepository(bizplace_1.Bizplace)) || (0, typeorm_1.getRepository)(bizplace_1.Bizplace);
|
|
134
|
+
const contactPointRepo = (tx === null || tx === void 0 ? void 0 : tx.getRepository(contact_point_1.ContactPoint)) || (0, typeorm_1.getRepository)(contact_point_1.ContactPoint);
|
|
135
|
+
if (!((_a = contactPoint.bizplace) === null || _a === void 0 ? void 0 : _a.id)) {
|
|
136
|
+
contactPoint.bizplace = await bizplaceRepo.findOne({ where: { name: domain.name } });
|
|
137
|
+
}
|
|
138
|
+
else {
|
|
139
|
+
contactPoint.bizplace = await bizplaceRepo.findOne(contactPoint.bizplace.id);
|
|
140
|
+
}
|
|
141
|
+
return await contactPointRepo.save(Object.assign(Object.assign({}, contactPoint), { domain, creator: user, updater: user }));
|
|
142
|
+
}
|
|
143
|
+
exports.createContactPoint = createContactPoint;
|
|
144
|
+
async function updateContactPoint(id, patch, context, tx) {
|
|
145
|
+
var _a, _b;
|
|
146
|
+
const bizplaceRepo = (tx === null || tx === void 0 ? void 0 : tx.getRepository(bizplace_1.Bizplace)) || (0, typeorm_1.getRepository)(bizplace_1.Bizplace);
|
|
147
|
+
const contactPointRepo = (tx === null || tx === void 0 ? void 0 : tx.getRepository(contact_point_1.ContactPoint)) || (0, typeorm_1.getRepository)(contact_point_1.ContactPoint);
|
|
148
|
+
const { domain, user } = context.state;
|
|
149
|
+
let contactPoint = await contactPointRepo.findOne({ where: { id }, relations: ['bizplace'] });
|
|
150
|
+
if (!((_a = contactPoint === null || contactPoint === void 0 ? void 0 : contactPoint.bizplace) === null || _a === void 0 ? void 0 : _a.id)) {
|
|
151
|
+
patch.bizplace = await bizplaceRepo.findOne({ where: { name: domain.name } });
|
|
152
|
+
}
|
|
153
|
+
if ((_b = patch === null || patch === void 0 ? void 0 : patch.bizplace) === null || _b === void 0 ? void 0 : _b.id) {
|
|
154
|
+
patch.bizplace = await bizplaceRepo.findOne(patch.bizplace.id);
|
|
155
|
+
}
|
|
156
|
+
return await contactPointRepo.save(Object.assign(Object.assign(Object.assign({}, contactPoint), patch), { updater: user }));
|
|
157
|
+
}
|
|
158
|
+
exports.updateContactPoint = updateContactPoint;
|
|
159
|
+
async function deleteContactPoint(id, tx) {
|
|
160
|
+
const contactPointRepo = (tx === null || tx === void 0 ? void 0 : tx.getRepository(contact_point_1.ContactPoint)) || (0, typeorm_1.getRepository)(contact_point_1.ContactPoint);
|
|
161
|
+
await contactPointRepo.delete(id);
|
|
162
|
+
}
|
|
163
|
+
exports.deleteContactPoint = deleteContactPoint;
|
|
164
|
+
//# sourceMappingURL=contact-point-mutation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contact-point-mutation.js","sourceRoot":"","sources":["../../../server/service/contact-point/contact-point-mutation.ts"],"names":[],"m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,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"}
|
|
@@ -0,0 +1,63 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.ContactPointQuery = void 0;
|
|
17
|
+
const type_graphql_1 = require("type-graphql");
|
|
18
|
+
const typeorm_1 = require("typeorm");
|
|
19
|
+
const shell_1 = require("@things-factory/shell");
|
|
20
|
+
const contact_point_1 = require("./contact-point");
|
|
21
|
+
const contact_point_types_1 = require("./contact-point-types");
|
|
22
|
+
let ContactPointQuery = class ContactPointQuery {
|
|
23
|
+
async contactPoint(name, context) {
|
|
24
|
+
return await (0, typeorm_1.getRepository)(contact_point_1.ContactPoint).findOne({
|
|
25
|
+
where: { domain: context.state.domain, name },
|
|
26
|
+
relations: ['domain', 'bizplace', 'creator', 'updater']
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
async contactPoints(params, context) {
|
|
30
|
+
const queryBuilder = (0, typeorm_1.getRepository)(contact_point_1.ContactPoint).createQueryBuilder();
|
|
31
|
+
(0, shell_1.buildQuery)(queryBuilder, params, context);
|
|
32
|
+
const [items, total] = await queryBuilder
|
|
33
|
+
.leftJoinAndSelect('ContactPoint.domain', 'Domain')
|
|
34
|
+
.leftJoinAndSelect('ContactPoint.bizplace', 'Bizplace')
|
|
35
|
+
.leftJoinAndSelect('ContactPoint.creator', 'Creator')
|
|
36
|
+
.leftJoinAndSelect('ContactPoint.updater', 'Updater')
|
|
37
|
+
.getManyAndCount();
|
|
38
|
+
return { items, total };
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
__decorate([
|
|
42
|
+
(0, type_graphql_1.Directive)('@privilege(category: "contact_point", privilege: "query")'),
|
|
43
|
+
(0, type_graphql_1.Query)(returns => contact_point_1.ContactPoint),
|
|
44
|
+
__param(0, (0, type_graphql_1.Arg)('name')),
|
|
45
|
+
__param(1, (0, type_graphql_1.Ctx)()),
|
|
46
|
+
__metadata("design:type", Function),
|
|
47
|
+
__metadata("design:paramtypes", [String, Object]),
|
|
48
|
+
__metadata("design:returntype", Promise)
|
|
49
|
+
], ContactPointQuery.prototype, "contactPoint", null);
|
|
50
|
+
__decorate([
|
|
51
|
+
(0, type_graphql_1.Directive)('@privilege(category: "contact_point", privilege: "query")'),
|
|
52
|
+
(0, type_graphql_1.Query)(returns => contact_point_types_1.ContactPointList),
|
|
53
|
+
__param(0, (0, type_graphql_1.Args)()),
|
|
54
|
+
__param(1, (0, type_graphql_1.Ctx)()),
|
|
55
|
+
__metadata("design:type", Function),
|
|
56
|
+
__metadata("design:paramtypes", [typeof (_a = typeof shell_1.ListParam !== "undefined" && shell_1.ListParam) === "function" ? _a : Object, Object]),
|
|
57
|
+
__metadata("design:returntype", Promise)
|
|
58
|
+
], ContactPointQuery.prototype, "contactPoints", null);
|
|
59
|
+
ContactPointQuery = __decorate([
|
|
60
|
+
(0, type_graphql_1.Resolver)(contact_point_1.ContactPoint)
|
|
61
|
+
], ContactPointQuery);
|
|
62
|
+
exports.ContactPointQuery = ContactPointQuery;
|
|
63
|
+
//# sourceMappingURL=contact-point-query.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contact-point-query.js","sourceRoot":"","sources":["../../../server/service/contact-point/contact-point-query.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+CAAyE;AACzE,qCAAuC;AAEvC,iDAA6D;AAE7D,mDAA8C;AAC9C,+DAAwD;AAGjD,IAAM,iBAAiB,GAAvB,MAAM,iBAAiB;IAGtB,AAAN,KAAK,CAAC,YAAY,CAAc,IAAY,EAAS,OAAY;QAC/D,OAAO,MAAM,IAAA,uBAAa,EAAC,4BAAY,CAAC,CAAC,OAAO,CAAC;YAC/C,KAAK,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,KAAK,CAAC,MAAM,EAAE,IAAI,EAAE;YAC7C,SAAS,EAAE,CAAC,QAAQ,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,CAAC;SACxD,CAAC,CAAA;IACJ,CAAC;IAIK,AAAN,KAAK,CAAC,aAAa,CAAS,MAAiB,EAAS,OAAY;QAChE,MAAM,YAAY,GAAG,IAAA,uBAAa,EAAC,4BAAY,CAAC,CAAC,kBAAkB,EAAE,CAAA;QACrE,IAAA,kBAAU,EAAC,YAAY,EAAE,MAAM,EAAE,O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