@things-factory/ops-master 10.0.18

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.
Files changed (181) hide show
  1. package/.dockerignore +31 -0
  2. package/dist-client/index.d.ts +1 -0
  3. package/dist-client/index.js +2 -0
  4. package/dist-client/index.js.map +1 -0
  5. package/dist-client/pages/master-axes.d.ts +33 -0
  6. package/dist-client/pages/master-axes.js +176 -0
  7. package/dist-client/pages/master-axes.js.map +1 -0
  8. package/dist-client/pages/master-list.d.ts +68 -0
  9. package/dist-client/pages/master-list.js +267 -0
  10. package/dist-client/pages/master-list.js.map +1 -0
  11. package/dist-client/route.d.ts +1 -0
  12. package/dist-client/route.js +8 -0
  13. package/dist-client/route.js.map +1 -0
  14. package/dist-client/tsconfig.tsbuildinfo +1 -0
  15. package/dist-server/index.d.ts +1 -0
  16. package/dist-server/index.js +5 -0
  17. package/dist-server/index.js.map +1 -0
  18. package/dist-server/service/asset/asset-lifecycle.d.ts +83 -0
  19. package/dist-server/service/asset/asset-lifecycle.js +99 -0
  20. package/dist-server/service/asset/asset-lifecycle.js.map +1 -0
  21. package/dist-server/service/asset/asset-master-resolver.d.ts +44 -0
  22. package/dist-server/service/asset/asset-master-resolver.js +140 -0
  23. package/dist-server/service/asset/asset-master-resolver.js.map +1 -0
  24. package/dist-server/service/asset/asset-master.d.ts +21 -0
  25. package/dist-server/service/asset/asset-master.js +25 -0
  26. package/dist-server/service/asset/asset-master.js.map +1 -0
  27. package/dist-server/service/asset/asset-query.d.ts +8 -0
  28. package/dist-server/service/asset/asset-query.js +50 -0
  29. package/dist-server/service/asset/asset-query.js.map +1 -0
  30. package/dist-server/service/asset/index.d.ts +6 -0
  31. package/dist-server/service/asset/index.js +10 -0
  32. package/dist-server/service/asset/index.js.map +1 -0
  33. package/dist-server/service/asset/physical-asset-class.d.ts +34 -0
  34. package/dist-server/service/asset/physical-asset-class.js +104 -0
  35. package/dist-server/service/asset/physical-asset-class.js.map +1 -0
  36. package/dist-server/service/asset/physical-asset.d.ts +53 -0
  37. package/dist-server/service/asset/physical-asset.js +123 -0
  38. package/dist-server/service/asset/physical-asset.js.map +1 -0
  39. package/dist-server/service/equipment/equipment-class.d.ts +34 -0
  40. package/dist-server/service/equipment/equipment-class.js +104 -0
  41. package/dist-server/service/equipment/equipment-class.js.map +1 -0
  42. package/dist-server/service/equipment/equipment-master-resolver.d.ts +60 -0
  43. package/dist-server/service/equipment/equipment-master-resolver.js +200 -0
  44. package/dist-server/service/equipment/equipment-master-resolver.js.map +1 -0
  45. package/dist-server/service/equipment/equipment-master.d.ts +29 -0
  46. package/dist-server/service/equipment/equipment-master.js +36 -0
  47. package/dist-server/service/equipment/equipment-master.js.map +1 -0
  48. package/dist-server/service/equipment/equipment-query.d.ts +8 -0
  49. package/dist-server/service/equipment/equipment-query.js +50 -0
  50. package/dist-server/service/equipment/equipment-query.js.map +1 -0
  51. package/dist-server/service/equipment/equipment.d.ts +45 -0
  52. package/dist-server/service/equipment/equipment.js +133 -0
  53. package/dist-server/service/equipment/equipment.js.map +1 -0
  54. package/dist-server/service/equipment/index.d.ts +8 -0
  55. package/dist-server/service/equipment/index.js +12 -0
  56. package/dist-server/service/equipment/index.js.map +1 -0
  57. package/dist-server/service/equipment/state-period-rules.d.ts +76 -0
  58. package/dist-server/service/equipment/state-period-rules.js +88 -0
  59. package/dist-server/service/equipment/state-period-rules.js.map +1 -0
  60. package/dist-server/service/equipment/stop-reason-query.d.ts +11 -0
  61. package/dist-server/service/equipment/stop-reason-query.js +39 -0
  62. package/dist-server/service/equipment/stop-reason-query.js.map +1 -0
  63. package/dist-server/service/equipment/stop-reason.d.ts +58 -0
  64. package/dist-server/service/equipment/stop-reason.js +114 -0
  65. package/dist-server/service/equipment/stop-reason.js.map +1 -0
  66. package/dist-server/service/index.d.ts +46 -0
  67. package/dist-server/service/index.js +80 -0
  68. package/dist-server/service/index.js.map +1 -0
  69. package/dist-server/service/location/index.d.ts +5 -0
  70. package/dist-server/service/location/index.js +9 -0
  71. package/dist-server/service/location/index.js.map +1 -0
  72. package/dist-server/service/location/location-master-resolver.d.ts +28 -0
  73. package/dist-server/service/location/location-master-resolver.js +80 -0
  74. package/dist-server/service/location/location-master-resolver.js.map +1 -0
  75. package/dist-server/service/location/location-master.d.ts +24 -0
  76. package/dist-server/service/location/location-master.js +27 -0
  77. package/dist-server/service/location/location-master.js.map +1 -0
  78. package/dist-server/service/location/location-query.d.ts +7 -0
  79. package/dist-server/service/location/location-query.js +41 -0
  80. package/dist-server/service/location/location-query.js.map +1 -0
  81. package/dist-server/service/location/operational-location.d.ts +52 -0
  82. package/dist-server/service/location/operational-location.js +132 -0
  83. package/dist-server/service/location/operational-location.js.map +1 -0
  84. package/dist-server/service/master-axis.d.ts +29 -0
  85. package/dist-server/service/master-axis.js +39 -0
  86. package/dist-server/service/master-axis.js.map +1 -0
  87. package/dist-server/service/master-crud.d.ts +44 -0
  88. package/dist-server/service/master-crud.js +73 -0
  89. package/dist-server/service/master-crud.js.map +1 -0
  90. package/dist-server/service/master-list.d.ts +12 -0
  91. package/dist-server/service/master-list.js +24 -0
  92. package/dist-server/service/master-list.js.map +1 -0
  93. package/dist-server/service/material/index.d.ts +6 -0
  94. package/dist-server/service/material/index.js +10 -0
  95. package/dist-server/service/material/index.js.map +1 -0
  96. package/dist-server/service/material/material-class.d.ts +34 -0
  97. package/dist-server/service/material/material-class.js +104 -0
  98. package/dist-server/service/material/material-class.js.map +1 -0
  99. package/dist-server/service/material/material-definition.d.ts +42 -0
  100. package/dist-server/service/material/material-definition.js +112 -0
  101. package/dist-server/service/material/material-definition.js.map +1 -0
  102. package/dist-server/service/material/material-master-resolver.d.ts +44 -0
  103. package/dist-server/service/material/material-master-resolver.js +140 -0
  104. package/dist-server/service/material/material-master-resolver.js.map +1 -0
  105. package/dist-server/service/material/material-master.d.ts +9 -0
  106. package/dist-server/service/material/material-master.js +24 -0
  107. package/dist-server/service/material/material-master.js.map +1 -0
  108. package/dist-server/service/material/material-query.d.ts +8 -0
  109. package/dist-server/service/material/material-query.js +50 -0
  110. package/dist-server/service/material/material-query.js.map +1 -0
  111. package/dist-server/service/operation/index.d.ts +5 -0
  112. package/dist-server/service/operation/index.js +9 -0
  113. package/dist-server/service/operation/index.js.map +1 -0
  114. package/dist-server/service/operation/operation-definition.d.ts +52 -0
  115. package/dist-server/service/operation/operation-definition.js +142 -0
  116. package/dist-server/service/operation/operation-definition.js.map +1 -0
  117. package/dist-server/service/operation/operation-master-resolver.d.ts +28 -0
  118. package/dist-server/service/operation/operation-master-resolver.js +80 -0
  119. package/dist-server/service/operation/operation-master-resolver.js.map +1 -0
  120. package/dist-server/service/operation/operation-master.d.ts +21 -0
  121. package/dist-server/service/operation/operation-master.js +28 -0
  122. package/dist-server/service/operation/operation-master.js.map +1 -0
  123. package/dist-server/service/operation/operation-query.d.ts +7 -0
  124. package/dist-server/service/operation/operation-query.js +41 -0
  125. package/dist-server/service/operation/operation-query.js.map +1 -0
  126. package/dist-server/service/personnel/index.d.ts +6 -0
  127. package/dist-server/service/personnel/index.js +10 -0
  128. package/dist-server/service/personnel/index.js.map +1 -0
  129. package/dist-server/service/personnel/person.d.ts +51 -0
  130. package/dist-server/service/personnel/person.js +119 -0
  131. package/dist-server/service/personnel/person.js.map +1 -0
  132. package/dist-server/service/personnel/personnel-class.d.ts +54 -0
  133. package/dist-server/service/personnel/personnel-class.js +114 -0
  134. package/dist-server/service/personnel/personnel-class.js.map +1 -0
  135. package/dist-server/service/personnel/personnel-master-resolver.d.ts +44 -0
  136. package/dist-server/service/personnel/personnel-master-resolver.js +140 -0
  137. package/dist-server/service/personnel/personnel-master-resolver.js.map +1 -0
  138. package/dist-server/service/personnel/personnel-master.d.ts +39 -0
  139. package/dist-server/service/personnel/personnel-master.js +34 -0
  140. package/dist-server/service/personnel/personnel-master.js.map +1 -0
  141. package/dist-server/service/personnel/personnel-query.d.ts +21 -0
  142. package/dist-server/service/personnel/personnel-query.js +57 -0
  143. package/dist-server/service/personnel/personnel-query.js.map +1 -0
  144. package/dist-server/service/personnel/qualification.d.ts +97 -0
  145. package/dist-server/service/personnel/qualification.js +122 -0
  146. package/dist-server/service/personnel/qualification.js.map +1 -0
  147. package/dist-server/service/resource/resource-class.d.ts +25 -0
  148. package/dist-server/service/resource/resource-class.js +29 -0
  149. package/dist-server/service/resource/resource-class.js.map +1 -0
  150. package/dist-server/service/status/axis-stamp.d.ts +16 -0
  151. package/dist-server/service/status/axis-stamp.js +22 -0
  152. package/dist-server/service/status/axis-stamp.js.map +1 -0
  153. package/dist-server/service/status/index.d.ts +3 -0
  154. package/dist-server/service/status/index.js +7 -0
  155. package/dist-server/service/status/index.js.map +1 -0
  156. package/dist-server/service/status/master-status.d.ts +45 -0
  157. package/dist-server/service/status/master-status.js +129 -0
  158. package/dist-server/service/status/master-status.js.map +1 -0
  159. package/dist-server/service/test-spec/index.d.ts +5 -0
  160. package/dist-server/service/test-spec/index.js +9 -0
  161. package/dist-server/service/test-spec/index.js.map +1 -0
  162. package/dist-server/service/test-spec/test-spec-master-resolver.d.ts +28 -0
  163. package/dist-server/service/test-spec/test-spec-master-resolver.js +80 -0
  164. package/dist-server/service/test-spec/test-spec-master-resolver.js.map +1 -0
  165. package/dist-server/service/test-spec/test-spec-master.d.ts +6 -0
  166. package/dist-server/service/test-spec/test-spec-master.js +18 -0
  167. package/dist-server/service/test-spec/test-spec-master.js.map +1 -0
  168. package/dist-server/service/test-spec/test-spec-query.d.ts +7 -0
  169. package/dist-server/service/test-spec/test-spec-query.js +41 -0
  170. package/dist-server/service/test-spec/test-spec-query.js.map +1 -0
  171. package/dist-server/service/test-spec/test-specification.d.ts +41 -0
  172. package/dist-server/service/test-spec/test-specification.js +106 -0
  173. package/dist-server/service/test-spec/test-specification.js.map +1 -0
  174. package/dist-server/tsconfig.tsbuildinfo +1 -0
  175. package/package.json +50 -0
  176. package/things-factory.config.js +12 -0
  177. package/translations/en.json +53 -0
  178. package/translations/ja.json +1 -0
  179. package/translations/ko.json +53 -0
  180. package/translations/ms.json +1 -0
  181. package/translations/zh.json +1 -0
@@ -0,0 +1,53 @@
1
+ import { Domain } from '@things-factory/shell';
2
+ import { User } from '@things-factory/auth-base';
3
+ /**
4
+ * 물리 자산 — **ISA-95 `PhysicalAsset`**.
5
+ *
6
+ * 반복해서 쓰는 물건이다(팔레트 · 랙 · 지그). 설비와 나눠 두는 이유는 사는 방식이 다르기 때문이다 —
7
+ * 설비는 고장 나고 가동률로 평가받지만, 자산은 **돌아온다.** 한 그릇에 담으면 한쪽의 어휘가 다른 쪽에
8
+ * 붙어 둘 다 거짓이 된다.
9
+ */
10
+ export declare class PhysicalAsset {
11
+ readonly id: string;
12
+ domain?: Domain;
13
+ domainId?: string;
14
+ /** 표준 `PhysicalAssetID` — 트윈으로 나갈 때 `assets[].id` 가 된다. */
15
+ name: string;
16
+ description?: string;
17
+ /**
18
+ * 속한 등급들 — 표준 `PhysicalAssetClassID`(복수).
19
+ *
20
+ * 복수인 이유는 인원과 같다. 한 자산이 여러 등급에 들 수 있고, 하나만 담으면 한쪽 요구에서 보이지 않는다.
21
+ */
22
+ assetClassIds?: string[];
23
+ /** 이 자산이 주로 있는 자리 — 표준 `OperationalLocation`. */
24
+ homeLocation?: string;
25
+ /** GS1 GRAI. 없으면 비워 둔다 — 지어내지 않는다. */
26
+ identity?: string;
27
+ /**
28
+ * 정격 사용 횟수 — **표준 밖 확장이다.**
29
+ *
30
+ * ISA-95 는 자산의 수명을 세지 않는다(`PhysicalAssetProperty` 로 무엇이든 담으라고 한다). 그런데
31
+ * 속성에 두면 그 값을 **읽고 막는 코드**가 속성 배열을 뒤져야 하고, 오타 하나가 오류 보고 없이
32
+ * 「정격 없음」이 된다. 막는 데 쓰는 값은 칸으로 둔다.
33
+ *
34
+ * 선언하지 않으면 횟수로 막지 않는다 — 선언한 것만 걸린다.
35
+ */
36
+ cycleLimit?: number;
37
+ /** 개체 속성 — 표준 `PhysicalAssetProperty`. */
38
+ properties?: Record<string, unknown>[];
39
+ /** 이 자산에 요구되는 `TestSpecification` 참조들 — 검사 주기가 이 모양에 맞는다. */
40
+ testSpecificationIds?: string[];
41
+ /** `TestResult`. */
42
+ testResults?: Record<string, unknown>[];
43
+ /** 언제부터 — 표준 `EffectiveStartDate`. */
44
+ effectiveStart?: Date;
45
+ /** 언제까지 — 표준 `EffectiveEndDate`. 폐기한 자산이 계속 배정되지 않게 한다. */
46
+ effectiveEnd?: Date;
47
+ createdAt?: Date;
48
+ updatedAt?: Date;
49
+ creator?: User;
50
+ creatorId?: string;
51
+ updater?: User;
52
+ updaterId?: string;
53
+ }
@@ -0,0 +1,123 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PhysicalAsset = 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
+ /**
10
+ * 물리 자산 — **ISA-95 `PhysicalAsset`**.
11
+ *
12
+ * 반복해서 쓰는 물건이다(팔레트 · 랙 · 지그). 설비와 나눠 두는 이유는 사는 방식이 다르기 때문이다 —
13
+ * 설비는 고장 나고 가동률로 평가받지만, 자산은 **돌아온다.** 한 그릇에 담으면 한쪽의 어휘가 다른 쪽에
14
+ * 붙어 둘 다 거짓이 된다.
15
+ */
16
+ let PhysicalAsset = class PhysicalAsset {
17
+ };
18
+ exports.PhysicalAsset = PhysicalAsset;
19
+ tslib_1.__decorate([
20
+ (0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
21
+ (0, type_graphql_1.Field)(type => type_graphql_1.ID),
22
+ tslib_1.__metadata("design:type", String)
23
+ ], PhysicalAsset.prototype, "id", void 0);
24
+ tslib_1.__decorate([
25
+ (0, typeorm_1.ManyToOne)(type => shell_1.Domain),
26
+ (0, type_graphql_1.Field)(type => shell_1.Domain),
27
+ tslib_1.__metadata("design:type", shell_1.Domain)
28
+ ], PhysicalAsset.prototype, "domain", void 0);
29
+ tslib_1.__decorate([
30
+ (0, typeorm_1.RelationId)((asset) => asset.domain),
31
+ tslib_1.__metadata("design:type", String)
32
+ ], PhysicalAsset.prototype, "domainId", void 0);
33
+ tslib_1.__decorate([
34
+ (0, typeorm_1.Column)(),
35
+ (0, type_graphql_1.Field)(),
36
+ tslib_1.__metadata("design:type", String)
37
+ ], PhysicalAsset.prototype, "name", void 0);
38
+ tslib_1.__decorate([
39
+ (0, typeorm_1.Column)({ nullable: true }),
40
+ (0, type_graphql_1.Field)({ nullable: true }),
41
+ tslib_1.__metadata("design:type", String)
42
+ ], PhysicalAsset.prototype, "description", void 0);
43
+ tslib_1.__decorate([
44
+ (0, typeorm_1.Column)({ type: 'simple-json', nullable: true }),
45
+ (0, type_graphql_1.Field)(type => [String], { nullable: true }),
46
+ tslib_1.__metadata("design:type", Array)
47
+ ], PhysicalAsset.prototype, "assetClassIds", void 0);
48
+ tslib_1.__decorate([
49
+ (0, typeorm_1.Column)({ nullable: true }),
50
+ (0, type_graphql_1.Field)({ nullable: true }),
51
+ tslib_1.__metadata("design:type", String)
52
+ ], PhysicalAsset.prototype, "homeLocation", void 0);
53
+ tslib_1.__decorate([
54
+ (0, typeorm_1.Column)({ nullable: true }),
55
+ (0, type_graphql_1.Field)({ nullable: true }),
56
+ tslib_1.__metadata("design:type", String)
57
+ ], PhysicalAsset.prototype, "identity", void 0);
58
+ tslib_1.__decorate([
59
+ (0, typeorm_1.Column)({ type: 'int', nullable: true }),
60
+ (0, type_graphql_1.Field)(type => type_graphql_1.Int, { nullable: true, description: 'rated number of cycles before this asset must be replaced' }),
61
+ tslib_1.__metadata("design:type", Number)
62
+ ], PhysicalAsset.prototype, "cycleLimit", void 0);
63
+ tslib_1.__decorate([
64
+ (0, typeorm_1.Column)({ type: 'simple-json', nullable: true }),
65
+ (0, type_graphql_1.Field)(type => String, { nullable: true, description: 'ResourceProperty[] as JSON text' }),
66
+ tslib_1.__metadata("design:type", Array)
67
+ ], PhysicalAsset.prototype, "properties", void 0);
68
+ tslib_1.__decorate([
69
+ (0, typeorm_1.Column)({ type: 'simple-json', nullable: true }),
70
+ (0, type_graphql_1.Field)(type => [String], { nullable: true }),
71
+ tslib_1.__metadata("design:type", Array)
72
+ ], PhysicalAsset.prototype, "testSpecificationIds", void 0);
73
+ tslib_1.__decorate([
74
+ (0, typeorm_1.Column)({ type: 'simple-json', nullable: true }),
75
+ (0, type_graphql_1.Field)(type => String, { nullable: true, description: 'TestResult[] as JSON text' }),
76
+ tslib_1.__metadata("design:type", Array)
77
+ ], PhysicalAsset.prototype, "testResults", void 0);
78
+ tslib_1.__decorate([
79
+ (0, typeorm_1.Column)({ nullable: true }),
80
+ (0, type_graphql_1.Field)({ nullable: true }),
81
+ tslib_1.__metadata("design:type", Date
82
+ /** 언제까지 — 표준 `EffectiveEndDate`. 폐기한 자산이 계속 배정되지 않게 한다. */
83
+ )
84
+ ], PhysicalAsset.prototype, "effectiveStart", void 0);
85
+ tslib_1.__decorate([
86
+ (0, typeorm_1.Column)({ nullable: true }),
87
+ (0, type_graphql_1.Field)({ nullable: true }),
88
+ tslib_1.__metadata("design:type", Date)
89
+ ], PhysicalAsset.prototype, "effectiveEnd", void 0);
90
+ tslib_1.__decorate([
91
+ (0, typeorm_1.CreateDateColumn)(),
92
+ (0, type_graphql_1.Field)({ nullable: true }),
93
+ tslib_1.__metadata("design:type", Date)
94
+ ], PhysicalAsset.prototype, "createdAt", void 0);
95
+ tslib_1.__decorate([
96
+ (0, typeorm_1.UpdateDateColumn)(),
97
+ (0, type_graphql_1.Field)({ nullable: true }),
98
+ tslib_1.__metadata("design:type", Date)
99
+ ], PhysicalAsset.prototype, "updatedAt", void 0);
100
+ tslib_1.__decorate([
101
+ (0, typeorm_1.ManyToOne)(type => auth_base_1.User, { nullable: true }),
102
+ (0, type_graphql_1.Field)(type => auth_base_1.User, { nullable: true }),
103
+ tslib_1.__metadata("design:type", auth_base_1.User)
104
+ ], PhysicalAsset.prototype, "creator", void 0);
105
+ tslib_1.__decorate([
106
+ (0, typeorm_1.RelationId)((asset) => asset.creator),
107
+ tslib_1.__metadata("design:type", String)
108
+ ], PhysicalAsset.prototype, "creatorId", void 0);
109
+ tslib_1.__decorate([
110
+ (0, typeorm_1.ManyToOne)(type => auth_base_1.User, { nullable: true }),
111
+ (0, type_graphql_1.Field)(type => auth_base_1.User, { nullable: true }),
112
+ tslib_1.__metadata("design:type", auth_base_1.User)
113
+ ], PhysicalAsset.prototype, "updater", void 0);
114
+ tslib_1.__decorate([
115
+ (0, typeorm_1.RelationId)((asset) => asset.updater),
116
+ tslib_1.__metadata("design:type", String)
117
+ ], PhysicalAsset.prototype, "updaterId", void 0);
118
+ exports.PhysicalAsset = PhysicalAsset = tslib_1.__decorate([
119
+ (0, typeorm_1.Entity)({ name: 'ops_physical_asset' }),
120
+ (0, typeorm_1.Index)('ix_ops_physical_asset_0', (asset) => [asset.domain, asset.name], { unique: true }),
121
+ (0, type_graphql_1.ObjectType)({ description: 'ISA-95 PhysicalAsset — a reusable asset such as a pallet or rack' })
122
+ ], PhysicalAsset);
123
+ //# sourceMappingURL=physical-asset.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"physical-asset.js","sourceRoot":"","sources":["../../../server/service/asset/physical-asset.ts"],"names":[],"mappings":";;;;AAAA,qCASgB;AAChB,+CAAyD;AAEzD,iDAA8C;AAC9C,yDAAgD;AAEhD;;;;;;GAMG;AAII,IAAM,aAAa,GAAnB,MAAM,aAAa;CAmGzB,CAAA;AAnGY,sCAAa;AAGf;IAFR,IAAA,gCAAsB,EAAC,MAAM,CAAC;IAC9B,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,iBAAE,CAAC;;yCACC;AAInB;IAFC,IAAA,mBAAS,EAAC,IAAI,CAAC,EAAE,CAAC,cAAM,CAAC;IACzB,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,cAAM,CAAC;sCACb,cAAM;6CAAA;AAGf;I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AAA;AAGd;IADC,IAAA,oBAAU,EAAC,CAAC,KAAoB,EAAE,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC;;gDAClC;AAIlB;IAFC,IAAA,mBAAS,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IAC3C,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;sCAC9B,gBAAI;8CAAA;AAGd;IADC,IAAA,oBAAU,EAAC,CAAC,KAAoB,EAAE,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC;;gDAClC;wBAlGP,aAAa;IAHzB,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,oBAAoB,EAAE,CAAC;IACtC,IAAA,eAAK,EAAC,yBAAyB,EAAE,CAAC,KAAoB,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,IAAI,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;IACxG,IAAA,yBAAU,EAAC,EAAE,WAAW,EAAE,kEAAkE,EAAE,CAAC;GACnF,aAAa,CAmGzB","sourcesContent":["import {\n Column,\n CreateDateColumn,\n Entity,\n Index,\n ManyToOne,\n PrimaryGeneratedColumn,\n RelationId,\n UpdateDateColumn\n} from 'typeorm'\nimport { Field, ID, Int, ObjectType } from 'type-graphql'\n\nimport { Domain } from '@things-factory/shell'\nimport { User } from '@things-factory/auth-base'\n\n/**\n * 물리 자산 — **ISA-95 `PhysicalAsset`**.\n *\n * 반복해서 쓰는 물건이다(팔레트 · 랙 · 지그). 설비와 나눠 두는 이유는 사는 방식이 다르기 때문이다 —\n * 설비는 고장 나고 가동률로 평가받지만, 자산은 **돌아온다.** 한 그릇에 담으면 한쪽의 어휘가 다른 쪽에\n * 붙어 둘 다 거짓이 된다.\n */\n@Entity({ name: 'ops_physical_asset' })\n@Index('ix_ops_physical_asset_0', (asset: PhysicalAsset) => [asset.domain, asset.name], { unique: true })\n@ObjectType({ description: 'ISA-95 PhysicalAsset — a reusable asset such as a pallet or rack' })\nexport class PhysicalAsset {\n @PrimaryGeneratedColumn('uuid')\n @Field(type => ID)\n readonly id: string\n\n @ManyToOne(type => Domain)\n @Field(type => Domain)\n domain?: Domain\n\n @RelationId((asset: PhysicalAsset) => asset.domain)\n domainId?: string\n\n /** 표준 `PhysicalAssetID` — 트윈으로 나갈 때 `assets[].id` 가 된다. */\n @Column()\n @Field()\n name: string\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n description?: string\n\n /**\n * 속한 등급들 — 표준 `PhysicalAssetClassID`(복수).\n *\n * 복수인 이유는 인원과 같다. 한 자산이 여러 등급에 들 수 있고, 하나만 담으면 한쪽 요구에서 보이지 않는다.\n */\n @Column({ type: 'simple-json', nullable: true })\n @Field(type => [String], { nullable: true })\n assetClassIds?: string[]\n\n /** 이 자산이 주로 있는 자리 — 표준 `OperationalLocation`. */\n @Column({ nullable: true })\n @Field({ nullable: true })\n homeLocation?: string\n\n /** GS1 GRAI. 없으면 비워 둔다 — 지어내지 않는다. */\n @Column({ nullable: true })\n @Field({ nullable: true })\n identity?: string\n\n /**\n * 정격 사용 횟수 — **표준 밖 확장이다.**\n *\n * ISA-95 는 자산의 수명을 세지 않는다(`PhysicalAssetProperty` 로 무엇이든 담으라고 한다). 그런데\n * 속성에 두면 그 값을 **읽고 막는 코드**가 속성 배열을 뒤져야 하고, 오타 하나가 오류 보고 없이\n * 「정격 없음」이 된다. 막는 데 쓰는 값은 칸으로 둔다.\n *\n * 선언하지 않으면 횟수로 막지 않는다 — 선언한 것만 걸린다.\n */\n @Column({ type: 'int', nullable: true })\n @Field(type => Int, { nullable: true, description: 'rated number of cycles before this asset must be replaced' })\n cycleLimit?: number\n\n /** 개체 속성 — 표준 `PhysicalAssetProperty`. */\n @Column({ type: 'simple-json', nullable: true })\n @Field(type => String, { nullable: true, description: 'ResourceProperty[] as JSON text' })\n properties?: Record<string, unknown>[]\n\n /** 이 자산에 요구되는 `TestSpecification` 참조들 — 검사 주기가 이 모양에 맞는다. */\n @Column({ type: 'simple-json', nullable: true })\n @Field(type => [String], { nullable: true })\n testSpecificationIds?: string[]\n\n /** `TestResult`. */\n @Column({ type: 'simple-json', nullable: true })\n @Field(type => String, { nullable: true, description: 'TestResult[] as JSON text' })\n testResults?: Record<string, unknown>[]\n\n /** 언제부터 — 표준 `EffectiveStartDate`. */\n @Column({ nullable: true })\n @Field({ nullable: true })\n effectiveStart?: Date\n\n /** 언제까지 — 표준 `EffectiveEndDate`. 폐기한 자산이 계속 배정되지 않게 한다. */\n @Column({ nullable: true })\n @Field({ nullable: true })\n effectiveEnd?: Date\n\n @CreateDateColumn()\n @Field({ nullable: true })\n createdAt?: Date\n\n @UpdateDateColumn()\n @Field({ nullable: true })\n updatedAt?: Date\n\n @ManyToOne(type => User, { nullable: true })\n @Field(type => User, { nullable: true })\n creator?: User\n\n @RelationId((asset: PhysicalAsset) => asset.creator)\n creatorId?: string\n\n @ManyToOne(type => User, { nullable: true })\n @Field(type => User, { nullable: true })\n updater?: User\n\n @RelationId((asset: PhysicalAsset) => asset.updater)\n updaterId?: string\n}\n"]}
@@ -0,0 +1,34 @@
1
+ import { Domain } from '@things-factory/shell';
2
+ import { User } from '@things-factory/auth-base';
3
+ /**
4
+ * 설비 등급 — **ISA-95 `EquipmentClass`**.
5
+ *
6
+ * 공정은 특정 설비를 지목하지 않고 등급으로 요구한다 — 「용접기 1대」. 등급이 없으면 그 요구를 적을 수
7
+ * 없고, 대체 설비를 찾을 수도 없다.
8
+ *
9
+ * 구조는 인원 등급과 같다(표준이 셋을 같은 모양으로 정의한다). 옮기는 함수도 같은 것을 쓴다.
10
+ */
11
+ export declare class EquipmentClass {
12
+ readonly id: string;
13
+ domain?: Domain;
14
+ domainId?: string;
15
+ /** 표준 `EquipmentClassID`. */
16
+ name: string;
17
+ description?: string;
18
+ /** 상위 등급들 — 표준 `EquipmentClassBaseID`(복수). 「6축 용접기」가 「용접기」를 상속한다. */
19
+ baseIds?: string[];
20
+ /** 이 등급의 적격을 정하는 `TestSpecification` 참조들 — 표준 `TestSpecificationID`. */
21
+ testSpecificationIds?: string[];
22
+ /** 등급 속성 — 표준 `EquipmentClassProperty`. */
23
+ properties?: Record<string, unknown>[];
24
+ /** 언제부터 유효한가 — 표준 `EffectiveStartDate`. */
25
+ effectiveStart?: Date;
26
+ /** 언제까지 유효한가 — 표준 `EffectiveEndDate`. */
27
+ effectiveEnd?: Date;
28
+ createdAt?: Date;
29
+ updatedAt?: Date;
30
+ creator?: User;
31
+ creatorId?: string;
32
+ updater?: User;
33
+ updaterId?: string;
34
+ }
@@ -0,0 +1,104 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.EquipmentClass = 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
+ /**
10
+ * 설비 등급 — **ISA-95 `EquipmentClass`**.
11
+ *
12
+ * 공정은 특정 설비를 지목하지 않고 등급으로 요구한다 — 「용접기 1대」. 등급이 없으면 그 요구를 적을 수
13
+ * 없고, 대체 설비를 찾을 수도 없다.
14
+ *
15
+ * 구조는 인원 등급과 같다(표준이 셋을 같은 모양으로 정의한다). 옮기는 함수도 같은 것을 쓴다.
16
+ */
17
+ let EquipmentClass = class EquipmentClass {
18
+ };
19
+ exports.EquipmentClass = EquipmentClass;
20
+ tslib_1.__decorate([
21
+ (0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
22
+ (0, type_graphql_1.Field)(type => type_graphql_1.ID),
23
+ tslib_1.__metadata("design:type", String)
24
+ ], EquipmentClass.prototype, "id", void 0);
25
+ tslib_1.__decorate([
26
+ (0, typeorm_1.ManyToOne)(type => shell_1.Domain),
27
+ (0, type_graphql_1.Field)(type => shell_1.Domain),
28
+ tslib_1.__metadata("design:type", shell_1.Domain)
29
+ ], EquipmentClass.prototype, "domain", void 0);
30
+ tslib_1.__decorate([
31
+ (0, typeorm_1.RelationId)((klass) => klass.domain),
32
+ tslib_1.__metadata("design:type", String)
33
+ ], EquipmentClass.prototype, "domainId", void 0);
34
+ tslib_1.__decorate([
35
+ (0, typeorm_1.Column)(),
36
+ (0, type_graphql_1.Field)(),
37
+ tslib_1.__metadata("design:type", String)
38
+ ], EquipmentClass.prototype, "name", void 0);
39
+ tslib_1.__decorate([
40
+ (0, typeorm_1.Column)({ nullable: true }),
41
+ (0, type_graphql_1.Field)({ nullable: true }),
42
+ tslib_1.__metadata("design:type", String)
43
+ ], EquipmentClass.prototype, "description", void 0);
44
+ tslib_1.__decorate([
45
+ (0, typeorm_1.Column)({ type: 'simple-json', nullable: true }),
46
+ (0, type_graphql_1.Field)(type => [String], { nullable: true }),
47
+ tslib_1.__metadata("design:type", Array)
48
+ ], EquipmentClass.prototype, "baseIds", void 0);
49
+ tslib_1.__decorate([
50
+ (0, typeorm_1.Column)({ type: 'simple-json', nullable: true }),
51
+ (0, type_graphql_1.Field)(type => [String], { nullable: true }),
52
+ tslib_1.__metadata("design:type", Array)
53
+ ], EquipmentClass.prototype, "testSpecificationIds", void 0);
54
+ tslib_1.__decorate([
55
+ (0, typeorm_1.Column)({ type: 'simple-json', nullable: true }),
56
+ (0, type_graphql_1.Field)(type => String, { nullable: true, description: 'ResourceProperty[] as JSON text' }),
57
+ tslib_1.__metadata("design:type", Array)
58
+ ], EquipmentClass.prototype, "properties", void 0);
59
+ tslib_1.__decorate([
60
+ (0, typeorm_1.Column)({ nullable: true }),
61
+ (0, type_graphql_1.Field)({ nullable: true }),
62
+ tslib_1.__metadata("design:type", Date
63
+ /** 언제까지 유효한가 — 표준 `EffectiveEndDate`. */
64
+ )
65
+ ], EquipmentClass.prototype, "effectiveStart", void 0);
66
+ tslib_1.__decorate([
67
+ (0, typeorm_1.Column)({ nullable: true }),
68
+ (0, type_graphql_1.Field)({ nullable: true }),
69
+ tslib_1.__metadata("design:type", Date)
70
+ ], EquipmentClass.prototype, "effectiveEnd", 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
+ ], EquipmentClass.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
+ ], EquipmentClass.prototype, "updatedAt", void 0);
81
+ tslib_1.__decorate([
82
+ (0, typeorm_1.ManyToOne)(type => auth_base_1.User, { nullable: true }),
83
+ (0, type_graphql_1.Field)(type => auth_base_1.User, { nullable: true }),
84
+ tslib_1.__metadata("design:type", auth_base_1.User)
85
+ ], EquipmentClass.prototype, "creator", void 0);
86
+ tslib_1.__decorate([
87
+ (0, typeorm_1.RelationId)((klass) => klass.creator),
88
+ tslib_1.__metadata("design:type", String)
89
+ ], EquipmentClass.prototype, "creatorId", void 0);
90
+ tslib_1.__decorate([
91
+ (0, typeorm_1.ManyToOne)(type => auth_base_1.User, { nullable: true }),
92
+ (0, type_graphql_1.Field)(type => auth_base_1.User, { nullable: true }),
93
+ tslib_1.__metadata("design:type", auth_base_1.User)
94
+ ], EquipmentClass.prototype, "updater", void 0);
95
+ tslib_1.__decorate([
96
+ (0, typeorm_1.RelationId)((klass) => klass.updater),
97
+ tslib_1.__metadata("design:type", String)
98
+ ], EquipmentClass.prototype, "updaterId", void 0);
99
+ exports.EquipmentClass = EquipmentClass = tslib_1.__decorate([
100
+ (0, typeorm_1.Entity)({ name: 'ops_equipment_class' }),
101
+ (0, typeorm_1.Index)('ix_ops_equipment_class_0', (klass) => [klass.domain, klass.name], { unique: true }),
102
+ (0, type_graphql_1.ObjectType)({ description: 'ISA-95 EquipmentClass — a kind of equipment that operations require' })
103
+ ], EquipmentClass);
104
+ //# sourceMappingURL=equipment-class.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"equipment-class.js","sourceRoot":"","sources":["../../../server/service/equipment/equipment-class.ts"],"names":[],"mappings":";;;;AAAA,qCASgB;AAChB,+CAAoD;AAEpD,iDAA8C;AAC9C,yDAAgD;AAEhD;;;;;;;GAOG;AAII,IAAM,cAAc,GAApB,MAAM,cAAc;CAmE1B,CAAA;AAnEY,wCAAc;AAGhB;IAFR,IAAA,gCAAsB,EAAC,MAAM,CAAC;IAC9B,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,iBAAE,CAAC;;0CACC;AAInB;IAFC,IAAA,mBAAS,EAAC,IAAI,CAAC,EAAE,CAAC,cAAM,CAAC;IACzB,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,cAAM,CAAC;sCACb,cAAM;8CAAA;AAGf;IADC,IAAA,oBAAU,EAAC,CAAC,KAAqB,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC;;gDACnC;AAKjB;IAFC,IAAA,gBAAM,GAAE;IACR,IAAA,oBAAK,GAAE;;4CACI;AAIZ;IAFC,IAAA,gBAAM,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IAC1B,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;mDACN;AAKpB;IAFC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,aAAa,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IAC/C,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;+CAC1B;AAKlB;IAFC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,aAAa,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IAC/C,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,EAAE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E,IAAI,EAAE,CAAC;IAC3C,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;sCAC9B,gBAAI;+CAAA;AAGd;IADC,IAAA,oBAAU,EAAC,CAAC,KAAqB,EAAE,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC;;iDACnC;yBAlEP,cAAc;IAH1B,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,qBAAqB,EAAE,CAAC;IACvC,IAAA,eAAK,EAAC,0BAA0B,EAAE,CAAC,KAAqB,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,IAAI,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;IAC1G,IAAA,yBAAU,EAAC,EAAE,WAAW,EAAE,qEAAqE,EAAE,CAAC;GACtF,cAAc,CAmE1B","sourcesContent":["import {\n Column,\n CreateDateColumn,\n Entity,\n Index,\n ManyToOne,\n PrimaryGeneratedColumn,\n RelationId,\n UpdateDateColumn\n} from 'typeorm'\nimport { Field, ID, ObjectType } from 'type-graphql'\n\nimport { Domain } from '@things-factory/shell'\nimport { User } from '@things-factory/auth-base'\n\n/**\n * 설비 등급 — **ISA-95 `EquipmentClass`**.\n *\n * 공정은 특정 설비를 지목하지 않고 등급으로 요구한다 — 「용접기 1대」. 등급이 없으면 그 요구를 적을 수\n * 없고, 대체 설비를 찾을 수도 없다.\n *\n * 구조는 인원 등급과 같다(표준이 셋을 같은 모양으로 정의한다). 옮기는 함수도 같은 것을 쓴다.\n */\n@Entity({ name: 'ops_equipment_class' })\n@Index('ix_ops_equipment_class_0', (klass: EquipmentClass) => [klass.domain, klass.name], { unique: true })\n@ObjectType({ description: 'ISA-95 EquipmentClass — a kind of equipment that operations require' })\nexport class EquipmentClass {\n @PrimaryGeneratedColumn('uuid')\n @Field(type => ID)\n readonly id: string\n\n @ManyToOne(type => Domain)\n @Field(type => Domain)\n domain?: Domain\n\n @RelationId((klass: EquipmentClass) => klass.domain)\n domainId?: string\n\n /** 표준 `EquipmentClassID`. */\n @Column()\n @Field()\n name: string\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n description?: string\n\n /** 상위 등급들 — 표준 `EquipmentClassBaseID`(복수). 「6축 용접기」가 「용접기」를 상속한다. */\n @Column({ type: 'simple-json', nullable: true })\n @Field(type => [String], { nullable: true })\n baseIds?: string[]\n\n /** 이 등급의 적격을 정하는 `TestSpecification` 참조들 — 표준 `TestSpecificationID`. */\n @Column({ type: 'simple-json', nullable: true })\n @Field(type => [String], { nullable: true })\n testSpecificationIds?: string[]\n\n /** 등급 속성 — 표준 `EquipmentClassProperty`. */\n @Column({ type: 'simple-json', nullable: true })\n @Field(type => String, { nullable: true, description: 'ResourceProperty[] as JSON text' })\n properties?: Record<string, unknown>[]\n\n /** 언제부터 유효한가 — 표준 `EffectiveStartDate`. */\n @Column({ nullable: true })\n @Field({ nullable: true })\n effectiveStart?: Date\n\n /** 언제까지 유효한가 — 표준 `EffectiveEndDate`. */\n @Column({ nullable: true })\n @Field({ nullable: true })\n effectiveEnd?: Date\n\n @CreateDateColumn()\n @Field({ nullable: true })\n createdAt?: Date\n\n @UpdateDateColumn()\n @Field({ nullable: true })\n updatedAt?: Date\n\n @ManyToOne(type => User, { nullable: true })\n @Field(type => User, { nullable: true })\n creator?: User\n\n @RelationId((klass: EquipmentClass) => klass.creator)\n creatorId?: string\n\n @ManyToOne(type => User, { nullable: true })\n @Field(type => User, { nullable: true })\n updater?: User\n\n @RelationId((klass: EquipmentClass) => klass.updater)\n updaterId?: string\n}\n"]}
@@ -0,0 +1,60 @@
1
+ import { ListParam } from '@things-factory/shell';
2
+ import { MasterPatch } from '../master-crud';
3
+ import { EquipmentClass } from './equipment-class';
4
+ import { Equipment } from './equipment';
5
+ import { StopReason } from './stop-reason';
6
+ /**
7
+ * 설비 축을 채우고 고친다.
8
+ *
9
+ * ── 왜 마스터는 그리드에서 고칠 수 있나 ────────────────────────────────────
10
+ * 업무 기록과 달리 마스터는 **선언**이다. 「이 사람이 용접 자격을 갖는다」는 일어난 일이 아니라 지금의
11
+ * 규정이고, 규정은 바뀐다. 없앨 때 행을 지우지 않고 유효 기간의 끝을 채우는 것이 그래서다 —
12
+ * 지우면 그것을 가리키는 지난 기록이 가리킬 것을 잃는다.
13
+ *
14
+ * 규칙은 `master-crud.ts` 한 곳에 있다. 여기는 축의 이름만 붙인다.
15
+ */
16
+ export declare class EquipmentClassList {
17
+ items: EquipmentClass[];
18
+ total: number;
19
+ }
20
+ export declare class EquipmentClassResolver {
21
+ equipmentClasses(params: ListParam, context: ResolverContext): Promise<EquipmentClassList>;
22
+ /**
23
+ * 그리드가 보낸 변경을 한 번에 적용한다.
24
+ *
25
+ * 패치를 `ScalarObject` 로 받는다 — 축마다 입력 타입을 따로 만들면 칸을 하나 더할 때마다 두 곳을
26
+ * 고쳐야 하고, 한쪽을 빠뜨리면 그 칸이 오류 보고 없이 저장되지 않는다. 돌려주는 것은 타입이 있는
27
+ * 엔티티라 무엇이 저장됐는지 스키마로 확인할 수 있다.
28
+ */
29
+ updateMultipleEquipmentClass(patches: MasterPatch[], context: ResolverContext): Promise<EquipmentClass[]>;
30
+ }
31
+ export declare class EquipmentList {
32
+ items: Equipment[];
33
+ total: number;
34
+ }
35
+ export declare class EquipmentResolver {
36
+ equipmentList(params: ListParam, context: ResolverContext): Promise<EquipmentList>;
37
+ /**
38
+ * 그리드가 보낸 변경을 한 번에 적용한다.
39
+ *
40
+ * 패치를 `ScalarObject` 로 받는다 — 축마다 입력 타입을 따로 만들면 칸을 하나 더할 때마다 두 곳을
41
+ * 고쳐야 하고, 한쪽을 빠뜨리면 그 칸이 오류 보고 없이 저장되지 않는다. 돌려주는 것은 타입이 있는
42
+ * 엔티티라 무엇이 저장됐는지 스키마로 확인할 수 있다.
43
+ */
44
+ updateMultipleEquipment(patches: MasterPatch[], context: ResolverContext): Promise<Equipment[]>;
45
+ }
46
+ export declare class StopReasonList {
47
+ items: StopReason[];
48
+ total: number;
49
+ }
50
+ export declare class StopReasonResolver {
51
+ stopReasonList(params: ListParam, context: ResolverContext): Promise<StopReasonList>;
52
+ /**
53
+ * 그리드가 보낸 변경을 한 번에 적용한다.
54
+ *
55
+ * 패치를 `ScalarObject` 로 받는다 — 축마다 입력 타입을 따로 만들면 칸을 하나 더할 때마다 두 곳을
56
+ * 고쳐야 하고, 한쪽을 빠뜨리면 그 칸이 오류 보고 없이 저장되지 않는다. 돌려주는 것은 타입이 있는
57
+ * 엔티티라 무엇이 저장됐는지 스키마로 확인할 수 있다.
58
+ */
59
+ updateMultipleStopReason(patches: MasterPatch[], context: ResolverContext): Promise<StopReason[]>;
60
+ }
@@ -0,0 +1,200 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.StopReasonResolver = exports.StopReasonList = exports.EquipmentResolver = exports.EquipmentList = exports.EquipmentClassResolver = exports.EquipmentClassList = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const type_graphql_1 = require("type-graphql");
6
+ const shell_1 = require("@things-factory/shell");
7
+ const master_crud_1 = require("../master-crud");
8
+ const master_axis_1 = require("../master-axis");
9
+ const master_list_1 = require("../master-list");
10
+ const equipment_class_1 = require("./equipment-class");
11
+ const equipment_1 = require("./equipment");
12
+ const stop_reason_1 = require("./stop-reason");
13
+ /**
14
+ * 설비 축을 채우고 고친다.
15
+ *
16
+ * ── 왜 마스터는 그리드에서 고칠 수 있나 ────────────────────────────────────
17
+ * 업무 기록과 달리 마스터는 **선언**이다. 「이 사람이 용접 자격을 갖는다」는 일어난 일이 아니라 지금의
18
+ * 규정이고, 규정은 바뀐다. 없앨 때 행을 지우지 않고 유효 기간의 끝을 채우는 것이 그래서다 —
19
+ * 지우면 그것을 가리키는 지난 기록이 가리킬 것을 잃는다.
20
+ *
21
+ * 규칙은 `master-crud.ts` 한 곳에 있다. 여기는 축의 이름만 붙인다.
22
+ */
23
+ let EquipmentClassList = class EquipmentClassList {
24
+ };
25
+ exports.EquipmentClassList = EquipmentClassList;
26
+ tslib_1.__decorate([
27
+ (0, type_graphql_1.Field)(type => [equipment_class_1.EquipmentClass]),
28
+ tslib_1.__metadata("design:type", Array)
29
+ ], EquipmentClassList.prototype, "items", void 0);
30
+ tslib_1.__decorate([
31
+ (0, type_graphql_1.Field)(type => type_graphql_1.Int),
32
+ tslib_1.__metadata("design:type", Number)
33
+ ], EquipmentClassList.prototype, "total", void 0);
34
+ exports.EquipmentClassList = EquipmentClassList = tslib_1.__decorate([
35
+ (0, type_graphql_1.ObjectType)({ description: 'A page of equipment classes' })
36
+ ], EquipmentClassList);
37
+ let EquipmentClassResolver = class EquipmentClassResolver {
38
+ async equipmentClasses(params, context) {
39
+ const { domain } = context.state;
40
+ const { items, total } = await (0, master_list_1.listMaster)('equipmentClass', params, domain);
41
+ return { items: items, total };
42
+ }
43
+ /**
44
+ * 그리드가 보낸 변경을 한 번에 적용한다.
45
+ *
46
+ * 패치를 `ScalarObject` 로 받는다 — 축마다 입력 타입을 따로 만들면 칸을 하나 더할 때마다 두 곳을
47
+ * 고쳐야 하고, 한쪽을 빠뜨리면 그 칸이 오류 보고 없이 저장되지 않는다. 돌려주는 것은 타입이 있는
48
+ * 엔티티라 무엇이 저장됐는지 스키마로 확인할 수 있다.
49
+ */
50
+ async updateMultipleEquipmentClass(patches, context) {
51
+ const { domain, user, tx } = context.state;
52
+ const axis = (0, master_axis_1.masterAxisOf)('equipmentClass');
53
+ const saved = await (0, master_crud_1.saveMasterPatches)(tx, domain, axis.entity, patches, user, {
54
+ hasEffectivePeriod: axis.hasEffectivePeriod
55
+ });
56
+ return saved;
57
+ }
58
+ };
59
+ exports.EquipmentClassResolver = EquipmentClassResolver;
60
+ tslib_1.__decorate([
61
+ (0, type_graphql_1.Directive)('@privilege(category: "ops-master", privilege: "query", domainOwnerGranted: true)'),
62
+ (0, type_graphql_1.Query)(returns => EquipmentClassList, { description: 'To fetch equipment classes' }),
63
+ tslib_1.__param(0, (0, type_graphql_1.Args)(type => shell_1.ListParam)),
64
+ tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
65
+ tslib_1.__metadata("design:type", Function),
66
+ tslib_1.__metadata("design:paramtypes", [shell_1.ListParam, Object]),
67
+ tslib_1.__metadata("design:returntype", Promise)
68
+ ], EquipmentClassResolver.prototype, "equipmentClasses", null);
69
+ tslib_1.__decorate([
70
+ (0, type_graphql_1.Directive)('@privilege(category: "ops-master", privilege: "mutation", domainOwnerGranted: true)'),
71
+ (0, type_graphql_1.Directive)('@transaction'),
72
+ (0, type_graphql_1.Mutation)(returns => [equipment_class_1.EquipmentClass], { description: 'To create, change or retire equipment classes' }),
73
+ tslib_1.__param(0, (0, type_graphql_1.Arg)('patches', type => [shell_1.ScalarObject])),
74
+ tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
75
+ tslib_1.__metadata("design:type", Function),
76
+ tslib_1.__metadata("design:paramtypes", [Array, Object]),
77
+ tslib_1.__metadata("design:returntype", Promise)
78
+ ], EquipmentClassResolver.prototype, "updateMultipleEquipmentClass", null);
79
+ exports.EquipmentClassResolver = EquipmentClassResolver = tslib_1.__decorate([
80
+ (0, type_graphql_1.Resolver)(equipment_class_1.EquipmentClass)
81
+ ], EquipmentClassResolver);
82
+ let EquipmentList = class EquipmentList {
83
+ };
84
+ exports.EquipmentList = EquipmentList;
85
+ tslib_1.__decorate([
86
+ (0, type_graphql_1.Field)(type => [equipment_1.Equipment]),
87
+ tslib_1.__metadata("design:type", Array)
88
+ ], EquipmentList.prototype, "items", void 0);
89
+ tslib_1.__decorate([
90
+ (0, type_graphql_1.Field)(type => type_graphql_1.Int),
91
+ tslib_1.__metadata("design:type", Number)
92
+ ], EquipmentList.prototype, "total", void 0);
93
+ exports.EquipmentList = EquipmentList = tslib_1.__decorate([
94
+ (0, type_graphql_1.ObjectType)({ description: 'A page of equipment' })
95
+ ], EquipmentList);
96
+ let EquipmentResolver = class EquipmentResolver {
97
+ async equipmentList(params, context) {
98
+ const { domain } = context.state;
99
+ const { items, total } = await (0, master_list_1.listMaster)('equipment', params, domain);
100
+ return { items: items, total };
101
+ }
102
+ /**
103
+ * 그리드가 보낸 변경을 한 번에 적용한다.
104
+ *
105
+ * 패치를 `ScalarObject` 로 받는다 — 축마다 입력 타입을 따로 만들면 칸을 하나 더할 때마다 두 곳을
106
+ * 고쳐야 하고, 한쪽을 빠뜨리면 그 칸이 오류 보고 없이 저장되지 않는다. 돌려주는 것은 타입이 있는
107
+ * 엔티티라 무엇이 저장됐는지 스키마로 확인할 수 있다.
108
+ */
109
+ async updateMultipleEquipment(patches, context) {
110
+ const { domain, user, tx } = context.state;
111
+ const axis = (0, master_axis_1.masterAxisOf)('equipment');
112
+ const saved = await (0, master_crud_1.saveMasterPatches)(tx, domain, axis.entity, patches, user, {
113
+ hasEffectivePeriod: axis.hasEffectivePeriod
114
+ });
115
+ return saved;
116
+ }
117
+ };
118
+ exports.EquipmentResolver = EquipmentResolver;
119
+ tslib_1.__decorate([
120
+ (0, type_graphql_1.Directive)('@privilege(category: "ops-master", privilege: "query", domainOwnerGranted: true)'),
121
+ (0, type_graphql_1.Query)(returns => EquipmentList, { description: 'To fetch equipment' }),
122
+ tslib_1.__param(0, (0, type_graphql_1.Args)(type => shell_1.ListParam)),
123
+ tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
124
+ tslib_1.__metadata("design:type", Function),
125
+ tslib_1.__metadata("design:paramtypes", [shell_1.ListParam, Object]),
126
+ tslib_1.__metadata("design:returntype", Promise)
127
+ ], EquipmentResolver.prototype, "equipmentList", null);
128
+ tslib_1.__decorate([
129
+ (0, type_graphql_1.Directive)('@privilege(category: "ops-master", privilege: "mutation", domainOwnerGranted: true)'),
130
+ (0, type_graphql_1.Directive)('@transaction'),
131
+ (0, type_graphql_1.Mutation)(returns => [equipment_1.Equipment], { description: 'To create, change or retire equipment' }),
132
+ tslib_1.__param(0, (0, type_graphql_1.Arg)('patches', type => [shell_1.ScalarObject])),
133
+ tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
134
+ tslib_1.__metadata("design:type", Function),
135
+ tslib_1.__metadata("design:paramtypes", [Array, Object]),
136
+ tslib_1.__metadata("design:returntype", Promise)
137
+ ], EquipmentResolver.prototype, "updateMultipleEquipment", null);
138
+ exports.EquipmentResolver = EquipmentResolver = tslib_1.__decorate([
139
+ (0, type_graphql_1.Resolver)(equipment_1.Equipment)
140
+ ], EquipmentResolver);
141
+ let StopReasonList = class StopReasonList {
142
+ };
143
+ exports.StopReasonList = StopReasonList;
144
+ tslib_1.__decorate([
145
+ (0, type_graphql_1.Field)(type => [stop_reason_1.StopReason]),
146
+ tslib_1.__metadata("design:type", Array)
147
+ ], StopReasonList.prototype, "items", void 0);
148
+ tslib_1.__decorate([
149
+ (0, type_graphql_1.Field)(type => type_graphql_1.Int),
150
+ tslib_1.__metadata("design:type", Number)
151
+ ], StopReasonList.prototype, "total", void 0);
152
+ exports.StopReasonList = StopReasonList = tslib_1.__decorate([
153
+ (0, type_graphql_1.ObjectType)({ description: 'A page of stop reasons' })
154
+ ], StopReasonList);
155
+ let StopReasonResolver = class StopReasonResolver {
156
+ async stopReasonList(params, context) {
157
+ const { domain } = context.state;
158
+ const { items, total } = await (0, master_list_1.listMaster)('stopReason', params, domain);
159
+ return { items: items, total };
160
+ }
161
+ /**
162
+ * 그리드가 보낸 변경을 한 번에 적용한다.
163
+ *
164
+ * 패치를 `ScalarObject` 로 받는다 — 축마다 입력 타입을 따로 만들면 칸을 하나 더할 때마다 두 곳을
165
+ * 고쳐야 하고, 한쪽을 빠뜨리면 그 칸이 오류 보고 없이 저장되지 않는다. 돌려주는 것은 타입이 있는
166
+ * 엔티티라 무엇이 저장됐는지 스키마로 확인할 수 있다.
167
+ */
168
+ async updateMultipleStopReason(patches, context) {
169
+ const { domain, user, tx } = context.state;
170
+ const axis = (0, master_axis_1.masterAxisOf)('stopReason');
171
+ const saved = await (0, master_crud_1.saveMasterPatches)(tx, domain, axis.entity, patches, user, {
172
+ hasEffectivePeriod: axis.hasEffectivePeriod
173
+ });
174
+ return saved;
175
+ }
176
+ };
177
+ exports.StopReasonResolver = StopReasonResolver;
178
+ tslib_1.__decorate([
179
+ (0, type_graphql_1.Directive)('@privilege(category: "ops-master", privilege: "query", domainOwnerGranted: true)'),
180
+ (0, type_graphql_1.Query)(returns => StopReasonList, { description: 'To fetch stop reasons' }),
181
+ tslib_1.__param(0, (0, type_graphql_1.Args)(type => shell_1.ListParam)),
182
+ tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
183
+ tslib_1.__metadata("design:type", Function),
184
+ tslib_1.__metadata("design:paramtypes", [shell_1.ListParam, Object]),
185
+ tslib_1.__metadata("design:returntype", Promise)
186
+ ], StopReasonResolver.prototype, "stopReasonList", null);
187
+ tslib_1.__decorate([
188
+ (0, type_graphql_1.Directive)('@privilege(category: "ops-master", privilege: "mutation", domainOwnerGranted: true)'),
189
+ (0, type_graphql_1.Directive)('@transaction'),
190
+ (0, type_graphql_1.Mutation)(returns => [stop_reason_1.StopReason], { description: 'To create, change or retire stop reasons' }),
191
+ tslib_1.__param(0, (0, type_graphql_1.Arg)('patches', type => [shell_1.ScalarObject])),
192
+ tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
193
+ tslib_1.__metadata("design:type", Function),
194
+ tslib_1.__metadata("design:paramtypes", [Array, Object]),
195
+ tslib_1.__metadata("design:returntype", Promise)
196
+ ], StopReasonResolver.prototype, "updateMultipleStopReason", null);
197
+ exports.StopReasonResolver = StopReasonResolver = tslib_1.__decorate([
198
+ (0, type_graphql_1.Resolver)(stop_reason_1.StopReason)
199
+ ], StopReasonResolver);
200
+ //# sourceMappingURL=equipment-master-resolver.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"equipment-master-resolver.js","sourceRoot":"","sources":["../../../server/service/equipment/equipment-master-resolver.ts"],"names":[],"mappings":";;;;AAAA,+CAA2G;AAE3G,iDAA+D;AAE/D,gDAA+D;AAC/D,gDAA6C;AAC7C,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IAC9B,CAAC;CACF,CAAA;AAjCY,gDAAkB;AAGvB;IAFL,IAAA,wBAAS,EAAC,kFAAkF,CAAC;IAC7F,IAAA,oBAAK,EAAC,OAAO,CAAC,EAAE,CAAC,cAAc,EAAE,EAAE,WAAW,EAAE,uBAAuB,EAAE,CAAC;IACrD,mBAAA,IAAA,mBAAI,EAAC,IAAI,CAAC,EAAE,CAAC,iBAAS,CAAC,CAAA;IAAqB,mBAAA,IAAA,kBAAG,GAAE,CAAA;;6CAAjB,iBAAS;;wDAK9D;AAYK;IAHL,IAAA,wBAAS,EAAC,qFAAqF,CAAC;IAChG,IAAA,wBAAS,EAAC,cAAc,CAAC;IACzB,IAAA,uBAAQ,EAAC,OAAO,CAAC,EAAE,CAAC,CAAC,wBAAU,CAAC,EAAE,EAAE,WAAW,EAAE,0CAA0C,EAAE,CAAC;IAE5F,mBAAA,IAAA,kBAAG,EAAC,SAAS,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,oBAAY,CAAC,CAAC,CAAA;IACtC,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;kEAUP;6BAhCU,kBAAkB;IAD9B,IAAA,uBAAQ,EAAC,wBAAU,CAAC;GACR,kBAAkB,CAiC9B","sourcesContent":["import { Args, Arg, Ctx, Directive, Int, Mutation, ObjectType, Field, Query, Resolver } from 'type-graphql'\n\nimport { ListParam, ScalarObject } from '@things-factory/shell'\n\nimport { MasterPatch, saveMasterPatches } from '../master-crud'\nimport { masterAxisOf } from '../master-axis'\nimport { listMaster } from '../master-list'\nimport { EquipmentClass } from './equipment-class'\nimport { Equipment } from './equipment'\nimport { StopReason } from './stop-reason'\n\n/**\n * 설비 축을 채우고 고친다.\n *\n * ── 왜 마스터는 그리드에서 고칠 수 있나 ────────────────────────────────────\n * 업무 기록과 달리 마스터는 **선언**이다. 「이 사람이 용접 자격을 갖는다」는 일어난 일이 아니라 지금의\n * 규정이고, 규정은 바뀐다. 없앨 때 행을 지우지 않고 유효 기간의 끝을 채우는 것이 그래서다 —\n * 지우면 그것을 가리키는 지난 기록이 가리킬 것을 잃는다.\n *\n * 규칙은 `master-crud.ts` 한 곳에 있다. 여기는 축의 이름만 붙인다.\n */\n\n@ObjectType({ description: 'A page of equipment classes' })\nexport class EquipmentClassList {\n @Field(type => [EquipmentClass])\n items: EquipmentClass[]\n\n @Field(type => Int)\n total: number\n}\n\n@Resolver(EquipmentClass)\nexport class EquipmentClassResolver {\n @Directive('@privilege(category: \"ops-master\", privilege: \"query\", domainOwnerGranted: true)')\n @Query(returns => EquipmentClassList, { description: 'To fetch equipment classes' })\n async equipmentClasses(@Args(type => ListParam) params: ListParam, @Ctx() context: ResolverContext): Promise<EquipmentClassList> {\n const { domain } = context.state\n const { items, total } = await listMaster('equipmentClass', params, domain)\n\n return { items: items as EquipmentClass[], total }\n }\n\n /**\n * 그리드가 보낸 변경을 한 번에 적용한다.\n *\n * 패치를 `ScalarObject` 로 받는다 — 축마다 입력 타입을 따로 만들면 칸을 하나 더할 때마다 두 곳을\n * 고쳐야 하고, 한쪽을 빠뜨리면 그 칸이 오류 보고 없이 저장되지 않는다. 돌려주는 것은 타입이 있는\n * 엔티티라 무엇이 저장됐는지 스키마로 확인할 수 있다.\n */\n @Directive('@privilege(category: \"ops-master\", privilege: \"mutation\", domainOwnerGranted: true)')\n @Directive('@transaction')\n @Mutation(returns => [EquipmentClass], { description: 'To create, change or retire equipment classes' })\n async updateMultipleEquipmentClass(\n @Arg('patches', type => [ScalarObject]) patches: MasterPatch[],\n @Ctx() context: ResolverContext\n ): Promise<EquipmentClass[]> {\n const { domain, user, tx } = context.state\n const axis = masterAxisOf('equipmentClass')\n\n const saved = await saveMasterPatches(tx, domain, axis.entity, patches, user, {\n hasEffectivePeriod: axis.hasEffectivePeriod\n })\n\n return saved as EquipmentClass[]\n }\n}\n\n@ObjectType({ description: 'A page of equipment' })\nexport class EquipmentList {\n @Field(type => [Equipment])\n items: Equipment[]\n\n @Field(type => Int)\n total: number\n}\n\n@Resolver(Equipment)\nexport class EquipmentResolver {\n @Directive('@privilege(category: \"ops-master\", privilege: \"query\", domainOwnerGranted: true)')\n @Query(returns => EquipmentList, { description: 'To fetch equipment' })\n async equipmentList(@Args(type => ListParam) params: ListParam, @Ctx() context: ResolverContext): Promise<EquipmentList> {\n const { domain } = context.state\n const { items, total } = await listMaster('equipment', params, domain)\n\n return { items: items as Equipment[], total }\n }\n\n /**\n * 그리드가 보낸 변경을 한 번에 적용한다.\n *\n * 패치를 `ScalarObject` 로 받는다 — 축마다 입력 타입을 따로 만들면 칸을 하나 더할 때마다 두 곳을\n * 고쳐야 하고, 한쪽을 빠뜨리면 그 칸이 오류 보고 없이 저장되지 않는다. 돌려주는 것은 타입이 있는\n * 엔티티라 무엇이 저장됐는지 스키마로 확인할 수 있다.\n */\n @Directive('@privilege(category: \"ops-master\", privilege: \"mutation\", domainOwnerGranted: true)')\n @Directive('@transaction')\n @Mutation(returns => [Equipment], { description: 'To create, change or retire equipment' })\n async updateMultipleEquipment(\n @Arg('patches', type => [ScalarObject]) patches: MasterPatch[],\n @Ctx() context: ResolverContext\n ): Promise<Equipment[]> {\n const { domain, user, tx } = context.state\n const axis = masterAxisOf('equipment')\n\n const saved = await saveMasterPatches(tx, domain, axis.entity, patches, user, {\n hasEffectivePeriod: axis.hasEffectivePeriod\n })\n\n return saved as Equipment[]\n }\n}\n\n@ObjectType({ description: 'A page of stop reasons' })\nexport class StopReasonList {\n @Field(type => [StopReason])\n items: StopReason[]\n\n @Field(type => Int)\n total: number\n}\n\n@Resolver(StopReason)\nexport class StopReasonResolver {\n @Directive('@privilege(category: \"ops-master\", privilege: \"query\", domainOwnerGranted: true)')\n @Query(returns => StopReasonList, { description: 'To fetch stop reasons' })\n async stopReasonList(@Args(type => ListParam) params: ListParam, @Ctx() context: ResolverContext): Promise<StopReasonList> {\n const { domain } = context.state\n const { items, total } = await listMaster('stopReason', params, domain)\n\n return { items: items as StopReason[], total }\n }\n\n /**\n * 그리드가 보낸 변경을 한 번에 적용한다.\n *\n * 패치를 `ScalarObject` 로 받는다 — 축마다 입력 타입을 따로 만들면 칸을 하나 더할 때마다 두 곳을\n * 고쳐야 하고, 한쪽을 빠뜨리면 그 칸이 오류 보고 없이 저장되지 않는다. 돌려주는 것은 타입이 있는\n * 엔티티라 무엇이 저장됐는지 스키마로 확인할 수 있다.\n */\n @Directive('@privilege(category: \"ops-master\", privilege: \"mutation\", domainOwnerGranted: true)')\n @Directive('@transaction')\n @Mutation(returns => [StopReason], { description: 'To create, change or retire stop reasons' })\n async updateMultipleStopReason(\n @Arg('patches', type => [ScalarObject]) patches: MasterPatch[],\n @Ctx() context: ResolverContext\n ): Promise<StopReason[]> {\n const { domain, user, tx } = context.state\n const axis = masterAxisOf('stopReason')\n\n const saved = await saveMasterPatches(tx, domain, axis.entity, patches, user, {\n hasEffectivePeriod: axis.hasEffectivePeriod\n })\n\n return saved as StopReason[]\n }\n}\n"]}