Commit Graph

16 Commits

Author SHA1 Message Date
redz1029 20e95ffe37 feat(edge): day sheet digest push
Co-Authored-By: claude-flow <ruv@ruv.net>
2026-09-28 13:50:31 +08:00
redz1029 3cb980b629 QA hardening: security RLS fixes, Flutter 3.47.5 upgrade, UI/validation fixes
Security — enforce write authorization server-side (was UI/RPC-only):
- it_service_requests RLS: block cross-office read/edit + self-approve (QA-015)
- pass_slips RLS: owner can complete but not self-approve (QA-046)
- swap_requests RLS: scope select/update to participants + admin (QA-047)
- storage: tighten it_service_attachments + task_attachments write/delete (QA-027)
- admin_user_management edge function: allow programmers to manage users (QA-016)

Fixes:
- workforce generator "uncovered shifts" false alarms (QA-043/044)
- network-map VLAN + New-location dialog validation, disabled-until-valid (QA-048)
- de-flake time-of-day-dependent dashboard metrics test (QA-045)

Toolchain:
- upgrade to Flutter 3.47.5 / Dart 3.13.4; font_awesome_flutter 11.0.0,
  flutter_quill 11.6.0, pdfrx 2.6.5; clear resulting deprecations (QA-002)

analyze clean; 139 tests pass; web build succeeds. Report + evidence in docs/qa/.

Note: also carries the in-progress Brick model cleanup already present in the
working tree. QA-001 (AI keys public in the build) is deferred by owner decision.

Co-Authored-By: claude-flow <ruv@ruv.net>
2026-09-26 11:52:16 +08:00
redz1029 5d0a66bb52 Initial Commit : Network Map 2026-05-21 06:29:14 +08:00
redz1029 872c2aab87 UI Enhancements in IT Service Request, Announcements, Workforce and notification fixes 2026-03-22 18:00:10 +08:00
redz1029 049ab2c794 Added My Schedule tab in attendance screen
Allow 1 Day, Whole Week and Date Range swapping
2026-03-22 11:52:25 +08:00
redz1029 7d9096963a finalized reminder notification system migrations 2026-03-21 12:58:38 +08:00
redz1029 758869920c Fix push notifications never delivered — 3 root causes
1. CRITICAL: Double idempotency check silently discarded every notification.
   process_scheduled_notifications called try_mark_notification_pushed first,
   then send_fcm called it again and saw "already pushed" → skipped FCM send.
   Fix: Remove the check from process_scheduled_notifications; send_fcm's
   own check is sufficient (and needed for direct Flutter client calls).

2. SEND_FCM_URL env var crash: If not configured, edge function crashed on
   module load. Fix: Derive from SUPABASE_URL (always auto-set) as fallback.

3. Timing windows too narrow: ±30s windows with 60s cron intervals could
   miss events between runs. Fix: Widen to ±90s. ON CONFLICT DO NOTHING
   prevents duplicates, making wider windows safe.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-20 20:50:45 +08:00
redz1029 d484f62cbd Implement push notification reminder system with 9 notification types
Adds comprehensive push notification reminders using pg_cron + pg_net:
- Shift check-in reminder (15 min before, with countdown banner)
- Shift check-out reminder (hourly, persistent until checkout)
- Overtime idle reminder (15 min without task)
- Overtime checkout reminder (30 min after task completion)
- IT service request event reminder (1 hour before event)
- IT service request evidence reminder (daily)
- Paused task reminder (daily)
- Backlog reminder (15 min before shift end)
- Pass slip expiry reminder (15 min before 1-hour limit, with countdown banner)

Database: Extended scheduled_notifications table to support polymorphic references
(schedule_id, task_id, it_service_request_id, pass_slip_id) with unique constraint
and epoch column for deduplication. Implemented 8 enqueue functions + master dispatcher.
Uses pg_cron every minute to enqueue and pg_net to trigger process_scheduled_notifications
edge function, eliminating need for external cron job. Credentials stored in vault with
GUC fallback for flexibility.

Flutter: Added ShiftCountdownBanner and PassSlipCountdownBanner widgets that display
persistent countdown timers for active shifts and pass slips. Both auto-dismiss when
user completes the action. FCM handler triggers shift countdown on start_15 messages.
navigate_to field in data payload enables flexible routing to any screen.

Edge function: Updated process_scheduled_notifications to handle all 9 types with
appropriate titles, bodies, and routing. Includes pass_slip_id in idempotency tracking.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-03-20 18:26:48 +08:00
redz1029 4b63b55812 Initial commit for shift push notification reminders 2026-03-18 22:03:50 +08:00
redz1029 0a8e388757 Move push notification to client instead of db trigger 2026-02-28 16:19:08 +08:00
redz1029 9cc99e612a Allow background sound notification 2026-02-26 21:43:05 +08:00
redz1029 6ccf820438 FCM push Notifications 2026-02-25 23:37:08 +08:00
redz1029 5979a04254 * Push Notification Setup and attempt
* Office Ordering
* Allow editing of Task and Ticket Details after creation
2026-02-24 21:06:46 +08:00
redz1029 8c1bb7646e Fixed user management 2026-02-18 20:43:11 +08:00
redz1029 04fd874a48 chore: remove unused profile lock migration and admin_profile_service 2026-02-18 18:13:10 +08:00
redz1029 1f16da8f88 Initial commit 2026-02-09 20:10:42 +08:00