feat: publish visit updated for approved visit registration updates and align seed data#1524
Open
yoganandaness wants to merge 5 commits into
Open
Conversation
…nd align seed data
…ange-approved-visi
Contributor
There was a problem hiding this comment.
Pull request overview
This PR extends the visit-registration event flow so downstream systems can receive “visit updated” notifications (not only create/delete) when an already-approved visit registration is edited. It also introduces a stable id for visit registrations across backend, frontend, messaging payloads, and seed data to improve local/dev readiness.
Changes:
- Backend: add
VISIT_REGISTRATION_UPDATEDevent and publishVISIT_UPDATEDto RabbitMQ when an approved registration is updated; include registrationidin the message payload. - Backend/DB: introduce a UUID primary key
idonvisits_has_usersand propagate it through models/records/GraphQL types. - Frontend/E2E: query and use
visitRegistration.idfor in-place updates; allow editing approved registrations and add Cypress coverage; align seed data (active visit template + approved proposals).
Reviewed changes
Copilot reviewed 18 out of 18 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| apps/frontend/src/hooks/visit/useBlankVisitRegistration.ts | Adds id field to the locally-created visit registration stub. |
| apps/frontend/src/hooks/proposalBooking/useActionButtons.tsx | Uses registration id (instead of userId) when replacing updated/cancelled registrations in state. |
| apps/frontend/src/graphql/visitRegistration/fragment.visitRegistration.graphql | Adds id to the visit registration fragment so clients receive it. |
| apps/frontend/src/components/visit/VisitRegistrationReview.tsx | Adds UI label for APPROVED status. |
| apps/frontend/src/components/proposalBooking/UserUpcomingExperimentsTable.tsx | Adjusts Dialog sizing props (maxWidth, fullWidth). |
| apps/frontend/src/components/experiment/ExperimentVisitsTable.tsx | Uses id for replacement logic; enables edit button for APPROVED registrations; adds data-cy hook. |
| apps/e2e/cypress/e2e/visits.cy.ts | Adds Cypress test for editing an approved visit registration. |
| apps/backend/src/resolvers/types/VisitRegistration.ts | Exposes visit registration id in GraphQL type. |
| apps/backend/src/mutations/VisitMutations.ts | Publishes VISIT_REGISTRATION_UPDATED when updating visit registrations. |
| apps/backend/src/models/VisitRegistration.ts | Adds id to the VisitRegistration model constructor/signature. |
| apps/backend/src/events/event.enum.ts | Adds new VISIT_REGISTRATION_UPDATED event enum value. |
| apps/backend/src/events/applicationEvents.ts | Extends ApplicationEvent union with VisitRegistrationUpdatedEvent. |
| apps/backend/src/eventHandlers/messageBroker.ts | Maps approved registration updates to RabbitMQ VISIT_UPDATED and adds id to payload. |
| apps/backend/src/datasources/postgres/records.ts | Adds id to VisitRegistrationRecord and mapping constructor call. |
| apps/backend/src/datasources/mockups/VisitDataSource.ts | Generates mock string ids for registrations and updates constructor calls. |
| apps/backend/db_patches/db_seeds/0008_VisitTemplate.sql | Adds a seeded active VISIT_REGISTRATION template. |
| apps/backend/db_patches/db_seeds/0001_ProposalForScheduling.sql | Marks seeded proposals as management-decision submitted. |
| apps/backend/db_patches/0210_AddIdPkToVisitsHasUsers.sql | Adds UUID id PK to visits_has_users and retains uniqueness on (visit_id, user_id). |
Comment on lines
+5
to
+11
| BEGIN | ||
| ALTER TABLE visits_has_users | ||
| ADD COLUMN id UUID; | ||
|
|
||
| UPDATE visits_has_users | ||
| SET id = uuid_generate_v4() | ||
| WHERE id IS NULL; |
Comment on lines
+222
to
+225
| cy.get('[data-cy="save-and-continue-button"]').click(); | ||
| cy.get('[data-cy="visit-status"]').should('have.text', 'APPROVED'); | ||
|
|
||
| }); |
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.
Description
Publish
VISIT_UPDATEDfor approved visit-registration updates, includeidin visit payload, and update seed data for visit template activation and approved proposals.Motivation and Context
Ensure downstream systems receive visit update events (not only create/delete) and improve local test data readiness.
How Has This Been Tested
Fixes
Enables visit sync on approved registration updates via
VISIT_UPDATED.Changes
idto visit event JSON payload.Depends on
None.
Tests included/Docs Updated?