@@ -61,6 +61,7 @@ type ProposalMessageData = {
6161 instruments ?: { id : number ; shortCode : string ; allocatedTime : number } [ ] ;
6262 members : Member [ ] ;
6363 dataAccessUsers : Member [ ] ;
64+ visitors : Member [ ] ;
6465 newStatus ?: string ;
6566 proposalPk : number ;
6667 proposer ?: Member ;
@@ -129,10 +130,17 @@ export const getProposalMessageData = async (proposal: Proposal) => {
129130
130131 const proposalUsersWithInstitution =
131132 await userDataSource . getProposalUsersWithInstitution ( proposal . primaryKey ) ;
133+
132134 const dataAccessUsersWithInstitution =
133135 await dataAccessUsersDataSource . getDataAccessUsersWithInstitution (
134136 proposal . primaryKey
135137 ) ;
138+
139+ const visitorsWithInstitution =
140+ await userDataSource . getApprovedProposalVisitorsWithInstitution (
141+ proposal . primaryKey
142+ ) ;
143+
136144 const maybeInstruments =
137145 await instrumentDataSource . getInstrumentsByProposalPk ( proposal . primaryKey ) ;
138146
@@ -177,9 +185,11 @@ export const getProposalMessageData = async (proposal: Proposal) => {
177185 dataAccessUsers : dataAccessUsersWithInstitution . map (
178186 mapUserWithInstitutionToMember
179187 ) ,
188+ visitors : visitorsWithInstitution . map ( mapUserWithInstitutionToMember ) ,
180189 newStatus : proposalStatus ?. shortCode ,
181190 submitted : proposal . submitted ,
182191 } ;
192+
183193 const proposerWithInstitution = await userDataSource . getUserWithInstitution (
184194 proposal . proposerId
185195 ) ;
@@ -242,7 +252,6 @@ export async function createPostToRabbitMQHandler() {
242252 case Event . PROPOSAL_DELETED :
243253 case Event . PROPOSAL_STATUS_ACTION_EXECUTED : {
244254 const jsonMessage = await getProposalMessageData ( event . proposal ) ;
245-
246255 await rabbitMQ . sendMessageToExchange (
247256 event . exchange || EXCHANGE_NAME ,
248257 event . type ,
@@ -380,6 +389,13 @@ export async function createPostToRabbitMQHandler() {
380389 : RABBITMQ_VISIT_EVENT_TYPE . VISIT_DELETED ,
381390 jsonMessage
382391 ) ;
392+
393+ const proposalJsonMessage = await getProposalMessageData ( proposal ! ) ;
394+ await rabbitMQ . sendMessageToExchange (
395+ EXCHANGE_NAME ,
396+ Event . PROPOSAL_UPDATED ,
397+ proposalJsonMessage
398+ ) ;
383399 break ;
384400 }
385401 case Event . DATA_ACCESS_USERS_UPDATED : {
0 commit comments