1
Fork 0

fsharp(todolist-api): refactor: added a few random type definitions

Signed-off-by: prescientmoon <git@moonythm.dev>
This commit is contained in:
Matei Adriel 2020-01-02 15:42:24 +02:00 committed by prescientmoon
parent 38e6717f76
commit 67ae890717
Signed by: prescientmoon
SSH key fingerprint: SHA256:UUF9JT2s8Xfyv76b8ZuVL7XrmimH4o49p4b+iexbVH4

View file

@ -25,7 +25,7 @@ module App =
open Utils
open Db
let todoById (id) =
let todoById (id): WebPart =
let todo =
Context.getContext()
|> Queries.getTodosById id
@ -35,7 +35,7 @@ module App =
| Some inner -> inner |> jsonToString |> OK
| None -> id |> sprintf "Cannot find todo with id %i" |> NOT_FOUND
let updateTodo (id) =
let updateTodo (id): WebPart =
let dbContext = Context.getContext()
let todo = dbContext |> Queries.getTodosById id
@ -59,6 +59,7 @@ module App =
| None -> id |> sprintf "Cannot find todo with id %i" |> NOT_FOUND
let mainWebPart: WebPart = choose [
GET >=> pathScan "/todos/%i" todoById
PUT >=> pathScan "/todos/%i" updateTodo]