Skip to content

Commit

Permalink
tweaking the data we store
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronpowell committed Jul 15, 2019
1 parent f6de364 commit 04ad392
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
12 changes: 9 additions & 3 deletions DDDApi.Functions/v2/VotingFunctions.fs
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,15 @@ open System.IO
open Newtonsoft.Json
open FSharp.Azure.Storage.Table
open DDDApi
open DDDApi.azureTableUtils
open Microsoft.AspNetCore.Mvc

type UserVote =
{ TicketNumber: string
SessionIds: array<string> }
SessionIds: array<string>
Indices: int array
VoterSessionId: string
VotingStartTime: string
Id: string }

let getIpAddress (req: HttpRequest) =
let ip = req.HttpContext.Connection.RemoteIpAddress.MapToIPv4()
Expand Down Expand Up @@ -55,7 +58,10 @@ let saveVote([<HttpTrigger(AuthorizationLevel.Anonymous, "post", Route = "v2/Sav
SessionId = id
IpAddress = ipAddress
SubmittedDateUTC = DateTimeOffset.Now
TicketNumber = userVote.TicketNumber }
TicketNumber = userVote.TicketNumber
Id = userVote.Id
VoterSessionId = userVote.VoterSessionId
VotingStartTime = userVote.VotingStartTime }
vote |> Insert)
let! _ = votes
|> autobatch
Expand Down
5 changes: 4 additions & 1 deletion DDDApi/Vote.fs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@ type Vote =
IpAddress: string
SessionId: string
SubmittedDateUTC: DateTimeOffset
TicketNumber: string }
TicketNumber: string
VoterSessionId: string
Id: string
VotingStartTime: string }

type VotePeriod =
{ Start: DateTimeOffset
Expand Down

0 comments on commit 04ad392

Please sign in to comment.