@dssp/supervision 0.0.9 → 0.0.10
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/client/pages/building-inspection/building-inspection-detail-checklist.ts +186 -0
- package/client/pages/building-inspection/building-inspection-detail-drawing.ts +160 -0
- package/client/pages/building-inspection/building-inspection-list.ts +430 -0
- package/client/pages/building-inspection/component/building-inspection-detail-header.ts +94 -0
- package/client/pages/building-inspection/inspection-create-popup.ts +696 -0
- package/client/pages/checklist/checklist-view.ts +443 -0
- package/client/pages/checklist-template/checklist-template-item.ts +240 -0
- package/client/pages/checklist-template/checklist-template-list.ts +271 -0
- package/client/pages/checklist-template/checklist-type-management.ts +242 -0
- package/client/route.ts +14 -18
- package/dist-client/pages/building-inspection/building-inspection-detail-checklist.d.ts +21 -0
- package/dist-client/pages/building-inspection/building-inspection-detail-checklist.js +187 -0
- package/dist-client/pages/building-inspection/building-inspection-detail-checklist.js.map +1 -0
- package/dist-client/pages/building-inspection/building-inspection-detail-drawing.d.ts +21 -0
- package/dist-client/pages/building-inspection/building-inspection-detail-drawing.js +169 -0
- package/dist-client/pages/building-inspection/building-inspection-detail-drawing.js.map +1 -0
- package/dist-client/pages/building-inspection/building-inspection-list.d.ts +67 -0
- package/dist-client/pages/building-inspection/building-inspection-list.js +434 -0
- package/dist-client/pages/building-inspection/building-inspection-list.js.map +1 -0
- package/dist-client/pages/building-inspection/component/building-inspection-detail-header.d.ts +1 -0
- package/dist-client/pages/building-inspection/component/building-inspection-detail-header.js +118 -0
- package/dist-client/pages/building-inspection/component/building-inspection-detail-header.js.map +1 -0
- package/dist-client/pages/building-inspection/inspection-create-popup.d.ts +3 -0
- package/dist-client/pages/building-inspection/inspection-create-popup.js +735 -0
- package/dist-client/pages/building-inspection/inspection-create-popup.js.map +1 -0
- package/dist-client/pages/checklist/checklist-view.d.ts +6 -0
- package/dist-client/pages/checklist/checklist-view.js +434 -0
- package/dist-client/pages/checklist/checklist-view.js.map +1 -0
- package/dist-client/pages/checklist-template/checklist-template-item.d.ts +2 -0
- package/dist-client/pages/checklist-template/checklist-template-item.js +237 -0
- package/dist-client/pages/checklist-template/checklist-template-item.js.map +1 -0
- package/dist-client/pages/{check-item/check-item-list-page.d.ts → checklist-template/checklist-template-list.d.ts} +8 -27
- package/dist-client/pages/checklist-template/checklist-template-list.js +259 -0
- package/dist-client/pages/checklist-template/checklist-template-list.js.map +1 -0
- package/dist-client/pages/checklist-template/checklist-type-management.d.ts +48 -0
- package/dist-client/pages/checklist-template/checklist-type-management.js +229 -0
- package/dist-client/pages/checklist-template/checklist-type-management.js.map +1 -0
- package/dist-client/route.d.ts +1 -1
- package/dist-client/route.js +10 -13
- package/dist-client/route.js.map +1 -1
- package/dist-client/tsconfig.tsbuildinfo +1 -1
- package/dist-server/index.d.ts +1 -1
- package/dist-server/index.js +1 -1
- package/dist-server/index.js.map +1 -1
- package/dist-server/service/building-inspection/building-inspection-history.d.ts +17 -0
- package/dist-server/service/building-inspection/building-inspection-history.js +85 -0
- package/dist-server/service/building-inspection/building-inspection-history.js.map +1 -0
- package/dist-server/service/building-inspection/building-inspection-mutation.d.ts +8 -0
- package/dist-server/service/building-inspection/building-inspection-mutation.js +148 -0
- package/dist-server/service/building-inspection/building-inspection-mutation.js.map +1 -0
- package/dist-server/service/building-inspection/building-inspection-query.d.ts +20 -0
- package/dist-server/service/building-inspection/building-inspection-query.js +235 -0
- package/dist-server/service/building-inspection/building-inspection-query.js.map +1 -0
- package/dist-server/service/building-inspection/building-inspection-type.d.ts +43 -0
- package/dist-server/service/building-inspection/building-inspection-type.js +153 -0
- package/dist-server/service/building-inspection/building-inspection-type.js.map +1 -0
- package/dist-server/service/building-inspection/building-inspection.d.ts +26 -0
- package/dist-server/service/building-inspection/building-inspection.js +113 -0
- package/dist-server/service/building-inspection/building-inspection.js.map +1 -0
- package/dist-server/service/building-inspection/event-subscriber.d.ts +7 -0
- package/dist-server/service/building-inspection/event-subscriber.js +21 -0
- package/dist-server/service/building-inspection/event-subscriber.js.map +1 -0
- package/dist-server/service/building-inspection/index.d.ts +10 -0
- package/dist-server/service/building-inspection/index.js +14 -0
- package/dist-server/service/building-inspection/index.js.map +1 -0
- package/dist-server/service/checklist/checklist-history.d.ts +24 -0
- package/dist-server/service/checklist/checklist-history.js +120 -0
- package/dist-server/service/checklist/checklist-history.js.map +1 -0
- package/dist-server/service/checklist/checklist-mutation.d.ts +8 -0
- package/dist-server/service/checklist/checklist-mutation.js +96 -0
- package/dist-server/service/checklist/checklist-mutation.js.map +1 -0
- package/dist-server/service/checklist/checklist-query.d.ts +12 -0
- package/dist-server/service/checklist/checklist-query.js +83 -0
- package/dist-server/service/checklist/checklist-query.js.map +1 -0
- package/dist-server/service/checklist/checklist-type.d.ts +18 -0
- package/dist-server/service/checklist/checklist-type.js +69 -0
- package/dist-server/service/checklist/checklist-type.js.map +1 -0
- package/dist-server/service/checklist/checklist.d.ts +31 -0
- package/dist-server/service/checklist/checklist.js +143 -0
- package/dist-server/service/checklist/checklist.js.map +1 -0
- package/dist-server/service/checklist/event-subscriber.d.ts +7 -0
- package/dist-server/service/checklist/event-subscriber.js +21 -0
- package/dist-server/service/checklist/event-subscriber.js.map +1 -0
- package/dist-server/service/checklist/index.d.ts +8 -0
- package/dist-server/service/checklist/index.js +12 -0
- package/dist-server/service/checklist/index.js.map +1 -0
- package/dist-server/service/checklist-item/checklist-item-mutation.d.ts +2 -0
- package/dist-server/service/checklist-item/checklist-item-mutation.js +13 -0
- package/dist-server/service/checklist-item/checklist-item-mutation.js.map +1 -0
- package/dist-server/service/checklist-item/checklist-item-query.d.ts +10 -0
- package/dist-server/service/checklist-item/checklist-item-query.js +68 -0
- package/dist-server/service/checklist-item/checklist-item-query.js.map +1 -0
- package/dist-server/service/checklist-item/checklist-item-type.d.ts +5 -0
- package/dist-server/service/checklist-item/checklist-item-type.js +21 -0
- package/dist-server/service/checklist-item/checklist-item-type.js.map +1 -0
- package/dist-server/service/checklist-item/checklist-item.d.ts +26 -0
- package/dist-server/service/checklist-item/checklist-item.js +113 -0
- package/dist-server/service/checklist-item/checklist-item.js.map +1 -0
- package/dist-server/service/checklist-item/index.d.ts +5 -0
- package/dist-server/service/checklist-item/index.js +10 -0
- package/dist-server/service/checklist-item/index.js.map +1 -0
- package/dist-server/service/checklist-template/checklist-template-mutation.d.ts +6 -0
- package/dist-server/service/checklist-template/checklist-template-mutation.js +64 -0
- package/dist-server/service/checklist-template/checklist-template-mutation.js.map +1 -0
- package/dist-server/service/checklist-template/checklist-template-query.d.ts +10 -0
- package/dist-server/service/checklist-template/checklist-template-query.js +65 -0
- package/dist-server/service/checklist-template/checklist-template-query.js.map +1 -0
- package/dist-server/service/checklist-template/checklist-template-type.d.ts +10 -0
- package/dist-server/service/checklist-template/checklist-template-type.js +39 -0
- package/dist-server/service/checklist-template/checklist-template-type.js.map +1 -0
- package/dist-server/service/checklist-template/checklist-template.d.ts +17 -0
- package/dist-server/service/checklist-template/checklist-template.js +78 -0
- package/dist-server/service/checklist-template/checklist-template.js.map +1 -0
- package/dist-server/service/checklist-template/index.d.ts +5 -0
- package/dist-server/service/checklist-template/index.js +9 -0
- package/dist-server/service/checklist-template/index.js.map +1 -0
- package/dist-server/service/checklist-template-item/checklist-template-item-mutation.d.ts +7 -0
- package/dist-server/service/checklist-template-item/checklist-template-item-mutation.js +68 -0
- package/dist-server/service/checklist-template-item/checklist-template-item-mutation.js.map +1 -0
- package/dist-server/service/checklist-template-item/checklist-template-item-query.d.ts +10 -0
- package/dist-server/service/checklist-template-item/checklist-template-item-query.js +66 -0
- package/dist-server/service/checklist-template-item/checklist-template-item-query.js.map +1 -0
- package/dist-server/service/checklist-template-item/checklist-template-item-type.d.ts +16 -0
- package/dist-server/service/checklist-template-item/checklist-template-item-type.js +60 -0
- package/dist-server/service/checklist-template-item/checklist-template-item-type.js.map +1 -0
- package/dist-server/service/checklist-template-item/checklist-template-item.d.ts +19 -0
- package/dist-server/service/checklist-template-item/checklist-template-item.js +87 -0
- package/dist-server/service/checklist-template-item/checklist-template-item.js.map +1 -0
- package/dist-server/service/checklist-template-item/index.d.ts +5 -0
- package/dist-server/service/checklist-template-item/index.js +9 -0
- package/dist-server/service/checklist-template-item/index.js.map +1 -0
- package/dist-server/service/checklist-type/checklist-type-mutation.d.ts +6 -0
- package/dist-server/service/checklist-type/checklist-type-mutation.js +64 -0
- package/dist-server/service/checklist-type/checklist-type-mutation.js.map +1 -0
- package/dist-server/service/checklist-type/checklist-type-query.d.ts +10 -0
- package/dist-server/service/checklist-type/checklist-type-query.js +65 -0
- package/dist-server/service/checklist-type/checklist-type-query.js.map +1 -0
- package/dist-server/service/checklist-type/checklist-type-type.d.ts +11 -0
- package/dist-server/service/checklist-type/checklist-type-type.js +43 -0
- package/dist-server/service/checklist-type/checklist-type-type.js.map +1 -0
- package/dist-server/service/checklist-type/checklist-type.d.ts +19 -0
- package/dist-server/service/checklist-type/checklist-type.js +78 -0
- package/dist-server/service/checklist-type/checklist-type.js.map +1 -0
- package/dist-server/service/checklist-type/index.d.ts +5 -0
- package/dist-server/service/checklist-type/index.js +9 -0
- package/dist-server/service/checklist-type/index.js.map +1 -0
- package/dist-server/service/index.d.ts +8 -3
- package/dist-server/service/index.js +25 -5
- package/dist-server/service/index.js.map +1 -1
- package/dist-server/service/issue/issue.d.ts +1 -3
- package/dist-server/service/issue/issue.js +1 -7
- package/dist-server/service/issue/issue.js.map +1 -1
- package/dist-server/service/supervisor/supervisor.d.ts +1 -3
- package/dist-server/service/supervisor/supervisor.js +1 -7
- package/dist-server/service/supervisor/supervisor.js.map +1 -1
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/helps/supervision/checklist-item.md +160 -0
- package/helps/supervision/checklist.md +160 -0
- package/package.json +11 -7
- package/server/index.ts +1 -1
- package/server/service/building-inspection/building-inspection-history.ts +70 -0
- package/server/service/building-inspection/building-inspection-mutation.ts +147 -0
- package/server/service/building-inspection/building-inspection-query.ts +202 -0
- package/server/service/building-inspection/building-inspection-type.ts +101 -0
- package/server/service/building-inspection/building-inspection.ts +106 -0
- package/server/service/building-inspection/event-subscriber.ts +20 -0
- package/server/service/building-inspection/index.ts +11 -0
- package/server/service/checklist/checklist-history.ts +96 -0
- package/server/service/checklist/checklist-mutation.ts +103 -0
- package/server/service/checklist/checklist-query.ts +52 -0
- package/server/service/{check-item/check-item-type.ts → checklist/checklist-type.ts} +6 -18
- package/server/service/checklist/checklist.ts +127 -0
- package/server/service/checklist/event-subscriber.ts +17 -0
- package/server/service/checklist/index.ts +9 -0
- package/server/service/checklist-item/checklist-item-mutation.ts +5 -0
- package/server/service/checklist-item/checklist-item-query.ts +43 -0
- package/server/service/checklist-item/checklist-item-type.ts +12 -0
- package/server/service/checklist-item/checklist-item.ts +100 -0
- package/server/service/checklist-item/index.ts +7 -0
- package/server/service/checklist-template/checklist-template-mutation.ts +66 -0
- package/server/service/checklist-template/checklist-template-query.ts +39 -0
- package/server/service/checklist-template/checklist-template-type.ts +23 -0
- package/server/service/checklist-template/checklist-template.ts +71 -0
- package/server/service/checklist-template/index.ts +6 -0
- package/server/service/checklist-template-item/checklist-template-item-mutation.ts +64 -0
- package/server/service/checklist-template-item/checklist-template-item-query.ts +39 -0
- package/server/service/checklist-template-item/checklist-template-item-type.ts +39 -0
- package/server/service/checklist-template-item/checklist-template-item.ts +67 -0
- package/server/service/checklist-template-item/index.ts +6 -0
- package/server/service/checklist-type/checklist-type-mutation.ts +66 -0
- package/server/service/checklist-type/checklist-type-query.ts +39 -0
- package/server/service/checklist-type/checklist-type-type.ts +26 -0
- package/server/service/checklist-type/checklist-type.ts +64 -0
- package/server/service/checklist-type/index.ts +6 -0
- package/server/service/index.ts +59 -23
- package/server/service/issue/issue.ts +1 -6
- package/server/service/supervisor/supervisor.ts +1 -6
- package/things-factory.config.js +11 -7
- package/client/pages/check-item/check-item-importer.ts +0 -94
- package/client/pages/check-item/check-item-list-page.ts +0 -340
- package/dist-client/pages/check-item/check-item-importer.d.ts +0 -10
- package/dist-client/pages/check-item/check-item-importer.js +0 -101
- package/dist-client/pages/check-item/check-item-importer.js.map +0 -1
- package/dist-client/pages/check-item/check-item-list-page.js +0 -323
- package/dist-client/pages/check-item/check-item-list-page.js.map +0 -1
- package/dist-server/service/check-item/check-item-mutation.d.ts +0 -10
- package/dist-server/service/check-item/check-item-mutation.js +0 -168
- package/dist-server/service/check-item/check-item-mutation.js.map +0 -1
- package/dist-server/service/check-item/check-item-query.d.ts +0 -12
- package/dist-server/service/check-item/check-item-query.js +0 -97
- package/dist-server/service/check-item/check-item-query.js.map +0 -1
- package/dist-server/service/check-item/check-item-type.d.ts +0 -23
- package/dist-server/service/check-item/check-item-type.js +0 -86
- package/dist-server/service/check-item/check-item-type.js.map +0 -1
- package/dist-server/service/check-item/check-item.d.ts +0 -28
- package/dist-server/service/check-item/check-item.js +0 -117
- package/dist-server/service/check-item/check-item.js.map +0 -1
- package/dist-server/service/check-item/index.d.ts +0 -6
- package/dist-server/service/check-item/index.js +0 -10
- package/dist-server/service/check-item/index.js.map +0 -1
- package/server/service/check-item/check-item-mutation.ts +0 -198
- package/server/service/check-item/check-item-query.ts +0 -62
- package/server/service/check-item/check-item.ts +0 -111
- package/server/service/check-item/index.ts +0 -7
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CheckItemQuery = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const type_graphql_1 = require("type-graphql");
|
|
6
|
-
const attachment_base_1 = require("@things-factory/attachment-base");
|
|
7
|
-
const shell_1 = require("@things-factory/shell");
|
|
8
|
-
const auth_base_1 = require("@things-factory/auth-base");
|
|
9
|
-
const check_item_1 = require("./check-item");
|
|
10
|
-
const check_item_type_1 = require("./check-item-type");
|
|
11
|
-
let CheckItemQuery = class CheckItemQuery {
|
|
12
|
-
async checkItem(id, context) {
|
|
13
|
-
const { domain } = context.state;
|
|
14
|
-
return await (0, shell_1.getRepository)(check_item_1.CheckItem).findOne({
|
|
15
|
-
where: { domain: { id: domain.id }, id }
|
|
16
|
-
});
|
|
17
|
-
}
|
|
18
|
-
async checkItems(params, context) {
|
|
19
|
-
const { domain } = context.state;
|
|
20
|
-
const queryBuilder = (0, shell_1.getQueryBuilderFromListParams)({
|
|
21
|
-
domain,
|
|
22
|
-
params,
|
|
23
|
-
repository: await (0, shell_1.getRepository)(check_item_1.CheckItem),
|
|
24
|
-
searchables: ['name', 'description']
|
|
25
|
-
});
|
|
26
|
-
const [items, total] = await queryBuilder.getManyAndCount();
|
|
27
|
-
return { items, total };
|
|
28
|
-
}
|
|
29
|
-
async thumbnail(checkItem) {
|
|
30
|
-
const attachment = await (0, shell_1.getRepository)(attachment_base_1.Attachment).findOne({
|
|
31
|
-
where: {
|
|
32
|
-
domain: { id: checkItem.domainId },
|
|
33
|
-
refType: check_item_1.CheckItem.name,
|
|
34
|
-
refBy: checkItem.id
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
return attachment === null || attachment === void 0 ? void 0 : attachment.fullpath;
|
|
38
|
-
}
|
|
39
|
-
async domain(checkItem) {
|
|
40
|
-
return await (0, shell_1.getRepository)(shell_1.Domain).findOneBy({ id: checkItem.domainId });
|
|
41
|
-
}
|
|
42
|
-
async updater(checkItem) {
|
|
43
|
-
return await (0, shell_1.getRepository)(auth_base_1.User).findOneBy({ id: checkItem.updaterId });
|
|
44
|
-
}
|
|
45
|
-
async creator(checkItem) {
|
|
46
|
-
return await (0, shell_1.getRepository)(auth_base_1.User).findOneBy({ id: checkItem.creatorId });
|
|
47
|
-
}
|
|
48
|
-
};
|
|
49
|
-
tslib_1.__decorate([
|
|
50
|
-
(0, type_graphql_1.Query)(returns => check_item_1.CheckItem, { nullable: true, description: 'To fetch a CheckItem' }),
|
|
51
|
-
tslib_1.__param(0, (0, type_graphql_1.Arg)('id')),
|
|
52
|
-
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
|
53
|
-
tslib_1.__metadata("design:type", Function),
|
|
54
|
-
tslib_1.__metadata("design:paramtypes", [String, Object]),
|
|
55
|
-
tslib_1.__metadata("design:returntype", Promise)
|
|
56
|
-
], CheckItemQuery.prototype, "checkItem", null);
|
|
57
|
-
tslib_1.__decorate([
|
|
58
|
-
(0, type_graphql_1.Query)(returns => check_item_type_1.CheckItemList, { description: 'To fetch multiple CheckItems' }),
|
|
59
|
-
tslib_1.__param(0, (0, type_graphql_1.Args)()),
|
|
60
|
-
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
|
61
|
-
tslib_1.__metadata("design:type", Function),
|
|
62
|
-
tslib_1.__metadata("design:paramtypes", [shell_1.ListParam, Object]),
|
|
63
|
-
tslib_1.__metadata("design:returntype", Promise)
|
|
64
|
-
], CheckItemQuery.prototype, "checkItems", null);
|
|
65
|
-
tslib_1.__decorate([
|
|
66
|
-
(0, type_graphql_1.FieldResolver)(type => String),
|
|
67
|
-
tslib_1.__param(0, (0, type_graphql_1.Root)()),
|
|
68
|
-
tslib_1.__metadata("design:type", Function),
|
|
69
|
-
tslib_1.__metadata("design:paramtypes", [check_item_1.CheckItem]),
|
|
70
|
-
tslib_1.__metadata("design:returntype", Promise)
|
|
71
|
-
], CheckItemQuery.prototype, "thumbnail", null);
|
|
72
|
-
tslib_1.__decorate([
|
|
73
|
-
(0, type_graphql_1.FieldResolver)(type => shell_1.Domain),
|
|
74
|
-
tslib_1.__param(0, (0, type_graphql_1.Root)()),
|
|
75
|
-
tslib_1.__metadata("design:type", Function),
|
|
76
|
-
tslib_1.__metadata("design:paramtypes", [check_item_1.CheckItem]),
|
|
77
|
-
tslib_1.__metadata("design:returntype", Promise)
|
|
78
|
-
], CheckItemQuery.prototype, "domain", null);
|
|
79
|
-
tslib_1.__decorate([
|
|
80
|
-
(0, type_graphql_1.FieldResolver)(type => auth_base_1.User),
|
|
81
|
-
tslib_1.__param(0, (0, type_graphql_1.Root)()),
|
|
82
|
-
tslib_1.__metadata("design:type", Function),
|
|
83
|
-
tslib_1.__metadata("design:paramtypes", [check_item_1.CheckItem]),
|
|
84
|
-
tslib_1.__metadata("design:returntype", Promise)
|
|
85
|
-
], CheckItemQuery.prototype, "updater", null);
|
|
86
|
-
tslib_1.__decorate([
|
|
87
|
-
(0, type_graphql_1.FieldResolver)(type => auth_base_1.User),
|
|
88
|
-
tslib_1.__param(0, (0, type_graphql_1.Root)()),
|
|
89
|
-
tslib_1.__metadata("design:type", Function),
|
|
90
|
-
tslib_1.__metadata("design:paramtypes", [check_item_1.CheckItem]),
|
|
91
|
-
tslib_1.__metadata("design:returntype", Promise)
|
|
92
|
-
], CheckItemQuery.prototype, "creator", null);
|
|
93
|
-
CheckItemQuery = tslib_1.__decorate([
|
|
94
|
-
(0, type_graphql_1.Resolver)(check_item_1.CheckItem)
|
|
95
|
-
], CheckItemQuery);
|
|
96
|
-
exports.CheckItemQuery = CheckItemQuery;
|
|
97
|
-
//# sourceMappingURL=check-item-query.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"check-item-query.js","sourceRoot":"","sources":["../../../server/service/check-item/check-item-query.ts"],"names":[],"mappings":"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","sourcesContent":["import { Resolver, Query, FieldResolver, Root, Args, Arg, Ctx, Directive } from 'type-graphql'\nimport { Attachment } from '@things-factory/attachment-base'\nimport { Domain, getQueryBuilderFromListParams, getRepository, ListParam } from '@things-factory/shell'\nimport { User } from '@things-factory/auth-base'\nimport { CheckItem } from './check-item'\nimport { CheckItemList } from './check-item-type'\n\n@Resolver(CheckItem)\nexport class CheckItemQuery {\n @Query(returns => CheckItem!, { nullable: true, description: 'To fetch a CheckItem' })\n async checkItem(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<CheckItem> {\n const { domain } = context.state\n\n return await getRepository(CheckItem).findOne({\n where: { domain: { id: domain.id }, id }\n })\n }\n\n @Query(returns => CheckItemList, { description: 'To fetch multiple CheckItems' })\n async checkItems(@Args() params: ListParam, @Ctx() context: ResolverContext): Promise<CheckItemList> {\n const { domain } = context.state\n\n const queryBuilder = getQueryBuilderFromListParams({\n domain,\n params,\n repository: await getRepository(CheckItem),\n searchables: ['name', 'description']\n })\n\n const [items, total] = await queryBuilder.getManyAndCount()\n\n return { items, total }\n }\n\n @FieldResolver(type => String)\n async thumbnail(@Root() checkItem: CheckItem): Promise<string | undefined> {\n const attachment: Attachment = await getRepository(Attachment).findOne({\n where: {\n domain: { id: checkItem.domainId },\n refType: CheckItem.name,\n refBy: checkItem.id\n }\n })\n\n return attachment?.fullpath\n }\n\n @FieldResolver(type => Domain)\n async domain(@Root() checkItem: CheckItem): Promise<Domain> {\n return await getRepository(Domain).findOneBy({ id: checkItem.domainId })\n }\n\n @FieldResolver(type => User)\n async updater(@Root() checkItem: CheckItem): Promise<User> {\n return await getRepository(User).findOneBy({ id: checkItem.updaterId })\n }\n\n @FieldResolver(type => User)\n async creator(@Root() checkItem: CheckItem): Promise<User> {\n return await getRepository(User).findOneBy({ id: checkItem.creatorId })\n }\n}\n"]}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import type { FileUpload } from 'graphql-upload/GraphQLUpload.js';
|
|
2
|
-
import { CheckItem, CheckItemStatus } from './check-item';
|
|
3
|
-
export declare class NewCheckItem {
|
|
4
|
-
name: string;
|
|
5
|
-
description?: string;
|
|
6
|
-
state?: CheckItemStatus;
|
|
7
|
-
active?: boolean;
|
|
8
|
-
params?: string;
|
|
9
|
-
thumbnail?: FileUpload;
|
|
10
|
-
}
|
|
11
|
-
export declare class CheckItemPatch {
|
|
12
|
-
id?: string;
|
|
13
|
-
name?: string;
|
|
14
|
-
description?: string;
|
|
15
|
-
state?: CheckItemStatus;
|
|
16
|
-
active?: boolean;
|
|
17
|
-
thumbnail?: FileUpload;
|
|
18
|
-
cuFlag?: string;
|
|
19
|
-
}
|
|
20
|
-
export declare class CheckItemList {
|
|
21
|
-
items: CheckItem[];
|
|
22
|
-
total: number;
|
|
23
|
-
}
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CheckItemList = exports.CheckItemPatch = exports.NewCheckItem = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const GraphQLUpload_js_1 = tslib_1.__importDefault(require("graphql-upload/GraphQLUpload.js"));
|
|
6
|
-
const type_graphql_1 = require("type-graphql");
|
|
7
|
-
const check_item_1 = require("./check-item");
|
|
8
|
-
let NewCheckItem = class NewCheckItem {
|
|
9
|
-
};
|
|
10
|
-
tslib_1.__decorate([
|
|
11
|
-
(0, type_graphql_1.Field)(),
|
|
12
|
-
tslib_1.__metadata("design:type", String)
|
|
13
|
-
], NewCheckItem.prototype, "name", void 0);
|
|
14
|
-
tslib_1.__decorate([
|
|
15
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
|
16
|
-
tslib_1.__metadata("design:type", String)
|
|
17
|
-
], NewCheckItem.prototype, "description", void 0);
|
|
18
|
-
tslib_1.__decorate([
|
|
19
|
-
(0, type_graphql_1.Field)(type => check_item_1.CheckItemStatus, { nullable: true }),
|
|
20
|
-
tslib_1.__metadata("design:type", String)
|
|
21
|
-
], NewCheckItem.prototype, "state", void 0);
|
|
22
|
-
tslib_1.__decorate([
|
|
23
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
|
24
|
-
tslib_1.__metadata("design:type", Boolean)
|
|
25
|
-
], NewCheckItem.prototype, "active", void 0);
|
|
26
|
-
tslib_1.__decorate([
|
|
27
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
|
28
|
-
tslib_1.__metadata("design:type", String)
|
|
29
|
-
], NewCheckItem.prototype, "params", void 0);
|
|
30
|
-
tslib_1.__decorate([
|
|
31
|
-
(0, type_graphql_1.Field)(type => GraphQLUpload_js_1.default, { nullable: true }),
|
|
32
|
-
tslib_1.__metadata("design:type", Object)
|
|
33
|
-
], NewCheckItem.prototype, "thumbnail", void 0);
|
|
34
|
-
NewCheckItem = tslib_1.__decorate([
|
|
35
|
-
(0, type_graphql_1.InputType)()
|
|
36
|
-
], NewCheckItem);
|
|
37
|
-
exports.NewCheckItem = NewCheckItem;
|
|
38
|
-
let CheckItemPatch = class CheckItemPatch {
|
|
39
|
-
};
|
|
40
|
-
tslib_1.__decorate([
|
|
41
|
-
(0, type_graphql_1.Field)(type => type_graphql_1.ID, { nullable: true }),
|
|
42
|
-
tslib_1.__metadata("design:type", String)
|
|
43
|
-
], CheckItemPatch.prototype, "id", void 0);
|
|
44
|
-
tslib_1.__decorate([
|
|
45
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
|
46
|
-
tslib_1.__metadata("design:type", String)
|
|
47
|
-
], CheckItemPatch.prototype, "name", void 0);
|
|
48
|
-
tslib_1.__decorate([
|
|
49
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
|
50
|
-
tslib_1.__metadata("design:type", String)
|
|
51
|
-
], CheckItemPatch.prototype, "description", void 0);
|
|
52
|
-
tslib_1.__decorate([
|
|
53
|
-
(0, type_graphql_1.Field)(type => check_item_1.CheckItemStatus, { nullable: true }),
|
|
54
|
-
tslib_1.__metadata("design:type", String)
|
|
55
|
-
], CheckItemPatch.prototype, "state", void 0);
|
|
56
|
-
tslib_1.__decorate([
|
|
57
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
|
58
|
-
tslib_1.__metadata("design:type", Boolean)
|
|
59
|
-
], CheckItemPatch.prototype, "active", void 0);
|
|
60
|
-
tslib_1.__decorate([
|
|
61
|
-
(0, type_graphql_1.Field)(type => GraphQLUpload_js_1.default, { nullable: true }),
|
|
62
|
-
tslib_1.__metadata("design:type", Object)
|
|
63
|
-
], CheckItemPatch.prototype, "thumbnail", void 0);
|
|
64
|
-
tslib_1.__decorate([
|
|
65
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
|
66
|
-
tslib_1.__metadata("design:type", String)
|
|
67
|
-
], CheckItemPatch.prototype, "cuFlag", void 0);
|
|
68
|
-
CheckItemPatch = tslib_1.__decorate([
|
|
69
|
-
(0, type_graphql_1.InputType)()
|
|
70
|
-
], CheckItemPatch);
|
|
71
|
-
exports.CheckItemPatch = CheckItemPatch;
|
|
72
|
-
let CheckItemList = class CheckItemList {
|
|
73
|
-
};
|
|
74
|
-
tslib_1.__decorate([
|
|
75
|
-
(0, type_graphql_1.Field)(type => [check_item_1.CheckItem]),
|
|
76
|
-
tslib_1.__metadata("design:type", Array)
|
|
77
|
-
], CheckItemList.prototype, "items", void 0);
|
|
78
|
-
tslib_1.__decorate([
|
|
79
|
-
(0, type_graphql_1.Field)(type => type_graphql_1.Int),
|
|
80
|
-
tslib_1.__metadata("design:type", Number)
|
|
81
|
-
], CheckItemList.prototype, "total", void 0);
|
|
82
|
-
CheckItemList = tslib_1.__decorate([
|
|
83
|
-
(0, type_graphql_1.ObjectType)()
|
|
84
|
-
], CheckItemList);
|
|
85
|
-
exports.CheckItemList = CheckItemList;
|
|
86
|
-
//# sourceMappingURL=check-item-type.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"check-item-type.js","sourceRoot":"","sources":["../../../server/service/check-item/check-item-type.ts"],"names":[],"mappings":";;;;AACA,+FAA2D;AAC3D,+CAAsF;AAItF,6CAAyD;AAGlD,IAAM,YAAY,GAAlB,MAAM,YAAY;CAkBxB,CAAA;AAjBC;IAAC,IAAA,oBAAK,GAAE;;0CACI;AAEZ;IAAC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;iDACN;AAEpB;IAAC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,4BAAe,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;2CAC5B;AAEvB;IAAC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;4CACV;AAEhB;IAAC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;4CACX;AAEf;IAAC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,0BAAa,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;+CAC3B;AAjBX,YAAY;IADxB,IAAA,wBAAS,GAAE;GACC,YAAY,CAkBxB;AAlBY,oCAAY;AAqBlB,IAAM,cAAc,GAApB,MAAM,cAAc;CAqB1B,CAAA;AApBC;IAAC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,iBAAE,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;0CAC3B;AAEX;IAAC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;4CACb;AAEb;IAAC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;mDACN;AAEpB;IAAC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,4BAAe,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;6CAC5B;AAEvB;IAAC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;8CACV;AAEhB;IAAC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,0BAAa,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;iDAC3B;AAEtB;IAAC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;8CACX;AApBJ,cAAc;IAD1B,IAAA,wBAAS,GAAE;GACC,cAAc,CAqB1B;AArBY,wCAAc;AAwBpB,IAAM,aAAa,GAAnB,MAAM,aAAa;CAMzB,CAAA;AALC;IAAC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,CAAC,sBAAS,CAAC,CAAC;;4CACT;AAElB;IAAC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,kBAAG,CAAC;;4CACN;AALF,aAAa;IADzB,IAAA,yBAAU,GAAE;GACA,aAAa,CAMzB;AANY,sCAAa","sourcesContent":["import type { FileUpload } from 'graphql-upload/GraphQLUpload.js'\nimport GraphQLUpload from 'graphql-upload/GraphQLUpload.js'\nimport { ObjectType, Field, InputType, Int, ID, registerEnumType } from 'type-graphql'\n\nimport { ObjectRef, ScalarObject } from '@things-factory/shell'\n\nimport { CheckItem, CheckItemStatus } from './check-item'\n\n@InputType()\nexport class NewCheckItem {\n @Field()\n name: string\n\n @Field({ nullable: true })\n description?: string\n\n @Field(type => CheckItemStatus, { nullable: true })\n state?: CheckItemStatus\n\n @Field({ nullable: true })\n active?: boolean\n\n @Field({ nullable: true })\n params?: string\n\n @Field(type => GraphQLUpload, { nullable: true })\n thumbnail?: FileUpload\n}\n\n@InputType()\nexport class CheckItemPatch {\n @Field(type => ID, { nullable: true })\n id?: string\n\n @Field({ nullable: true })\n name?: string\n\n @Field({ nullable: true })\n description?: string\n\n @Field(type => CheckItemStatus, { nullable: true })\n state?: CheckItemStatus\n\n @Field({ nullable: true })\n active?: boolean\n\n @Field(type => GraphQLUpload, { nullable: true })\n thumbnail?: FileUpload\n\n @Field({ nullable: true })\n cuFlag?: string\n}\n\n@ObjectType()\nexport class CheckItemList {\n @Field(type => [CheckItem])\n items: CheckItem[]\n\n @Field(type => Int)\n total: number\n}\n"]}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { Domain } from '@things-factory/shell';
|
|
2
|
-
import { User } from '@things-factory/auth-base';
|
|
3
|
-
import { Issue } from '../issue/issue';
|
|
4
|
-
import { Supervisor } from '../supervisor/supervisor';
|
|
5
|
-
export declare enum CheckItemStatus {
|
|
6
|
-
STATUS_A = "STATUS_A",
|
|
7
|
-
STATUS_B = "STATUS_B"
|
|
8
|
-
}
|
|
9
|
-
export declare class CheckItem {
|
|
10
|
-
readonly id: string;
|
|
11
|
-
domain?: Domain;
|
|
12
|
-
domainId?: string;
|
|
13
|
-
name?: string;
|
|
14
|
-
description?: string;
|
|
15
|
-
active?: boolean;
|
|
16
|
-
state?: CheckItemStatus;
|
|
17
|
-
params?: string;
|
|
18
|
-
supervisor: Supervisor;
|
|
19
|
-
issues: Issue[];
|
|
20
|
-
createdAt?: Date;
|
|
21
|
-
updatedAt?: Date;
|
|
22
|
-
deletedAt?: Date;
|
|
23
|
-
creator?: User;
|
|
24
|
-
creatorId?: string;
|
|
25
|
-
updater?: User;
|
|
26
|
-
updaterId?: string;
|
|
27
|
-
thumbnail?: string;
|
|
28
|
-
}
|
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CheckItem = exports.CheckItemStatus = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const typeorm_1 = require("typeorm");
|
|
6
|
-
const type_graphql_1 = require("type-graphql");
|
|
7
|
-
const shell_1 = require("@things-factory/shell");
|
|
8
|
-
const auth_base_1 = require("@things-factory/auth-base");
|
|
9
|
-
const issue_1 = require("../issue/issue");
|
|
10
|
-
const supervisor_1 = require("../supervisor/supervisor");
|
|
11
|
-
var CheckItemStatus;
|
|
12
|
-
(function (CheckItemStatus) {
|
|
13
|
-
CheckItemStatus["STATUS_A"] = "STATUS_A";
|
|
14
|
-
CheckItemStatus["STATUS_B"] = "STATUS_B";
|
|
15
|
-
})(CheckItemStatus = exports.CheckItemStatus || (exports.CheckItemStatus = {}));
|
|
16
|
-
(0, type_graphql_1.registerEnumType)(CheckItemStatus, {
|
|
17
|
-
name: 'CheckItemStatus',
|
|
18
|
-
description: 'state enumeration of a checkItem'
|
|
19
|
-
});
|
|
20
|
-
let CheckItem = class CheckItem {
|
|
21
|
-
};
|
|
22
|
-
tslib_1.__decorate([
|
|
23
|
-
(0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
|
|
24
|
-
(0, type_graphql_1.Field)(type => type_graphql_1.ID),
|
|
25
|
-
tslib_1.__metadata("design:type", String)
|
|
26
|
-
], CheckItem.prototype, "id", void 0);
|
|
27
|
-
tslib_1.__decorate([
|
|
28
|
-
(0, typeorm_1.ManyToOne)(type => shell_1.Domain),
|
|
29
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
|
30
|
-
tslib_1.__metadata("design:type", shell_1.Domain)
|
|
31
|
-
], CheckItem.prototype, "domain", void 0);
|
|
32
|
-
tslib_1.__decorate([
|
|
33
|
-
(0, typeorm_1.RelationId)((checkItem) => checkItem.domain),
|
|
34
|
-
tslib_1.__metadata("design:type", String)
|
|
35
|
-
], CheckItem.prototype, "domainId", void 0);
|
|
36
|
-
tslib_1.__decorate([
|
|
37
|
-
(0, typeorm_1.Column)(),
|
|
38
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
|
39
|
-
tslib_1.__metadata("design:type", String)
|
|
40
|
-
], CheckItem.prototype, "name", void 0);
|
|
41
|
-
tslib_1.__decorate([
|
|
42
|
-
(0, typeorm_1.Column)({ nullable: true }),
|
|
43
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
|
44
|
-
tslib_1.__metadata("design:type", String)
|
|
45
|
-
], CheckItem.prototype, "description", void 0);
|
|
46
|
-
tslib_1.__decorate([
|
|
47
|
-
(0, typeorm_1.Column)({ nullable: true }),
|
|
48
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
|
49
|
-
tslib_1.__metadata("design:type", Boolean)
|
|
50
|
-
], CheckItem.prototype, "active", void 0);
|
|
51
|
-
tslib_1.__decorate([
|
|
52
|
-
(0, typeorm_1.Column)({ nullable: true }),
|
|
53
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
|
54
|
-
tslib_1.__metadata("design:type", String)
|
|
55
|
-
], CheckItem.prototype, "state", void 0);
|
|
56
|
-
tslib_1.__decorate([
|
|
57
|
-
(0, typeorm_1.Column)({ nullable: true }),
|
|
58
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
|
59
|
-
tslib_1.__metadata("design:type", String)
|
|
60
|
-
], CheckItem.prototype, "params", void 0);
|
|
61
|
-
tslib_1.__decorate([
|
|
62
|
-
(0, type_graphql_1.Field)(() => supervisor_1.Supervisor),
|
|
63
|
-
(0, typeorm_1.ManyToOne)(() => supervisor_1.Supervisor, supervisor => supervisor.checkItems),
|
|
64
|
-
tslib_1.__metadata("design:type", supervisor_1.Supervisor)
|
|
65
|
-
], CheckItem.prototype, "supervisor", void 0);
|
|
66
|
-
tslib_1.__decorate([
|
|
67
|
-
(0, type_graphql_1.Field)(() => [issue_1.Issue]),
|
|
68
|
-
(0, typeorm_1.OneToMany)(() => issue_1.Issue, issue => issue.checkItem),
|
|
69
|
-
tslib_1.__metadata("design:type", Array)
|
|
70
|
-
], CheckItem.prototype, "issues", void 0);
|
|
71
|
-
tslib_1.__decorate([
|
|
72
|
-
(0, typeorm_1.CreateDateColumn)(),
|
|
73
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
|
74
|
-
tslib_1.__metadata("design:type", Date)
|
|
75
|
-
], CheckItem.prototype, "createdAt", void 0);
|
|
76
|
-
tslib_1.__decorate([
|
|
77
|
-
(0, typeorm_1.UpdateDateColumn)(),
|
|
78
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
|
79
|
-
tslib_1.__metadata("design:type", Date)
|
|
80
|
-
], CheckItem.prototype, "updatedAt", void 0);
|
|
81
|
-
tslib_1.__decorate([
|
|
82
|
-
(0, typeorm_1.DeleteDateColumn)(),
|
|
83
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
|
84
|
-
tslib_1.__metadata("design:type", Date)
|
|
85
|
-
], CheckItem.prototype, "deletedAt", void 0);
|
|
86
|
-
tslib_1.__decorate([
|
|
87
|
-
(0, typeorm_1.ManyToOne)(type => auth_base_1.User, { nullable: true }),
|
|
88
|
-
(0, type_graphql_1.Field)(type => auth_base_1.User, { nullable: true }),
|
|
89
|
-
tslib_1.__metadata("design:type", auth_base_1.User)
|
|
90
|
-
], CheckItem.prototype, "creator", void 0);
|
|
91
|
-
tslib_1.__decorate([
|
|
92
|
-
(0, typeorm_1.RelationId)((checkItem) => checkItem.creator),
|
|
93
|
-
tslib_1.__metadata("design:type", String)
|
|
94
|
-
], CheckItem.prototype, "creatorId", void 0);
|
|
95
|
-
tslib_1.__decorate([
|
|
96
|
-
(0, typeorm_1.ManyToOne)(type => auth_base_1.User, { nullable: true }),
|
|
97
|
-
(0, type_graphql_1.Field)(type => auth_base_1.User, { nullable: true }),
|
|
98
|
-
tslib_1.__metadata("design:type", auth_base_1.User)
|
|
99
|
-
], CheckItem.prototype, "updater", void 0);
|
|
100
|
-
tslib_1.__decorate([
|
|
101
|
-
(0, typeorm_1.RelationId)((checkItem) => checkItem.updater),
|
|
102
|
-
tslib_1.__metadata("design:type", String)
|
|
103
|
-
], CheckItem.prototype, "updaterId", void 0);
|
|
104
|
-
tslib_1.__decorate([
|
|
105
|
-
(0, type_graphql_1.Field)(type => String, { nullable: true }),
|
|
106
|
-
tslib_1.__metadata("design:type", String)
|
|
107
|
-
], CheckItem.prototype, "thumbnail", void 0);
|
|
108
|
-
CheckItem = tslib_1.__decorate([
|
|
109
|
-
(0, typeorm_1.Entity)(),
|
|
110
|
-
(0, typeorm_1.Index)('ix_check_item_0', (checkItem) => [checkItem.domain, checkItem.name], {
|
|
111
|
-
unique: true,
|
|
112
|
-
where: '"deleted_at" IS NULL'
|
|
113
|
-
}),
|
|
114
|
-
(0, type_graphql_1.ObjectType)({ description: 'Entity for CheckItem' })
|
|
115
|
-
], CheckItem);
|
|
116
|
-
exports.CheckItem = CheckItem;
|
|
117
|
-
//# sourceMappingURL=check-item.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"check-item.js","sourceRoot":"","sources":["../../../server/service/check-item/check-item.ts"],"names":[],"mappings":"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","sourcesContent":["import {\n CreateDateColumn,\n UpdateDateColumn,\n DeleteDateColumn,\n Entity,\n Index,\n Column,\n RelationId,\n ManyToOne,\n OneToMany,\n PrimaryGeneratedColumn,\n VersionColumn\n} from 'typeorm'\nimport { ObjectType, Field, Int, ID, registerEnumType } from 'type-graphql'\n\nimport { Domain } from '@things-factory/shell'\nimport { User } from '@things-factory/auth-base'\nimport { Task } from '@dssp/project'\n\nimport { Issue } from '../issue/issue'\nimport { Supervisor } from '../supervisor/supervisor'\n\nexport enum CheckItemStatus {\n STATUS_A = 'STATUS_A',\n STATUS_B = 'STATUS_B'\n}\n\nregisterEnumType(CheckItemStatus, {\n name: 'CheckItemStatus',\n description: 'state enumeration of a checkItem'\n})\n\n@Entity()\n@Index('ix_check_item_0', (checkItem: CheckItem) => [checkItem.domain, checkItem.name], {\n unique: true,\n where: '\"deleted_at\" IS NULL'\n})\n@ObjectType({ description: 'Entity for CheckItem' })\nexport class CheckItem {\n @PrimaryGeneratedColumn('uuid')\n @Field(type => ID)\n readonly id: string\n\n @ManyToOne(type => Domain)\n @Field({ nullable: true })\n domain?: Domain\n\n @RelationId((checkItem: CheckItem) => checkItem.domain)\n domainId?: string\n\n @Column()\n @Field({ nullable: true })\n name?: string\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n description?: string\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n active?: boolean\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n state?: CheckItemStatus\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n params?: string\n\n // @Field(() => Task)\n // @ManyToOne(() => Task, task => task.checkItems)\n // task: Task\n\n @Field(() => Supervisor)\n @ManyToOne(() => Supervisor, supervisor => supervisor.checkItems)\n supervisor: Supervisor\n\n @Field(() => [Issue])\n @OneToMany(() => Issue, issue => issue.checkItem)\n issues: Issue[]\n\n @CreateDateColumn()\n @Field({ nullable: true })\n createdAt?: Date\n\n @UpdateDateColumn()\n @Field({ nullable: true })\n updatedAt?: Date\n\n @DeleteDateColumn()\n @Field({ nullable: true })\n deletedAt?: Date\n\n @ManyToOne(type => User, { nullable: true })\n @Field(type => User, { nullable: true })\n creator?: User\n\n @RelationId((checkItem: CheckItem) => checkItem.creator)\n creatorId?: string\n\n @ManyToOne(type => User, { nullable: true })\n @Field(type => User, { nullable: true })\n updater?: User\n\n @RelationId((checkItem: CheckItem) => checkItem.updater)\n updaterId?: string\n\n @Field(type => String, { nullable: true })\n thumbnail?: string\n}\n"]}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { CheckItem } from './check-item';
|
|
2
|
-
import { CheckItemQuery } from './check-item-query';
|
|
3
|
-
import { CheckItemMutation } from './check-item-mutation';
|
|
4
|
-
export declare const entities: (typeof CheckItem)[];
|
|
5
|
-
export declare const resolvers: (typeof CheckItemQuery | typeof CheckItemMutation)[];
|
|
6
|
-
export declare const subscribers: any[];
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.subscribers = exports.resolvers = exports.entities = void 0;
|
|
4
|
-
const check_item_1 = require("./check-item");
|
|
5
|
-
const check_item_query_1 = require("./check-item-query");
|
|
6
|
-
const check_item_mutation_1 = require("./check-item-mutation");
|
|
7
|
-
exports.entities = [check_item_1.CheckItem];
|
|
8
|
-
exports.resolvers = [check_item_query_1.CheckItemQuery, check_item_mutation_1.CheckItemMutation];
|
|
9
|
-
exports.subscribers = [];
|
|
10
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../server/service/check-item/index.ts"],"names":[],"mappings":";;;AAAA,6CAAwC;AACxC,yDAAmD;AACnD,+DAAyD;AAE5C,QAAA,QAAQ,GAAG,CAAC,sBAAS,CAAC,CAAA;AACtB,QAAA,SAAS,GAAG,CAAC,iCAAc,EAAE,uCAAiB,CAAC,CAAA;AAC/C,QAAA,WAAW,GAAG,EAAE,CAAA","sourcesContent":["import { CheckItem } from './check-item'\nimport { CheckItemQuery } from './check-item-query'\nimport { CheckItemMutation } from './check-item-mutation'\n\nexport const entities = [CheckItem]\nexport const resolvers = [CheckItemQuery, CheckItemMutation]\nexport const subscribers = []\n"]}
|
|
@@ -1,198 +0,0 @@
|
|
|
1
|
-
import { Resolver, Mutation, Arg, Ctx, Directive } from 'type-graphql'
|
|
2
|
-
import { In } from 'typeorm'
|
|
3
|
-
|
|
4
|
-
import { createAttachment, deleteAttachmentsByRef } from '@things-factory/attachment-base'
|
|
5
|
-
|
|
6
|
-
import { CheckItem } from './check-item'
|
|
7
|
-
import { NewCheckItem, CheckItemPatch } from './check-item-type'
|
|
8
|
-
|
|
9
|
-
@Resolver(CheckItem)
|
|
10
|
-
export class CheckItemMutation {
|
|
11
|
-
@Directive('@transaction')
|
|
12
|
-
@Mutation(returns => CheckItem, { description: 'To create new CheckItem' })
|
|
13
|
-
async createCheckItem(@Arg('checkItem') checkItem: NewCheckItem, @Ctx() context: ResolverContext): Promise<CheckItem> {
|
|
14
|
-
const { domain, user, tx } = context.state
|
|
15
|
-
|
|
16
|
-
const result = await tx.getRepository(CheckItem).save({
|
|
17
|
-
...checkItem,
|
|
18
|
-
domain,
|
|
19
|
-
creator: user,
|
|
20
|
-
updater: user
|
|
21
|
-
})
|
|
22
|
-
|
|
23
|
-
if (checkItem.thumbnail) {
|
|
24
|
-
await createAttachment(
|
|
25
|
-
null,
|
|
26
|
-
{
|
|
27
|
-
attachment: {
|
|
28
|
-
file: checkItem.thumbnail,
|
|
29
|
-
refType: CheckItem.name,
|
|
30
|
-
refBy: result.id
|
|
31
|
-
}
|
|
32
|
-
},
|
|
33
|
-
context
|
|
34
|
-
)
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
return result
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
@Directive('@transaction')
|
|
41
|
-
@Mutation(returns => CheckItem, { description: 'To modify CheckItem information' })
|
|
42
|
-
async updateCheckItem(
|
|
43
|
-
@Arg('id') id: string,
|
|
44
|
-
@Arg('patch') patch: CheckItemPatch,
|
|
45
|
-
@Ctx() context: ResolverContext
|
|
46
|
-
): Promise<CheckItem> {
|
|
47
|
-
const { domain, user, tx } = context.state
|
|
48
|
-
|
|
49
|
-
const repository = tx.getRepository(CheckItem)
|
|
50
|
-
const checkItem = await repository.findOne({
|
|
51
|
-
where: { domain: { id: domain.id }, id }
|
|
52
|
-
})
|
|
53
|
-
|
|
54
|
-
const result = await repository.save({
|
|
55
|
-
...checkItem,
|
|
56
|
-
...patch,
|
|
57
|
-
updater: user
|
|
58
|
-
})
|
|
59
|
-
|
|
60
|
-
if (patch.thumbnail) {
|
|
61
|
-
await deleteAttachmentsByRef(null, { refBys: [result.id] }, context)
|
|
62
|
-
await createAttachment(
|
|
63
|
-
null,
|
|
64
|
-
{
|
|
65
|
-
attachment: {
|
|
66
|
-
file: patch.thumbnail,
|
|
67
|
-
refType: CheckItem.name,
|
|
68
|
-
refBy: result.id
|
|
69
|
-
}
|
|
70
|
-
},
|
|
71
|
-
context
|
|
72
|
-
)
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
return result
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
@Directive('@transaction')
|
|
79
|
-
@Mutation(returns => [CheckItem], { description: "To modify multiple CheckItems' information" })
|
|
80
|
-
async updateMultipleCheckItem(
|
|
81
|
-
@Arg('patches', type => [CheckItemPatch]) patches: CheckItemPatch[],
|
|
82
|
-
@Ctx() context: ResolverContext
|
|
83
|
-
): Promise<CheckItem[]> {
|
|
84
|
-
const { domain, user, tx } = context.state
|
|
85
|
-
|
|
86
|
-
let results = []
|
|
87
|
-
const _createRecords = patches.filter((patch: any) => patch.cuFlag.toUpperCase() === '+')
|
|
88
|
-
const _updateRecords = patches.filter((patch: any) => patch.cuFlag.toUpperCase() === 'M')
|
|
89
|
-
const checkItemRepo = tx.getRepository(CheckItem)
|
|
90
|
-
|
|
91
|
-
if (_createRecords.length > 0) {
|
|
92
|
-
for (let i = 0; i < _createRecords.length; i++) {
|
|
93
|
-
const newRecord = _createRecords[i]
|
|
94
|
-
|
|
95
|
-
const result = await checkItemRepo.save({
|
|
96
|
-
...newRecord,
|
|
97
|
-
domain,
|
|
98
|
-
creator: user,
|
|
99
|
-
updater: user
|
|
100
|
-
})
|
|
101
|
-
|
|
102
|
-
if (newRecord.thumbnail) {
|
|
103
|
-
await createAttachment(
|
|
104
|
-
null,
|
|
105
|
-
{
|
|
106
|
-
attachment: {
|
|
107
|
-
file: newRecord.thumbnail,
|
|
108
|
-
refType: CheckItem.name,
|
|
109
|
-
refBy: result.id
|
|
110
|
-
}
|
|
111
|
-
},
|
|
112
|
-
context
|
|
113
|
-
)
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
results.push({ ...result, cuFlag: '+' })
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
if (_updateRecords.length > 0) {
|
|
121
|
-
for (let i = 0; i < _updateRecords.length; i++) {
|
|
122
|
-
const updateRecord = _updateRecords[i]
|
|
123
|
-
const checkItem = await checkItemRepo.findOneBy({ id: updateRecord.id })
|
|
124
|
-
|
|
125
|
-
const result = await checkItemRepo.save({
|
|
126
|
-
...checkItem,
|
|
127
|
-
...updateRecord,
|
|
128
|
-
updater: user
|
|
129
|
-
})
|
|
130
|
-
|
|
131
|
-
if (updateRecord.thumbnail) {
|
|
132
|
-
await deleteAttachmentsByRef(null, { refBys: [result.id] }, context)
|
|
133
|
-
await createAttachment(
|
|
134
|
-
null,
|
|
135
|
-
{
|
|
136
|
-
attachment: {
|
|
137
|
-
file: updateRecord.thumbnail,
|
|
138
|
-
refType: CheckItem.name,
|
|
139
|
-
refBy: result.id
|
|
140
|
-
}
|
|
141
|
-
},
|
|
142
|
-
context
|
|
143
|
-
)
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
results.push({ ...result, cuFlag: 'M' })
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
return results
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
@Directive('@transaction')
|
|
154
|
-
@Mutation(returns => Boolean, { description: 'To delete CheckItem' })
|
|
155
|
-
async deleteCheckItem(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<boolean> {
|
|
156
|
-
const { domain, tx } = context.state
|
|
157
|
-
|
|
158
|
-
await tx.getRepository(CheckItem).delete({ domain: { id: domain.id }, id })
|
|
159
|
-
await deleteAttachmentsByRef(null, { refBys: [id] }, context)
|
|
160
|
-
|
|
161
|
-
return true
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
@Directive('@transaction')
|
|
165
|
-
@Mutation(returns => Boolean, { description: 'To delete multiple CheckItems' })
|
|
166
|
-
async deleteCheckItems(
|
|
167
|
-
@Arg('ids', type => [String]) ids: string[],
|
|
168
|
-
@Ctx() context: ResolverContext
|
|
169
|
-
): Promise<boolean> {
|
|
170
|
-
const { domain, tx } = context.state
|
|
171
|
-
|
|
172
|
-
await tx.getRepository(CheckItem).delete({
|
|
173
|
-
domain: { id: domain.id },
|
|
174
|
-
id: In(ids)
|
|
175
|
-
})
|
|
176
|
-
|
|
177
|
-
await deleteAttachmentsByRef(null, { refBys: ids }, context)
|
|
178
|
-
|
|
179
|
-
return true
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
@Directive('@transaction')
|
|
183
|
-
@Mutation(returns => Boolean, { description: 'To import multiple CheckItems' })
|
|
184
|
-
async importCheckItems(
|
|
185
|
-
@Arg('checkItems', type => [CheckItemPatch]) checkItems: CheckItemPatch[],
|
|
186
|
-
@Ctx() context: ResolverContext
|
|
187
|
-
): Promise<boolean> {
|
|
188
|
-
const { domain, tx } = context.state
|
|
189
|
-
|
|
190
|
-
await Promise.all(
|
|
191
|
-
checkItems.map(async (checkItem: CheckItemPatch) => {
|
|
192
|
-
const createdCheckItem: CheckItem = await tx.getRepository(CheckItem).save({ domain, ...checkItem })
|
|
193
|
-
})
|
|
194
|
-
)
|
|
195
|
-
|
|
196
|
-
return true
|
|
197
|
-
}
|
|
198
|
-
}
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import { Resolver, Query, FieldResolver, Root, Args, Arg, Ctx, Directive } from 'type-graphql'
|
|
2
|
-
import { Attachment } from '@things-factory/attachment-base'
|
|
3
|
-
import { Domain, getQueryBuilderFromListParams, getRepository, ListParam } from '@things-factory/shell'
|
|
4
|
-
import { User } from '@things-factory/auth-base'
|
|
5
|
-
import { CheckItem } from './check-item'
|
|
6
|
-
import { CheckItemList } from './check-item-type'
|
|
7
|
-
|
|
8
|
-
@Resolver(CheckItem)
|
|
9
|
-
export class CheckItemQuery {
|
|
10
|
-
@Query(returns => CheckItem!, { nullable: true, description: 'To fetch a CheckItem' })
|
|
11
|
-
async checkItem(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<CheckItem> {
|
|
12
|
-
const { domain } = context.state
|
|
13
|
-
|
|
14
|
-
return await getRepository(CheckItem).findOne({
|
|
15
|
-
where: { domain: { id: domain.id }, id }
|
|
16
|
-
})
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
@Query(returns => CheckItemList, { description: 'To fetch multiple CheckItems' })
|
|
20
|
-
async checkItems(@Args() params: ListParam, @Ctx() context: ResolverContext): Promise<CheckItemList> {
|
|
21
|
-
const { domain } = context.state
|
|
22
|
-
|
|
23
|
-
const queryBuilder = getQueryBuilderFromListParams({
|
|
24
|
-
domain,
|
|
25
|
-
params,
|
|
26
|
-
repository: await getRepository(CheckItem),
|
|
27
|
-
searchables: ['name', 'description']
|
|
28
|
-
})
|
|
29
|
-
|
|
30
|
-
const [items, total] = await queryBuilder.getManyAndCount()
|
|
31
|
-
|
|
32
|
-
return { items, total }
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
@FieldResolver(type => String)
|
|
36
|
-
async thumbnail(@Root() checkItem: CheckItem): Promise<string | undefined> {
|
|
37
|
-
const attachment: Attachment = await getRepository(Attachment).findOne({
|
|
38
|
-
where: {
|
|
39
|
-
domain: { id: checkItem.domainId },
|
|
40
|
-
refType: CheckItem.name,
|
|
41
|
-
refBy: checkItem.id
|
|
42
|
-
}
|
|
43
|
-
})
|
|
44
|
-
|
|
45
|
-
return attachment?.fullpath
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
@FieldResolver(type => Domain)
|
|
49
|
-
async domain(@Root() checkItem: CheckItem): Promise<Domain> {
|
|
50
|
-
return await getRepository(Domain).findOneBy({ id: checkItem.domainId })
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
@FieldResolver(type => User)
|
|
54
|
-
async updater(@Root() checkItem: CheckItem): Promise<User> {
|
|
55
|
-
return await getRepository(User).findOneBy({ id: checkItem.updaterId })
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
@FieldResolver(type => User)
|
|
59
|
-
async creator(@Root() checkItem: CheckItem): Promise<User> {
|
|
60
|
-
return await getRepository(User).findOneBy({ id: checkItem.creatorId })
|
|
61
|
-
}
|
|
62
|
-
}
|