@tailor-platform/erp-kit 0.5.1 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (251) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/dist/cli.mjs +103 -23
  3. package/package.json +1 -1
  4. package/skills/erp-kit-app-5-impl-backend/SKILL.md +7 -4
  5. package/skills/erp-kit-app-7-impl-review/SKILL.md +1 -1
  6. package/skills/erp-kit-module-6-impl-review/SKILL.md +39 -17
  7. package/src/commands/generate-doc.ts +1 -1
  8. package/src/commands/lib/discovery.test.ts +13 -3
  9. package/src/commands/lib/discovery.ts +10 -2
  10. package/src/commands/lib/paths.ts +4 -2
  11. package/src/commands/lib/sync-check-tests.test.ts +84 -6
  12. package/src/commands/lib/sync-check-tests.ts +63 -3
  13. package/src/commands/sync-check.ts +7 -3
  14. package/src/generator/generate-app-code.ts +51 -16
  15. package/src/generator/generate-stubs.ts +4 -0
  16. package/src/generator/stub-templates.test.ts +11 -0
  17. package/src/generator/stub-templates.ts +22 -1
  18. package/src/modules/inventory/docs/features/inventory-adjustment.md +2 -1
  19. package/src/modules/inventory/docs/features/scrap-management.md +39 -1
  20. package/src/modules/manufacturing/README.md +63 -0
  21. package/src/modules/manufacturing/command/.gitkeep +0 -0
  22. package/src/modules/manufacturing/command/activateBillOfMaterial.generated.ts +6 -0
  23. package/src/modules/manufacturing/command/activateBillOfMaterial.test.ts +166 -0
  24. package/src/modules/manufacturing/command/activateBillOfMaterial.ts +173 -0
  25. package/src/modules/manufacturing/command/activateRouting.generated.ts +6 -0
  26. package/src/modules/manufacturing/command/activateRouting.test.ts +152 -0
  27. package/src/modules/manufacturing/command/activateRouting.ts +92 -0
  28. package/src/modules/manufacturing/command/activateWorkCenter.generated.ts +6 -0
  29. package/src/modules/manufacturing/command/activateWorkCenter.test.ts +135 -0
  30. package/src/modules/manufacturing/command/activateWorkCenter.ts +91 -0
  31. package/src/modules/manufacturing/command/cancelProductionOrder.generated.ts +6 -0
  32. package/src/modules/manufacturing/command/cancelProductionOrder.test.ts +151 -0
  33. package/src/modules/manufacturing/command/cancelProductionOrder.ts +114 -0
  34. package/src/modules/manufacturing/command/closeProductionOrder.generated.ts +6 -0
  35. package/src/modules/manufacturing/command/closeProductionOrder.test.ts +126 -0
  36. package/src/modules/manufacturing/command/closeProductionOrder.ts +87 -0
  37. package/src/modules/manufacturing/command/completeProductionOrder.generated.ts +6 -0
  38. package/src/modules/manufacturing/command/completeProductionOrder.test.ts +132 -0
  39. package/src/modules/manufacturing/command/completeProductionOrder.ts +97 -0
  40. package/src/modules/manufacturing/command/completeWorkOrder.generated.ts +6 -0
  41. package/src/modules/manufacturing/command/completeWorkOrder.test.ts +369 -0
  42. package/src/modules/manufacturing/command/completeWorkOrder.ts +212 -0
  43. package/src/modules/manufacturing/command/createBillOfMaterial.generated.ts +6 -0
  44. package/src/modules/manufacturing/command/createBillOfMaterial.test.ts +210 -0
  45. package/src/modules/manufacturing/command/createBillOfMaterial.ts +176 -0
  46. package/src/modules/manufacturing/command/createProductionOrder.generated.ts +6 -0
  47. package/src/modules/manufacturing/command/createProductionOrder.test.ts +160 -0
  48. package/src/modules/manufacturing/command/createProductionOrder.ts +129 -0
  49. package/src/modules/manufacturing/command/createRouting.generated.ts +6 -0
  50. package/src/modules/manufacturing/command/createRouting.test.ts +168 -0
  51. package/src/modules/manufacturing/command/createRouting.ts +128 -0
  52. package/src/modules/manufacturing/command/createWorkCenter.generated.ts +6 -0
  53. package/src/modules/manufacturing/command/createWorkCenter.test.ts +148 -0
  54. package/src/modules/manufacturing/command/createWorkCenter.ts +131 -0
  55. package/src/modules/manufacturing/command/deactivateBillOfMaterial.generated.ts +6 -0
  56. package/src/modules/manufacturing/command/deactivateBillOfMaterial.test.ts +103 -0
  57. package/src/modules/manufacturing/command/deactivateBillOfMaterial.ts +78 -0
  58. package/src/modules/manufacturing/command/deactivateRouting.generated.ts +6 -0
  59. package/src/modules/manufacturing/command/deactivateRouting.test.ts +112 -0
  60. package/src/modules/manufacturing/command/deactivateRouting.ts +76 -0
  61. package/src/modules/manufacturing/command/deactivateWorkCenter.generated.ts +6 -0
  62. package/src/modules/manufacturing/command/deactivateWorkCenter.test.ts +113 -0
  63. package/src/modules/manufacturing/command/deactivateWorkCenter.ts +85 -0
  64. package/src/modules/manufacturing/command/pauseWorkOrder.generated.ts +6 -0
  65. package/src/modules/manufacturing/command/pauseWorkOrder.test.ts +118 -0
  66. package/src/modules/manufacturing/command/pauseWorkOrder.ts +82 -0
  67. package/src/modules/manufacturing/command/recordInventoryIssueOutcome.generated.ts +6 -0
  68. package/src/modules/manufacturing/command/recordInventoryIssueOutcome.test.ts +183 -0
  69. package/src/modules/manufacturing/command/recordInventoryIssueOutcome.ts +139 -0
  70. package/src/modules/manufacturing/command/recordManufacturingCostSettlementAcknowledgment.generated.ts +6 -0
  71. package/src/modules/manufacturing/command/recordManufacturingCostSettlementAcknowledgment.test.ts +120 -0
  72. package/src/modules/manufacturing/command/recordManufacturingCostSettlementAcknowledgment.ts +110 -0
  73. package/src/modules/manufacturing/command/releaseProductionOrder.generated.ts +6 -0
  74. package/src/modules/manufacturing/command/releaseProductionOrder.test.ts +220 -0
  75. package/src/modules/manufacturing/command/releaseProductionOrder.ts +450 -0
  76. package/src/modules/manufacturing/command/reopenProductionOrder.generated.ts +6 -0
  77. package/src/modules/manufacturing/command/reopenProductionOrder.test.ts +196 -0
  78. package/src/modules/manufacturing/command/reopenProductionOrder.ts +98 -0
  79. package/src/modules/manufacturing/command/reportWorkOrderProgress.generated.ts +6 -0
  80. package/src/modules/manufacturing/command/reportWorkOrderProgress.test.ts +204 -0
  81. package/src/modules/manufacturing/command/reportWorkOrderProgress.ts +129 -0
  82. package/src/modules/manufacturing/command/rescheduleProductionOrder.generated.ts +6 -0
  83. package/src/modules/manufacturing/command/rescheduleProductionOrder.test.ts +185 -0
  84. package/src/modules/manufacturing/command/rescheduleProductionOrder.ts +95 -0
  85. package/src/modules/manufacturing/command/resumeWorkOrder.generated.ts +6 -0
  86. package/src/modules/manufacturing/command/resumeWorkOrder.test.ts +122 -0
  87. package/src/modules/manufacturing/command/resumeWorkOrder.ts +94 -0
  88. package/src/modules/manufacturing/command/reviewManufacturingCostSummary.generated.ts +6 -0
  89. package/src/modules/manufacturing/command/reviewManufacturingCostSummary.test.ts +231 -0
  90. package/src/modules/manufacturing/command/reviewManufacturingCostSummary.ts +137 -0
  91. package/src/modules/manufacturing/command/startWorkOrder.generated.ts +6 -0
  92. package/src/modules/manufacturing/command/startWorkOrder.test.ts +118 -0
  93. package/src/modules/manufacturing/command/startWorkOrder.ts +126 -0
  94. package/src/modules/manufacturing/command/technicallyCompleteProductionOrder.generated.ts +6 -0
  95. package/src/modules/manufacturing/command/technicallyCompleteProductionOrder.test.ts +153 -0
  96. package/src/modules/manufacturing/command/technicallyCompleteProductionOrder.ts +106 -0
  97. package/src/modules/manufacturing/command/unreleaseProductionOrder.generated.ts +6 -0
  98. package/src/modules/manufacturing/command/unreleaseProductionOrder.test.ts +140 -0
  99. package/src/modules/manufacturing/command/unreleaseProductionOrder.ts +131 -0
  100. package/src/modules/manufacturing/command/updateBillOfMaterial.generated.ts +6 -0
  101. package/src/modules/manufacturing/command/updateBillOfMaterial.test.ts +149 -0
  102. package/src/modules/manufacturing/command/updateBillOfMaterial.ts +174 -0
  103. package/src/modules/manufacturing/command/updateProductionOrder.generated.ts +6 -0
  104. package/src/modules/manufacturing/command/updateProductionOrder.test.ts +112 -0
  105. package/src/modules/manufacturing/command/updateProductionOrder.ts +145 -0
  106. package/src/modules/manufacturing/command/updateRouting.generated.ts +6 -0
  107. package/src/modules/manufacturing/command/updateRouting.test.ts +211 -0
  108. package/src/modules/manufacturing/command/updateRouting.ts +124 -0
  109. package/src/modules/manufacturing/command/updateWorkCenter.generated.ts +6 -0
  110. package/src/modules/manufacturing/command/updateWorkCenter.test.ts +152 -0
  111. package/src/modules/manufacturing/command/updateWorkCenter.ts +137 -0
  112. package/src/modules/manufacturing/db/.gitkeep +0 -0
  113. package/src/modules/manufacturing/db/billOfMaterial.ts +70 -0
  114. package/src/modules/manufacturing/db/billOfMaterialLine.ts +49 -0
  115. package/src/modules/manufacturing/db/costVarianceLine.ts +53 -0
  116. package/src/modules/manufacturing/db/manufacturingCostLine.ts +35 -0
  117. package/src/modules/manufacturing/db/manufacturingCostSettlementRecord.ts +39 -0
  118. package/src/modules/manufacturing/db/manufacturingCostSummary.ts +59 -0
  119. package/src/modules/manufacturing/db/productionOrder.ts +83 -0
  120. package/src/modules/manufacturing/db/productionOrderBomSnapshot.ts +44 -0
  121. package/src/modules/manufacturing/db/productionOrderCostBaseline.ts +44 -0
  122. package/src/modules/manufacturing/db/productionOrderMaterialRequirement.ts +57 -0
  123. package/src/modules/manufacturing/db/productionOrderRoutingSnapshot.ts +43 -0
  124. package/src/modules/manufacturing/db/routing.ts +63 -0
  125. package/src/modules/manufacturing/db/routingOperation.ts +57 -0
  126. package/src/modules/manufacturing/db/workCenter.ts +87 -0
  127. package/src/modules/manufacturing/db/workOrder.ts +65 -0
  128. package/src/modules/manufacturing/db/workOrderExecutionEvent.ts +54 -0
  129. package/src/modules/manufacturing/docs/commands/ActivateBillOfMaterial.md +50 -0
  130. package/src/modules/manufacturing/docs/commands/ActivateRouting.md +48 -0
  131. package/src/modules/manufacturing/docs/commands/ActivateWorkCenter.md +49 -0
  132. package/src/modules/manufacturing/docs/commands/CancelProductionOrder.md +48 -0
  133. package/src/modules/manufacturing/docs/commands/CloseProductionOrder.md +46 -0
  134. package/src/modules/manufacturing/docs/commands/CompleteProductionOrder.md +48 -0
  135. package/src/modules/manufacturing/docs/commands/CompleteWorkOrder.md +66 -0
  136. package/src/modules/manufacturing/docs/commands/CreateBillOfMaterial.md +54 -0
  137. package/src/modules/manufacturing/docs/commands/CreateProductionOrder.md +49 -0
  138. package/src/modules/manufacturing/docs/commands/CreateRouting.md +50 -0
  139. package/src/modules/manufacturing/docs/commands/CreateWorkCenter.md +51 -0
  140. package/src/modules/manufacturing/docs/commands/DeactivateBillOfMaterial.md +45 -0
  141. package/src/modules/manufacturing/docs/commands/DeactivateRouting.md +45 -0
  142. package/src/modules/manufacturing/docs/commands/DeactivateWorkCenter.md +45 -0
  143. package/src/modules/manufacturing/docs/commands/PauseWorkOrder.md +44 -0
  144. package/src/modules/manufacturing/docs/commands/RecordInventoryIssueOutcome.md +59 -0
  145. package/src/modules/manufacturing/docs/commands/RecordManufacturingCostSettlementAcknowledgment.md +49 -0
  146. package/src/modules/manufacturing/docs/commands/ReleaseProductionOrder.md +57 -0
  147. package/src/modules/manufacturing/docs/commands/ReopenProductionOrder.md +54 -0
  148. package/src/modules/manufacturing/docs/commands/ReportWorkOrderProgress.md +53 -0
  149. package/src/modules/manufacturing/docs/commands/RescheduleProductionOrder.md +45 -0
  150. package/src/modules/manufacturing/docs/commands/ResumeWorkOrder.md +44 -0
  151. package/src/modules/manufacturing/docs/commands/ReviewManufacturingCostSummary.md +52 -0
  152. package/src/modules/manufacturing/docs/commands/StartWorkOrder.md +46 -0
  153. package/src/modules/manufacturing/docs/commands/TechnicallyCompleteProductionOrder.md +51 -0
  154. package/src/modules/manufacturing/docs/commands/UnreleaseProductionOrder.md +46 -0
  155. package/src/modules/manufacturing/docs/commands/UpdateBillOfMaterial.md +48 -0
  156. package/src/modules/manufacturing/docs/commands/UpdateProductionOrder.md +48 -0
  157. package/src/modules/manufacturing/docs/commands/UpdateRouting.md +52 -0
  158. package/src/modules/manufacturing/docs/commands/UpdateWorkCenter.md +48 -0
  159. package/src/modules/manufacturing/docs/features/bill-of-material-management.md +83 -0
  160. package/src/modules/manufacturing/docs/features/manufacturing-cost-and-variance.md +191 -0
  161. package/src/modules/manufacturing/docs/features/production-order-lifecycle.md +103 -0
  162. package/src/modules/manufacturing/docs/features/routing-and-work-center-definition.md +63 -0
  163. package/src/modules/manufacturing/docs/features/work-order-execution.md +115 -0
  164. package/src/modules/manufacturing/docs/models/BillOfMaterial.md +60 -0
  165. package/src/modules/manufacturing/docs/models/ManufacturingCostSummary.md +66 -0
  166. package/src/modules/manufacturing/docs/models/ProductionOrder.md +76 -0
  167. package/src/modules/manufacturing/docs/models/Routing.md +58 -0
  168. package/src/modules/manufacturing/docs/models/WorkCenter.md +56 -0
  169. package/src/modules/manufacturing/docs/models/WorkOrder.md +63 -0
  170. package/src/modules/manufacturing/docs/queries/DetectBillOfMaterialCircularReference.md +39 -0
  171. package/src/modules/manufacturing/docs/queries/ExplodeBillOfMaterial.md +56 -0
  172. package/src/modules/manufacturing/docs/queries/GetBillOfMaterial.md +37 -0
  173. package/src/modules/manufacturing/docs/queries/GetManufacturingCostSummary.md +39 -0
  174. package/src/modules/manufacturing/docs/queries/GetProductionOrder.md +37 -0
  175. package/src/modules/manufacturing/docs/queries/GetRouting.md +39 -0
  176. package/src/modules/manufacturing/docs/queries/GetWorkCenter.md +35 -0
  177. package/src/modules/manufacturing/docs/queries/GetWorkOrder.md +38 -0
  178. package/src/modules/manufacturing/docs/queries/ListBillOfMaterialsByItem.md +42 -0
  179. package/src/modules/manufacturing/docs/queries/ListManufacturingCostSummariesByStatus.md +41 -0
  180. package/src/modules/manufacturing/docs/queries/ListProductionOrdersByStatus.md +41 -0
  181. package/src/modules/manufacturing/docs/queries/ListRoutingsByItem.md +42 -0
  182. package/src/modules/manufacturing/docs/queries/ListWorkCentersBySite.md +38 -0
  183. package/src/modules/manufacturing/docs/queries/ListWorkOrdersByProductionOrder.md +39 -0
  184. package/src/modules/manufacturing/docs/queries/ListWorkOrdersByWorkCenter.md +43 -0
  185. package/src/modules/manufacturing/executor/.gitkeep +0 -0
  186. package/src/modules/manufacturing/generated/enums.ts +113 -0
  187. package/src/modules/manufacturing/generated/kysely-tailordb.ts +247 -0
  188. package/src/modules/manufacturing/index.ts +2 -0
  189. package/src/modules/manufacturing/lib/_db_deps.ts +22 -0
  190. package/src/modules/manufacturing/lib/errors.generated.ts +592 -0
  191. package/src/modules/manufacturing/lib/permissions.generated.ts +35 -0
  192. package/src/modules/manufacturing/lib/types.ts +111 -0
  193. package/src/modules/manufacturing/module.ts +226 -0
  194. package/src/modules/manufacturing/permissions.ts +3 -0
  195. package/src/modules/manufacturing/query/.gitkeep +0 -0
  196. package/src/modules/manufacturing/query/detectBillOfMaterialCircularReference.generated.ts +5 -0
  197. package/src/modules/manufacturing/query/detectBillOfMaterialCircularReference.test.ts +115 -0
  198. package/src/modules/manufacturing/query/detectBillOfMaterialCircularReference.ts +79 -0
  199. package/src/modules/manufacturing/query/explodeBillOfMaterial.generated.ts +5 -0
  200. package/src/modules/manufacturing/query/explodeBillOfMaterial.test.ts +445 -0
  201. package/src/modules/manufacturing/query/explodeBillOfMaterial.ts +306 -0
  202. package/src/modules/manufacturing/query/getBillOfMaterial.generated.ts +5 -0
  203. package/src/modules/manufacturing/query/getBillOfMaterial.test.ts +64 -0
  204. package/src/modules/manufacturing/query/getBillOfMaterial.ts +27 -0
  205. package/src/modules/manufacturing/query/getManufacturingCostSummary.generated.ts +5 -0
  206. package/src/modules/manufacturing/query/getManufacturingCostSummary.test.ts +147 -0
  207. package/src/modules/manufacturing/query/getManufacturingCostSummary.ts +46 -0
  208. package/src/modules/manufacturing/query/getProductionOrder.generated.ts +5 -0
  209. package/src/modules/manufacturing/query/getProductionOrder.test.ts +139 -0
  210. package/src/modules/manufacturing/query/getProductionOrder.ts +84 -0
  211. package/src/modules/manufacturing/query/getRouting.generated.ts +5 -0
  212. package/src/modules/manufacturing/query/getRouting.test.ts +71 -0
  213. package/src/modules/manufacturing/query/getRouting.ts +34 -0
  214. package/src/modules/manufacturing/query/getWorkCenter.generated.ts +5 -0
  215. package/src/modules/manufacturing/query/getWorkCenter.test.ts +37 -0
  216. package/src/modules/manufacturing/query/getWorkCenter.ts +21 -0
  217. package/src/modules/manufacturing/query/getWorkOrder.generated.ts +5 -0
  218. package/src/modules/manufacturing/query/getWorkOrder.test.ts +73 -0
  219. package/src/modules/manufacturing/query/getWorkOrder.ts +28 -0
  220. package/src/modules/manufacturing/query/listBillOfMaterialsByItem.generated.ts +5 -0
  221. package/src/modules/manufacturing/query/listBillOfMaterialsByItem.test.ts +107 -0
  222. package/src/modules/manufacturing/query/listBillOfMaterialsByItem.ts +58 -0
  223. package/src/modules/manufacturing/query/listManufacturingCostSummariesByStatus.generated.ts +5 -0
  224. package/src/modules/manufacturing/query/listManufacturingCostSummariesByStatus.test.ts +96 -0
  225. package/src/modules/manufacturing/query/listManufacturingCostSummariesByStatus.ts +77 -0
  226. package/src/modules/manufacturing/query/listProductionOrdersByStatus.generated.ts +5 -0
  227. package/src/modules/manufacturing/query/listProductionOrdersByStatus.test.ts +121 -0
  228. package/src/modules/manufacturing/query/listProductionOrdersByStatus.ts +83 -0
  229. package/src/modules/manufacturing/query/listRoutingsByItem.generated.ts +5 -0
  230. package/src/modules/manufacturing/query/listRoutingsByItem.test.ts +110 -0
  231. package/src/modules/manufacturing/query/listRoutingsByItem.ts +54 -0
  232. package/src/modules/manufacturing/query/listWorkCentersBySite.generated.ts +5 -0
  233. package/src/modules/manufacturing/query/listWorkCentersBySite.test.ts +81 -0
  234. package/src/modules/manufacturing/query/listWorkCentersBySite.ts +70 -0
  235. package/src/modules/manufacturing/query/listWorkOrdersByProductionOrder.generated.ts +5 -0
  236. package/src/modules/manufacturing/query/listWorkOrdersByProductionOrder.test.ts +102 -0
  237. package/src/modules/manufacturing/query/listWorkOrdersByProductionOrder.ts +53 -0
  238. package/src/modules/manufacturing/query/listWorkOrdersByWorkCenter.generated.ts +5 -0
  239. package/src/modules/manufacturing/query/listWorkOrdersByWorkCenter.test.ts +143 -0
  240. package/src/modules/manufacturing/query/listWorkOrdersByWorkCenter.ts +56 -0
  241. package/src/modules/manufacturing/seed/index.ts +19 -0
  242. package/src/modules/manufacturing/tailor.config.ts +13 -0
  243. package/src/modules/manufacturing/tailor.d.ts +13 -0
  244. package/src/modules/manufacturing/testing/commandTestUtils.ts +29 -0
  245. package/src/modules/manufacturing/testing/fixtures.ts +402 -0
  246. package/templates/scaffold/app/backend/package.json +9 -2
  247. package/templates/scaffold/app/backend/src/tests/utils/graphql-client.ts +66 -0
  248. package/templates/scaffold/app/backend/src/tests/utils/setup.ts +21 -0
  249. package/templates/scaffold/app/backend/tsconfig.json +9 -2
  250. package/templates/scaffold/app/backend/vitest.config.ts +35 -0
  251. package/templates/scaffold/app/frontend/package.json +2 -2
@@ -0,0 +1,59 @@
1
+ import {
2
+ db,
3
+ type TailorAnyDBType,
4
+ unsafeAllowAllGqlPermission,
5
+ unsafeAllowAllTypePermission,
6
+ } from "@tailor-platform/sdk";
7
+ import { productionOrder } from "./productionOrder";
8
+
9
+ export const BASE_COST_SUMMARY_STATUSES = [
10
+ "COLLECTING",
11
+ "PENDING_VARIANCE_REVIEW",
12
+ "VARIANCE_REVIEWED",
13
+ "SETTLED",
14
+ ] as const;
15
+
16
+ export interface CreateManufacturingCostSummaryTypeParams {
17
+ productionOrderType: TailorAnyDBType;
18
+ }
19
+
20
+ export function createManufacturingCostSummaryType(
21
+ params: CreateManufacturingCostSummaryTypeParams,
22
+ ) {
23
+ return db
24
+ .type("ManufacturingCostSummary", {
25
+ productionOrderId: db
26
+ .uuid()
27
+ .relation({
28
+ type: "1-1",
29
+ toward: { type: params.productionOrderType },
30
+ backward: "manufacturingCostSummary",
31
+ })
32
+ .description("Foreign key to ProductionOrder"),
33
+ plannedMaterialCost: db.float().description("Planned material cost"),
34
+ plannedLaborCost: db.float().description("Planned labor cost"),
35
+ plannedMachineCost: db.float().description("Planned machine cost"),
36
+ plannedOverheadCost: db.float().description("Planned overhead cost"),
37
+ actualMaterialCost: db.float().description("Actual material cost"),
38
+ actualLaborCost: db.float().description("Actual labor cost"),
39
+ actualMachineCost: db.float().description("Actual machine cost"),
40
+ actualOverheadCost: db.float().description("Actual overhead cost"),
41
+ currencyCode: db.string().description("Currency code (e.g. USD, EUR)"),
42
+ reviewedDate: db
43
+ .datetime({ optional: true })
44
+ .description("Date when cost summary was reviewed"),
45
+ reviewerNotes: db.string({ optional: true }).description("Notes from the reviewer"),
46
+ status: db
47
+ .enum([...BASE_COST_SUMMARY_STATUSES] as [string, ...string[]])
48
+ .description(
49
+ "Lifecycle status: COLLECTING, PENDING_VARIANCE_REVIEW, VARIANCE_REVIEWED, SETTLED",
50
+ ),
51
+ ...db.fields.timestamps(),
52
+ })
53
+ .permission(unsafeAllowAllTypePermission)
54
+ .gqlPermission(unsafeAllowAllGqlPermission);
55
+ }
56
+
57
+ export const manufacturingCostSummary = createManufacturingCostSummaryType({
58
+ productionOrderType: productionOrder,
59
+ });
@@ -0,0 +1,83 @@
1
+ import {
2
+ db,
3
+ type TailorAnyDBField,
4
+ type TailorAnyDBType,
5
+ unsafeAllowAllGqlPermission,
6
+ unsafeAllowAllTypePermission,
7
+ } from "@tailor-platform/sdk";
8
+ import { company as companyStub, site as siteStub, item as itemStub } from "../lib/_db_deps";
9
+
10
+ export const BASE_PRODUCTION_ORDER_STATUSES = [
11
+ "DRAFT",
12
+ "RELEASED",
13
+ "IN_PROGRESS",
14
+ "COMPLETED",
15
+ "TECHNICALLY_COMPLETE",
16
+ "CLOSED",
17
+ "CANCELLED",
18
+ ] as const;
19
+
20
+ export interface CreateProductionOrderTypeParams<F extends Record<string, TailorAnyDBField>> {
21
+ fields?: F;
22
+ companyType: TailorAnyDBType;
23
+ siteType: TailorAnyDBType;
24
+ itemType: TailorAnyDBType;
25
+ }
26
+
27
+ export function createProductionOrderType<const F extends Record<string, TailorAnyDBField>>(
28
+ params: CreateProductionOrderTypeParams<F>,
29
+ ) {
30
+ return db
31
+ .type("ProductionOrder", {
32
+ orderedItemId: db
33
+ .uuid()
34
+ .relation({
35
+ type: "n-1",
36
+ toward: { type: params.itemType },
37
+ backward: "productionOrders",
38
+ })
39
+ .description("Foreign key to Item – the item to be manufactured"),
40
+ companyId: db
41
+ .uuid()
42
+ .relation({
43
+ type: "n-1",
44
+ toward: { type: params.companyType },
45
+ backward: "productionOrders",
46
+ })
47
+ .description("Foreign key to Company"),
48
+ siteId: db
49
+ .uuid()
50
+ .relation({
51
+ type: "n-1",
52
+ toward: { type: params.siteType },
53
+ backward: "productionOrders",
54
+ })
55
+ .description("Foreign key to Site"),
56
+ plannedQuantity: db
57
+ .float()
58
+ .description("Planned production quantity, must be greater than 0"),
59
+ plannedStartDate: db.datetime().description("Planned start date for the production order"),
60
+ plannedEndDate: db.datetime().description("Planned end date for the production order"),
61
+ selectedBomVersionId: db
62
+ .uuid({ optional: true })
63
+ .description("Optional reference to BillOfMaterial – resolved at release"),
64
+ selectedRoutingRevisionId: db
65
+ .uuid({ optional: true })
66
+ .description("Optional reference to Routing – resolved at release"),
67
+ status: db
68
+ .enum([...BASE_PRODUCTION_ORDER_STATUSES] as [string, ...string[]])
69
+ .description(
70
+ "Lifecycle status: DRAFT, RELEASED, IN_PROGRESS, COMPLETED, TECHNICALLY_COMPLETE, CLOSED, CANCELLED",
71
+ ),
72
+ ...((params.fields ?? {}) as F),
73
+ ...db.fields.timestamps(),
74
+ })
75
+ .permission(unsafeAllowAllTypePermission)
76
+ .gqlPermission(unsafeAllowAllGqlPermission);
77
+ }
78
+
79
+ export const productionOrder = createProductionOrderType({
80
+ companyType: companyStub,
81
+ siteType: siteStub,
82
+ itemType: itemStub,
83
+ });
@@ -0,0 +1,44 @@
1
+ import {
2
+ db,
3
+ type TailorAnyDBField,
4
+ type TailorAnyDBType,
5
+ unsafeAllowAllGqlPermission,
6
+ unsafeAllowAllTypePermission,
7
+ } from "@tailor-platform/sdk";
8
+ import { productionOrder } from "./productionOrder";
9
+
10
+ export interface CreateProductionOrderBomSnapshotTypeParams<
11
+ F extends Record<string, TailorAnyDBField>,
12
+ > {
13
+ fields?: F;
14
+ productionOrderType: TailorAnyDBType;
15
+ }
16
+
17
+ export function createProductionOrderBomSnapshotType<
18
+ const F extends Record<string, TailorAnyDBField>,
19
+ >(params: CreateProductionOrderBomSnapshotTypeParams<F>) {
20
+ return db
21
+ .type("ProductionOrderBomSnapshot", {
22
+ productionOrderId: db
23
+ .uuid()
24
+ .relation({
25
+ type: "1-1",
26
+ toward: { type: params.productionOrderType },
27
+ backward: "bomSnapshot",
28
+ })
29
+ .description("Foreign key to ProductionOrder (one snapshot per order)"),
30
+ parentItemId: db.uuid().description("Item ID of the parent item in the BOM snapshot"),
31
+ bomType: db.string().description("BOM type (e.g., STANDARD, PHANTOM)"),
32
+ snapshotData: db
33
+ .string({ optional: true })
34
+ .description("JSON blob containing the full BOM snapshot"),
35
+ ...((params.fields ?? {}) as F),
36
+ ...db.fields.timestamps(),
37
+ })
38
+ .permission(unsafeAllowAllTypePermission)
39
+ .gqlPermission(unsafeAllowAllGqlPermission);
40
+ }
41
+
42
+ export const productionOrderBomSnapshot = createProductionOrderBomSnapshotType({
43
+ productionOrderType: productionOrder,
44
+ });
@@ -0,0 +1,44 @@
1
+ import {
2
+ db,
3
+ type TailorAnyDBField,
4
+ type TailorAnyDBType,
5
+ unsafeAllowAllGqlPermission,
6
+ unsafeAllowAllTypePermission,
7
+ } from "@tailor-platform/sdk";
8
+ import { productionOrder } from "./productionOrder";
9
+
10
+ export interface CreateProductionOrderCostBaselineTypeParams<
11
+ F extends Record<string, TailorAnyDBField>,
12
+ > {
13
+ fields?: F;
14
+ productionOrderType: TailorAnyDBType;
15
+ }
16
+
17
+ export function createProductionOrderCostBaselineType<
18
+ const F extends Record<string, TailorAnyDBField>,
19
+ >(params: CreateProductionOrderCostBaselineTypeParams<F>) {
20
+ return db
21
+ .type("ProductionOrderCostBaseline", {
22
+ productionOrderId: db
23
+ .uuid()
24
+ .relation({
25
+ type: "1-1",
26
+ toward: { type: params.productionOrderType },
27
+ backward: "costBaseline",
28
+ })
29
+ .description("Foreign key to ProductionOrder (one baseline per order)"),
30
+ plannedMaterialCost: db.float().description("Planned total material cost"),
31
+ plannedLaborCost: db.float().description("Planned total labor cost"),
32
+ plannedMachineCost: db.float().description("Planned total machine cost"),
33
+ plannedOverheadCost: db.float().description("Planned total overhead cost"),
34
+ currencyCode: db.string().description("ISO 4217 currency code (e.g., USD)"),
35
+ ...((params.fields ?? {}) as F),
36
+ ...db.fields.timestamps(),
37
+ })
38
+ .permission(unsafeAllowAllTypePermission)
39
+ .gqlPermission(unsafeAllowAllGqlPermission);
40
+ }
41
+
42
+ export const productionOrderCostBaseline = createProductionOrderCostBaselineType({
43
+ productionOrderType: productionOrder,
44
+ });
@@ -0,0 +1,57 @@
1
+ import {
2
+ db,
3
+ type TailorAnyDBField,
4
+ type TailorAnyDBType,
5
+ unsafeAllowAllGqlPermission,
6
+ unsafeAllowAllTypePermission,
7
+ } from "@tailor-platform/sdk";
8
+ import { item as itemStub } from "../lib/_db_deps";
9
+ import { productionOrder } from "./productionOrder";
10
+
11
+ export interface CreateProductionOrderMaterialRequirementTypeParams<
12
+ F extends Record<string, TailorAnyDBField>,
13
+ > {
14
+ fields?: F;
15
+ productionOrderType: TailorAnyDBType;
16
+ itemType: TailorAnyDBType;
17
+ }
18
+
19
+ export function createProductionOrderMaterialRequirementType<
20
+ const F extends Record<string, TailorAnyDBField>,
21
+ >(params: CreateProductionOrderMaterialRequirementTypeParams<F>) {
22
+ return db
23
+ .type("ProductionOrderMaterialRequirement", {
24
+ productionOrderId: db
25
+ .uuid()
26
+ .relation({
27
+ type: "n-1",
28
+ toward: { type: params.productionOrderType },
29
+ backward: "materialRequirements",
30
+ })
31
+ .description("Foreign key to ProductionOrder"),
32
+ itemId: db
33
+ .uuid()
34
+ .relation({
35
+ type: "n-1",
36
+ toward: { type: params.itemType },
37
+ backward: "productionOrderMaterialRequirements",
38
+ })
39
+ .description("Foreign key to Item – the required material"),
40
+ requiredQuantity: db.float().description("Required quantity of the material"),
41
+ unitOfMeasure: db
42
+ .string({ optional: true })
43
+ .description("Unit of measure for the required quantity"),
44
+ plannedUnitCost: db
45
+ .float({ optional: true })
46
+ .description("Planned cost per unit of the material"),
47
+ ...((params.fields ?? {}) as F),
48
+ ...db.fields.timestamps(),
49
+ })
50
+ .permission(unsafeAllowAllTypePermission)
51
+ .gqlPermission(unsafeAllowAllGqlPermission);
52
+ }
53
+
54
+ export const productionOrderMaterialRequirement = createProductionOrderMaterialRequirementType({
55
+ productionOrderType: productionOrder,
56
+ itemType: itemStub,
57
+ });
@@ -0,0 +1,43 @@
1
+ import {
2
+ db,
3
+ type TailorAnyDBField,
4
+ type TailorAnyDBType,
5
+ unsafeAllowAllGqlPermission,
6
+ unsafeAllowAllTypePermission,
7
+ } from "@tailor-platform/sdk";
8
+ import { productionOrder } from "./productionOrder";
9
+
10
+ export interface CreateProductionOrderRoutingSnapshotTypeParams<
11
+ F extends Record<string, TailorAnyDBField>,
12
+ > {
13
+ fields?: F;
14
+ productionOrderType: TailorAnyDBType;
15
+ }
16
+
17
+ export function createProductionOrderRoutingSnapshotType<
18
+ const F extends Record<string, TailorAnyDBField>,
19
+ >(params: CreateProductionOrderRoutingSnapshotTypeParams<F>) {
20
+ return db
21
+ .type("ProductionOrderRoutingSnapshot", {
22
+ productionOrderId: db
23
+ .uuid()
24
+ .relation({
25
+ type: "1-1",
26
+ toward: { type: params.productionOrderType },
27
+ backward: "routingSnapshot",
28
+ })
29
+ .description("Foreign key to ProductionOrder (one snapshot per order)"),
30
+ routingId: db.uuid().description("Routing ID reference for the snapshot"),
31
+ snapshotData: db
32
+ .string({ optional: true })
33
+ .description("JSON blob containing the full routing snapshot"),
34
+ ...((params.fields ?? {}) as F),
35
+ ...db.fields.timestamps(),
36
+ })
37
+ .permission(unsafeAllowAllTypePermission)
38
+ .gqlPermission(unsafeAllowAllGqlPermission);
39
+ }
40
+
41
+ export const productionOrderRoutingSnapshot = createProductionOrderRoutingSnapshotType({
42
+ productionOrderType: productionOrder,
43
+ });
@@ -0,0 +1,63 @@
1
+ import {
2
+ db,
3
+ type TailorAnyDBField,
4
+ type TailorAnyDBType,
5
+ unsafeAllowAllGqlPermission,
6
+ unsafeAllowAllTypePermission,
7
+ } from "@tailor-platform/sdk";
8
+ import { company as companyStub, site as siteStub, item as itemStub } from "../lib/_db_deps";
9
+
10
+ export const BASE_ROUTING_STATUSES = ["DRAFT", "ACTIVE", "INACTIVE"] as const;
11
+
12
+ export interface CreateRoutingTypeParams<F extends Record<string, TailorAnyDBField>> {
13
+ fields?: F;
14
+ companyType: TailorAnyDBType;
15
+ siteType: TailorAnyDBType;
16
+ itemType: TailorAnyDBType;
17
+ }
18
+
19
+ export function createRoutingType<const F extends Record<string, TailorAnyDBField>>(
20
+ params: CreateRoutingTypeParams<F>,
21
+ ) {
22
+ return db
23
+ .type("Routing", {
24
+ parentItemId: db
25
+ .uuid()
26
+ .relation({
27
+ type: "n-1",
28
+ toward: { type: params.itemType },
29
+ backward: "routings",
30
+ })
31
+ .description("Foreign key to Item – the manufactured item"),
32
+ companyId: db
33
+ .uuid()
34
+ .relation({
35
+ type: "n-1",
36
+ toward: { type: params.companyType },
37
+ backward: "routings",
38
+ })
39
+ .description("Foreign key to Company"),
40
+ siteId: db
41
+ .uuid({ optional: true })
42
+ .relation({
43
+ type: "n-1",
44
+ toward: { type: params.siteType },
45
+ backward: "routings",
46
+ })
47
+ .description("Foreign key to Site – optional site scope"),
48
+ revisionNumber: db.string({ optional: true }).description("Version identity of the routing"),
49
+ status: db
50
+ .enum([...BASE_ROUTING_STATUSES] as [string, ...string[]])
51
+ .description("Lifecycle status: DRAFT, ACTIVE, INACTIVE"),
52
+ ...((params.fields ?? {}) as F),
53
+ ...db.fields.timestamps(),
54
+ })
55
+ .permission(unsafeAllowAllTypePermission)
56
+ .gqlPermission(unsafeAllowAllGqlPermission);
57
+ }
58
+
59
+ export const routing = createRoutingType({
60
+ companyType: companyStub,
61
+ siteType: siteStub,
62
+ itemType: itemStub,
63
+ });
@@ -0,0 +1,57 @@
1
+ import {
2
+ db,
3
+ type TailorAnyDBType,
4
+ unsafeAllowAllGqlPermission,
5
+ unsafeAllowAllTypePermission,
6
+ } from "@tailor-platform/sdk";
7
+ import { routing } from "./routing";
8
+ import { workCenter } from "./workCenter";
9
+
10
+ export interface CreateRoutingOperationTypeParams {
11
+ routingType: TailorAnyDBType;
12
+ workCenterType: TailorAnyDBType;
13
+ }
14
+
15
+ export function createRoutingOperationType(params: CreateRoutingOperationTypeParams) {
16
+ return db
17
+ .type("RoutingOperation", {
18
+ routingId: db
19
+ .uuid()
20
+ .relation({
21
+ type: "n-1",
22
+ toward: { type: params.routingType },
23
+ backward: "routingOperations",
24
+ })
25
+ .description("Foreign key to Routing"),
26
+ sequenceNumber: db.int().description("Step order within the routing"),
27
+ operationDescription: db
28
+ .string({ optional: true })
29
+ .description("Human-readable description of the operation"),
30
+ workCenterId: db
31
+ .uuid()
32
+ .relation({
33
+ type: "n-1",
34
+ toward: { type: params.workCenterType },
35
+ backward: "routingOperations",
36
+ })
37
+ .description("Foreign key to WorkCenter"),
38
+ standardSetupTime: db.float().description("Standard setup time (>= 0)"),
39
+ standardRunTime: db.float().description("Standard run time per unit (>= 0)"),
40
+ operatorInstructions: db
41
+ .string({ optional: true })
42
+ .description("Free-text instructions for the operator"),
43
+ ...db.fields.timestamps(),
44
+ })
45
+ .indexes({
46
+ fields: ["routingId", "sequenceNumber"],
47
+ unique: true,
48
+ name: "routing_operation_routing_seq_idx",
49
+ })
50
+ .permission(unsafeAllowAllTypePermission)
51
+ .gqlPermission(unsafeAllowAllGqlPermission);
52
+ }
53
+
54
+ export const routingOperation = createRoutingOperationType({
55
+ routingType: routing,
56
+ workCenterType: workCenter,
57
+ });
@@ -0,0 +1,87 @@
1
+ import {
2
+ db,
3
+ type TailorAnyDBField,
4
+ type TailorAnyDBType,
5
+ unsafeAllowAllGqlPermission,
6
+ unsafeAllowAllTypePermission,
7
+ } from "@tailor-platform/sdk";
8
+ import { company as companyStub, site as siteStub } from "../lib/_db_deps";
9
+
10
+ export const BASE_WORK_CENTER_STATUSES = ["DRAFT", "ACTIVE", "INACTIVE"] as const;
11
+
12
+ export const OVERHEAD_ABSORPTION_METHODS = [
13
+ "PERCENT_OF_LABOR_COST",
14
+ "PERCENT_OF_MACHINE_COST",
15
+ "FIXED_AMOUNT_PER_GOOD_UNIT",
16
+ ] as const;
17
+
18
+ export interface CreateWorkCenterTypeParams<F extends Record<string, TailorAnyDBField>> {
19
+ fields?: F;
20
+ companyType: TailorAnyDBType;
21
+ siteType: TailorAnyDBType;
22
+ }
23
+
24
+ export function createWorkCenterType<const F extends Record<string, TailorAnyDBField>>(
25
+ params: CreateWorkCenterTypeParams<F>,
26
+ ) {
27
+ return db
28
+ .type("WorkCenter", {
29
+ code: db.string().description("Work-center code, unique within company and site scope"),
30
+ companyId: db
31
+ .uuid()
32
+ .relation({
33
+ type: "n-1",
34
+ toward: { type: params.companyType },
35
+ backward: "workCenters",
36
+ })
37
+ .description("Foreign key to Company"),
38
+ siteId: db
39
+ .uuid({ optional: true })
40
+ .relation({
41
+ type: "n-1",
42
+ toward: { type: params.siteType },
43
+ backward: "workCenters",
44
+ })
45
+ .description("Foreign key to Site; required when company uses site-level work centers"),
46
+ status: db
47
+ .enum([...BASE_WORK_CENTER_STATUSES] as [string, ...string[]])
48
+ .description("Lifecycle status: DRAFT, ACTIVE, INACTIVE"),
49
+ capacityAssumptions: db
50
+ .float()
51
+ .description(
52
+ "Capacity assumption expressed in a consistent planning unit; must be positive",
53
+ ),
54
+ laborRate: db
55
+ .float({ optional: true })
56
+ .description("Standard labor rate per planning unit; must be zero or greater"),
57
+ machineRate: db
58
+ .float({ optional: true })
59
+ .description("Standard machine rate per planning unit; must be zero or greater"),
60
+ calendarReference: db
61
+ .string({ optional: true })
62
+ .description("Calendar identifier; required when activating the work center"),
63
+ overheadAbsorptionMethod: db
64
+ .enum([...OVERHEAD_ABSORPTION_METHODS] as [string, ...string[]], {
65
+ optional: true,
66
+ })
67
+ .description(
68
+ "Method for absorbing overhead: PERCENT_OF_LABOR_COST, PERCENT_OF_MACHINE_COST, or FIXED_AMOUNT_PER_GOOD_UNIT",
69
+ ),
70
+ overheadAbsorptionCurrency: db
71
+ .string({ optional: true })
72
+ .description(
73
+ "ISO 4217 currency code for overhead absorption; required when method is FIXED_AMOUNT_PER_GOOD_UNIT",
74
+ ),
75
+ ...((params.fields ?? {}) as F),
76
+ ...db.fields.timestamps(),
77
+ })
78
+ .indexes({
79
+ fields: ["code", "companyId", "siteId"],
80
+ unique: true,
81
+ name: "work_center_code_company_site_idx",
82
+ })
83
+ .permission(unsafeAllowAllTypePermission)
84
+ .gqlPermission(unsafeAllowAllGqlPermission);
85
+ }
86
+
87
+ export const workCenter = createWorkCenterType({ companyType: companyStub, siteType: siteStub });
@@ -0,0 +1,65 @@
1
+ import {
2
+ db,
3
+ type TailorAnyDBType,
4
+ unsafeAllowAllGqlPermission,
5
+ unsafeAllowAllTypePermission,
6
+ } from "@tailor-platform/sdk";
7
+ import { productionOrder } from "./productionOrder";
8
+ import { workCenter } from "./workCenter";
9
+
10
+ export const BASE_WORK_ORDER_STATUSES = [
11
+ "PENDING",
12
+ "IN_PROGRESS",
13
+ "PAUSED",
14
+ "COMPLETE",
15
+ "CANCELLED",
16
+ ] as const;
17
+
18
+ export interface CreateWorkOrderTypeParams {
19
+ productionOrderType: TailorAnyDBType;
20
+ workCenterType: TailorAnyDBType;
21
+ }
22
+
23
+ export function createWorkOrderType(params: CreateWorkOrderTypeParams) {
24
+ return db
25
+ .type("WorkOrder", {
26
+ productionOrderId: db
27
+ .uuid()
28
+ .relation({
29
+ type: "n-1",
30
+ toward: { type: params.productionOrderType },
31
+ backward: "workOrders",
32
+ })
33
+ .description("Foreign key to ProductionOrder"),
34
+ routingOperationSequenceNumber: db
35
+ .int()
36
+ .description("Sequence number of the routing operation"),
37
+ workCenterId: db
38
+ .uuid()
39
+ .relation({
40
+ type: "n-1",
41
+ toward: { type: params.workCenterType },
42
+ backward: "workOrders",
43
+ })
44
+ .description("Foreign key to WorkCenter"),
45
+ plannedQuantity: db.float().description("Planned quantity to produce, must be >= 0"),
46
+ completedQuantity: db.float().description("Completed quantity, must be >= 0"),
47
+ scrapQuantity: db.float().description("Scrap quantity, must be >= 0"),
48
+ actualSetupTime: db.float().description("Actual setup time in minutes, must be >= 0"),
49
+ actualRunTime: db.float().description("Actual run time in minutes, must be >= 0"),
50
+ actualStartDate: db.datetime({ optional: true }).description("Actual start date and time"),
51
+ pauseReason: db.string({ optional: true }).description("Reason for pausing the work order"),
52
+ executionNotes: db.string({ optional: true }).description("Free-form notes about execution"),
53
+ status: db
54
+ .enum([...BASE_WORK_ORDER_STATUSES] as [string, ...string[]])
55
+ .description("Lifecycle status: PENDING, IN_PROGRESS, PAUSED, COMPLETE, CANCELLED"),
56
+ ...db.fields.timestamps(),
57
+ })
58
+ .permission(unsafeAllowAllTypePermission)
59
+ .gqlPermission(unsafeAllowAllGqlPermission);
60
+ }
61
+
62
+ export const workOrder = createWorkOrderType({
63
+ productionOrderType: productionOrder,
64
+ workCenterType: workCenter,
65
+ });
@@ -0,0 +1,54 @@
1
+ import {
2
+ db,
3
+ type TailorAnyDBType,
4
+ unsafeAllowAllGqlPermission,
5
+ unsafeAllowAllTypePermission,
6
+ } from "@tailor-platform/sdk";
7
+ import { workOrder } from "./workOrder";
8
+
9
+ export const EXECUTION_EVENT_TYPES = [
10
+ "STARTED",
11
+ "PAUSED",
12
+ "RESUMED",
13
+ "PROGRESS_REPORTED",
14
+ "COMPLETED",
15
+ ] as const;
16
+
17
+ export interface CreateWorkOrderExecutionEventTypeParams {
18
+ workOrderType: TailorAnyDBType;
19
+ }
20
+
21
+ export function createWorkOrderExecutionEventType(params: CreateWorkOrderExecutionEventTypeParams) {
22
+ return db
23
+ .type("WorkOrderExecutionEvent", {
24
+ workOrderId: db
25
+ .uuid()
26
+ .relation({
27
+ type: "n-1",
28
+ toward: { type: params.workOrderType },
29
+ backward: "executionEvents",
30
+ })
31
+ .description("Foreign key to WorkOrder"),
32
+ eventType: db
33
+ .enum([...EXECUTION_EVENT_TYPES] as [string, ...string[]])
34
+ .description("Event type: STARTED, PAUSED, RESUMED, PROGRESS_REPORTED, COMPLETED"),
35
+ timestamp: db.datetime().description("When the event occurred"),
36
+ quantity: db
37
+ .float({ optional: true })
38
+ .description("Quantity associated with the event, must be >= 0"),
39
+ timeValue: db
40
+ .float({ optional: true })
41
+ .description("Time value associated with the event, must be >= 0"),
42
+ scrapValue: db
43
+ .float({ optional: true })
44
+ .description("Scrap value associated with the event, must be >= 0"),
45
+ notes: db.string({ optional: true }).description("Optional notes about the event"),
46
+ ...db.fields.timestamps(),
47
+ })
48
+ .permission(unsafeAllowAllTypePermission)
49
+ .gqlPermission(unsafeAllowAllGqlPermission);
50
+ }
51
+
52
+ export const workOrderExecutionEvent = createWorkOrderExecutionEventType({
53
+ workOrderType: workOrder,
54
+ });