#262: remove Requests / Approvals / Tasks tabs from Executive Meetings
Full-stack removal of the three retired sections — UI, locales, realtime
invalidations, backend routes, role lists, capability flags, schema
tables, notify lib, and tests.
Backend (artifacts/api-server)
- routes/executive-meetings.ts: deleted /requests* + /tasks* handler
block, REQUEST_ROLES / TASK_VIEW_ROLES / TASK_BROAD_VIEW_ROLES,
canSubmitRequest / canViewTasks / canViewAllTasks from /me, retired
table imports, and dead schemas (detailsByType, requestPayloadSchemas,
request*Schema, taskCreateSchema, taskPatchSchema, dueAtSchema,
dateOnly, timeHm). canApprove kept (still used by FontSettings).
- lib/executive-meeting-notify.ts: EXECUTIVE_MEETING_NOTIFICATION_TYPES
collapsed to ['meeting_created'].
Frontend (artifacts/tx-os)
- pages/executive-meetings.tsx: deleted RequestsSection /
ApprovalsSection / TasksSection / RequestListRow, pruned SECTIONS,
MeCapabilities / MeRoles types, isSectionVisible cases, icon imports.
- hooks/use-notifications-socket.ts: dropped the two retired query
invalidations.
- locales/{ar,en}.json: removed nav.{requests,approvals,tasks},
executiveMeetings.{requests,approvals,tasks} subtrees, and the 6
retired notification.type entries.
Schema + DB
- lib/db/src/schema/executive-meetings.ts: tables + relations + types
for requests/tasks removed.
- artifacts/api-server/scripts/cleanup-em-requests-tasks.sql:
idempotent BEGIN/COMMIT — deletes orphan prefs / notifications /
audit rows, then DROP TABLE … CASCADE for both retired tables.
Applied to dev DB and `db push` re-synced.
Tests
- executive-meetings.test.mjs: deleted 9 retired blocks + 2 covered
prefs duplicates, rewrote /me capability test to assert flags absent,
rewrote DELETE-wipe test to use meeting_created via POST
/api/executive-meetings, removed /requests + /tasks router.param
entries.
- executive-meetings-notifications.test.mjs: deleted 7 blocks
(request_*, task_*, cross-event-mute), updated before/after
cleanup to skip dropped tables, kept setPref/clearPref helpers
(still used by surviving meeting_created opt-out tests).
Drift / pre-existing
- 3 test failures observed under the parallel `node --test` workflow
(meeting_created fan-out count, pref opt-out daily-number conflict,
service-orders JSON-vs-HTML) are pre-existing parallel-file
pollution between executive-meetings.test.mjs and
executive-meetings-notifications.test.mjs. Verified by running
`node --test --test-concurrency=1 'tests/**/*.test.mjs'` →
226/226 pass. Out of scope for #262.
- Pre-existing tsc warnings at routes/executive-meetings.ts L509/625
(boolean/number on isHighlighted) and L1594 (font-settings scope
query) untouched.
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
-- #262: Executive Meetings Requests/Approvals/Tasks removal cleanup.
|
||||
--
|
||||
-- Drops the two retired tables and scrubs orphaned rows from the
|
||||
-- surviving Executive Meetings tables that referenced them by string.
|
||||
-- Idempotent: safe to re-run. Wraps everything in a single transaction
|
||||
-- so a partial failure leaves the DB unchanged.
|
||||
--
|
||||
-- Run order:
|
||||
-- 1) Apply this script to dev / prod databases.
|
||||
-- 2) Run `pnpm --filter @workspace/db push` to confirm the Drizzle
|
||||
-- schema and the database are in sync (should be a no-op).
|
||||
--
|
||||
-- Run command (dev):
|
||||
-- psql "$DATABASE_URL" -f artifacts/api-server/scripts/cleanup-em-requests-tasks.sql
|
||||
|
||||
BEGIN;
|
||||
|
||||
-- 1. Notification preferences rows for retired event types.
|
||||
DELETE FROM executive_meeting_notification_prefs
|
||||
WHERE notification_type IN (
|
||||
'request_submitted',
|
||||
'request_approved',
|
||||
'request_rejected',
|
||||
'request_needs_edit',
|
||||
'task_assigned',
|
||||
'task_completed'
|
||||
);
|
||||
|
||||
-- 2. Notifications rows for retired event types (executive-meeting domain only).
|
||||
DELETE FROM executive_meeting_notifications
|
||||
WHERE notification_type IN (
|
||||
'request_submitted',
|
||||
'request_approved',
|
||||
'request_rejected',
|
||||
'request_needs_edit',
|
||||
'task_assigned',
|
||||
'task_completed'
|
||||
);
|
||||
|
||||
-- 3. Audit logs that targeted request/task entities.
|
||||
DELETE FROM executive_meeting_audit_logs
|
||||
WHERE entity_type IN ('request', 'task');
|
||||
|
||||
-- 4. Drop the retired tables themselves. CASCADE removes any FK indices
|
||||
-- that referenced them; nothing in the surviving schema depends on
|
||||
-- these two tables.
|
||||
DROP TABLE IF EXISTS executive_meeting_tasks CASCADE;
|
||||
DROP TABLE IF EXISTS executive_meeting_requests CASCADE;
|
||||
|
||||
COMMIT;
|
||||
Reference in New Issue
Block a user