fsharp(todolist-api): feat: todo deleting
Signed-off-by: prescientmoon <git@moonythm.dev>
This commit is contained in:
parent
ba40a9c203
commit
886d8be8bb
|
@ -55,11 +55,19 @@ module App =
|
||||||
return! respondWithTodo todo ctx
|
return! respondWithTodo todo ctx
|
||||||
})
|
})
|
||||||
|
|
||||||
|
let deleteTodo = withTodoById (fun (todo, dbContext) ->
|
||||||
|
fun ctx -> async {
|
||||||
|
do! Queries.deleteTodoById todo dbContext
|
||||||
|
|
||||||
|
return! respondWithTodo todo ctx
|
||||||
|
})
|
||||||
|
|
||||||
let mainWebPart: WebPart = choose [
|
let mainWebPart: WebPart = choose [
|
||||||
pathScan "/todos/%i" (fun (id) -> choose [
|
pathScan "/todos/%i" (fun (id) -> choose [
|
||||||
GET >=> todoById id
|
GET >=> todoById id
|
||||||
PUT >=> updateTodo id
|
PUT >=> updateTodo id
|
||||||
PATCH >=> patchTodo id
|
PATCH >=> patchTodo id
|
||||||
|
DELETE >=> deleteTodo id
|
||||||
])]
|
])]
|
||||||
|
|
||||||
[<EntryPoint>]
|
[<EntryPoint>]
|
||||||
|
|
Loading…
Reference in a new issue