Backend migration: immerSIR (new-frontend) backend → production#43
Merged
Conversation
Replaces the app code (Mapapi/, backend/, template/, requirements.txt) with the immerSIR dev version validated against the new frontend, keeping 223MapAction's deploy infra (.github/workflows, Dockerfiles, entrypoint.sh, _cd_pipeline.yml, services/, docker-compose.local.yml) untouched. Includes: full RBAC (super_admin/org_admin/bureau/field roles), impact dashboard (/impact, /impact/incidents), field-agent flow (PIN login, assignments, field reports), collaboration overhaul + real-time WebSockets (channels + redis pin), notifications/activity feed, AI prediction + chat wiring, org-scoped incident visibility, security fixes (/user/<id> auth-gated), UUID primary keys + public schema, and SMS OTP via Twilio (upstream orange->twilio integrated). DB note: requires the matching UUID/public-schema database (migrated separately); the deploy's auto-migrate is a no-op against that DB.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Backend migration: immerSIR (new-frontend) version → production
Replaces the app code with the immerSIR backend that the new frontend was built and validated against, keeping 223MapAction's deploy infra untouched (
.github/workflows,Dockerfile,services/,entrypoint.sh,_cd_pipeline.yml,docker-compose.local.yml).What's included
/impact,/impact/incidents) powered by the AI predictions, role-scoped.redis==5.0.8pin) for discussion/tasks/notifications/activity-feed.type/title/link./user/<id>/auth + role-gated (was fully public); assorted permission fixes.publicschema (search_path=public).orange → twiliochange.Database (already migrated — do this is done, not part of the merge)
The production Supabase project now has a
publicschema holding the merged dataset (existing prod data ∪ the dev/test data), rekeyed to UUID, with our migration state loaded. The oldextensionsschema is left intact as a live fallback. RLS is enabled on allpublictables (app connects aspostgres/owner → bypasses; blocks the publicanonAPI).Deploy is safe
migrateon deploy is a no-op (migration state already applied in the merged DB).postgres(verified sole login role, owns the tables,BYPASSRLS).redis://redis-server:6379/0(matches the compose service).Post-deploy checklist
/MapApi/againstpublic.MODEL_DEPLOY_ANALYZE_URL=…/analyze/uploadandMODEL_DEPLOY_CHAT_URL=…/chat(NOT/api1/…) — same bug fixed elsewhere; predictions/chat fail silently otherwise.TWILIO_*andEMAIL_*secrets are set (SMS OTP + emails).extensionsschema.Note: a few dev test incidents reference the dev project's storage bucket, so those specific test photos 404 in prod — prod incidents are unaffected.