Skip to content

Commit

Permalink
Broadcast user updates on resolve
Browse files Browse the repository at this point in the history
  • Loading branch information
IanPhilips committed Dec 3, 2024
1 parent 6179f0e commit 7495605
Show file tree
Hide file tree
Showing 2 changed files with 201 additions and 188 deletions.
10 changes: 8 additions & 2 deletions backend/api/src/resolve-market.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import {
import { resolveLoveMarketOtherAnswers } from 'shared/love/love-markets'
import { betsQueue } from 'shared/helpers/fn-queue'
import { createSupabaseDirectClient } from 'shared/supabase/init'
import { broadcastUserUpdates } from 'shared/supabase/users'

export const resolveMarket: APIHandler<'market/:contractId/resolve'> = async (
props,
Expand Down Expand Up @@ -98,13 +99,18 @@ export const resolveMarketMain: APIHandler<
)
}

await resolveMarketHelper(
const { userUpdates } = await resolveMarketHelper(
contract as MarketContract,
caller,
creator,
resolutionParams
)
return { message: 'success' }
return {
result: { message: 'success' },
continue: async () => {
broadcastUserUpdates(userUpdates)
},
}
}

function getResolutionParams(
Expand Down
Loading

0 comments on commit 7495605

Please sign in to comment.