feat: Implement Safety Gates and Permit Management (Sprint 3 Remediat…#76
Conversation
…ion) - Added Permit Management API (CRUD) - Implemented Safety Gates in WorkOrderService to block critical work without active permits - Added E2E tests for Permits and Safety Gates - Updated documentation (GAP_REMEDIATION_PLAN, SPRINTS, SPRINT_STATUS_TRACKER) to reflect completion of Phase 0.2
| @@ -0,0 +1,178 @@ | |||
| import { db } from "../db"; | |||
| import { permits, workOrders } from "../db/schema"; | |||
| import { eq, and, desc, asc, like, or, sql } from "drizzle-orm"; | |||
Check notice
Code scanning / CodeQL
Unused variable, import, function or class Note
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 7 months ago
To fix the problem, we need to remove the unused import or from the drizzle-orm import statement. In general, the fix is to delete the unused symbol from the import list in import { ... } from "drizzle-orm". No other parts of the file need to change. No new methods, definitions, or imports are needed; simply modify the affected line.
| @@ -1,6 +1,6 @@ | ||
| import { db } from "../db"; | ||
| import { permits, workOrders } from "../db/schema"; | ||
| import { eq, and, desc, asc, like, or, sql } from "drizzle-orm"; | ||
| import { eq, and, desc, asc, like, sql } from "drizzle-orm"; | ||
|
|
||
| export interface CreatePermitData { | ||
| tenantId: string; |
| import { workOrders, workOrderTasks, workOrderParts, workOrderLabor } from "../db/schema"; | ||
| import { eq, and, desc, asc, sql, like, or, inArray, gte, lte } from "drizzle-orm"; | ||
| import { workOrders, workOrderTasks, workOrderParts, workOrderLabor, permits } from "../db/schema"; | ||
| import { eq, and, desc, asc, sql, like, or, inArray, gte, lte, gt } from "drizzle-orm"; |
Check notice
Code scanning / CodeQL
Unused variable, import, function or class Note
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 7 months ago
To fix the problem, we should remove the unused inArray import from the import statement on line 3. This involves editing the relevant import line in backend/src/services/work-order.service.ts to delete inArray from the named imports. No other code changes are necessary, and no new imports or definitions are needed.
| @@ -1,6 +1,6 @@ | ||
| import { db } from "../db"; | ||
| import { workOrders, workOrderTasks, workOrderParts, workOrderLabor, permits } from "../db/schema"; | ||
| import { eq, and, desc, asc, sql, like, or, inArray, gte, lte, gt } from "drizzle-orm"; | ||
| import { eq, and, desc, asc, sql, like, or, gte, lte, gt } from "drizzle-orm"; | ||
| import { WorkOrderStateMachine, WorkOrderStatus } from "./work-order-state"; | ||
|
|
||
| export interface CreateWorkOrderData { |
| import { TestServer } from '../../tests/helpers/test-server'; | ||
| import { db } from '../../tests/helpers/database'; | ||
| import { UserFactory } from '../../tests/factories/user.factory'; | ||
| import { permits } from '../../src/db/schema'; |
Check notice
Code scanning / CodeQL
Unused variable, import, function or class Note test
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 7 months ago
To fix the problem, you should remove the unused import statement for permits from the top of the file. This involves deleting the line import { permits } from '../../src/db/schema'; (line 4). There is no need to replace or refactor meaning elsewhere in the file, as it has no effect on runtime or test behaviour, nor is it being used for type information. No additional imports or variable definitions are needed to implement this change.
| @@ -1,8 +1,8 @@ | ||
| import { TestServer } from '../../tests/helpers/test-server'; | ||
| import { db } from '../../tests/helpers/database'; | ||
| import { UserFactory } from '../../tests/factories/user.factory'; | ||
| import { permits } from '../../src/db/schema'; | ||
|
|
||
|
|
||
| describe('Permits & Safety Gates E2E', () => { | ||
| let server: TestServer; | ||
| let token: string; |
…ion)