Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions gren.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"dependencies": {
"direct": {
"blaix/gren-effectful-tests": "6.0.0",
"blaix/gren-ws4sql": "3.0.2",
"blaix/gren-ws4sql": "4.0.0",
"gren-lang/core": "7.0.0",
"gren-lang/node": "6.0.0",
"gren-lang/test": "5.0.0",
Expand All @@ -18,4 +18,4 @@
"gren-lang/test-runner-node": "7.0.0"
}
}
}
}
Binary file removed gren_packages/blaix_gren_ws4sql__3_0_2.pkg.gz
Binary file not shown.
Binary file added gren_packages/blaix_gren_ws4sql__4_0_0.pkg.gz
Binary file not shown.
11 changes: 4 additions & 7 deletions src/PublishingIdentity.gren
Original file line number Diff line number Diff line change
Expand Up @@ -96,15 +96,12 @@ get db { userId, name } =
, Encode.string "name" name
]
, decoder =
-- TODO: upgrade gren-ws4sql for the new api here
Decode.get3
(Decode.int "id")
(Decode.int "user_id")
(Decode.string "name")
(\id uid n ->
Decode.field Decode.int "id" <| \id ->
Decode.field Decode.int "user_id" <| \uid ->
Decode.field Decode.string "name" <| \n ->
Decode.succeed
{ id = id
, userId = uid
, name = n
}
)
}
31 changes: 13 additions & 18 deletions src/User.gren
Original file line number Diff line number Diff line change
Expand Up @@ -23,24 +23,19 @@ type alias User =

decoder : Decoder User
decoder =
Decode.string "email"
|> Decode.andThen
(\email ->
when (Email.fromString email) is
Nothing ->
Decode.fail ("Invalid email: " ++ email)

Just e ->
Decode.get2
(Decode.int "id")
(Decode.posix "created")
(\id created ->
{ id = id
, created = created
, email = e
}
)
)
Decode.field Decode.string "email" <| \email ->
when (Email.fromString email) is
Nothing ->
Decode.fail ("Invalid email: " ++ email)

Just e ->
Decode.field Decode.int "id" <| \id ->
Decode.field Decode.posix "created" <| \created ->
Decode.succeed
{ id = id
, created = created
, email = e
}


findBySessionToken : Db.Connection -> String -> Task Db.Error User
Expand Down
Loading