Skip to content

Commit

Permalink
Map subset of player events
Browse files Browse the repository at this point in the history
  • Loading branch information
blair55 committed May 5, 2023
1 parent 212809e commit e2401db
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions src/Server/EventHandling.fs
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,26 @@ module EventHandling =

let (|MapPredictionSetEventPlayerIdId|) (PlayerId playerId) : PlayerId =
match playerId with
| "fb-10160345161488703" -> PlayerId "tw-414832159"
| "fb-735238821018" -> PlayerId "tw-458540585"
| "tw-462436725" -> PlayerId "fb-10152951016485684"
| "tw-414832159" -> PlayerId "fb-10160345161488703"
// | "fb-10160345161488703" -> PlayerId "tw-414832159" // JB reverse
| "tw-414832159" -> PlayerId "fb-10160345161488703" // JB
| "fb-735238821018" -> PlayerId "tw-458540585" // PB
| "tw-462436725" -> PlayerId "fb-10152951016485684" // TD
| _ -> PlayerId playerId

let (|MapPlayerEventPlayerId|) (PlayerId playerId) : PlayerId =
match playerId with
| "tw-462436725" -> PlayerId "fb-10152951016485684" // TD
| _ -> PlayerId playerId

let onEvent deps (DatedEvent (event, created)) =
printfn "handling event: %A" event

match event with
// players
| PlayerLoggedIn (playerId) ->
| PlayerLoggedIn (MapPlayerEventPlayerId playerId) ->
PlayerLoggedInSubscribers.all
|> List.iter (fun f -> f deps created playerId)
| PlayerCreated (playerId, playerName, email) ->
| PlayerCreated (MapPlayerEventPlayerId playerId, playerName, email) ->
PlayerCreatedSubscribers.all
|> List.iter (fun f -> f deps created (playerId, playerName, email))
| PlayerRemoved playerId ->
Expand All @@ -40,7 +45,7 @@ module EventHandling =
| LeagueRenamed (leagueId, leagueName) ->
LeagueRenamedSubscribers.all
|> List.iter (fun f -> f deps (leagueId, leagueName))
| LeagueJoined (leagueId, playerId) ->
| LeagueJoined (leagueId, MapPlayerEventPlayerId playerId) ->
LeagueJoinedSubscribers.all
|> List.iter (fun f -> f deps created (leagueId, playerId))
| LeagueLeft (leagueId, playerId) ->
Expand Down

0 comments on commit e2401db

Please sign in to comment.