From ef078d4e50ecf878b455710a5a2f79d7fd0d44de Mon Sep 17 00:00:00 2001 From: Matei Adriel Date: Thu, 2 Jan 2020 18:13:31 +0200 Subject: [PATCH] fsharp(todolist-api): refactor: changed a few nonsensical names Signed-off-by: prescientmoon --- fsharp/todolist-api/src/App.fs | 6 +++--- fsharp/todolist-api/src/Db.fs | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/fsharp/todolist-api/src/App.fs b/fsharp/todolist-api/src/App.fs index bf29a65..c44fe25 100644 --- a/fsharp/todolist-api/src/App.fs +++ b/fsharp/todolist-api/src/App.fs @@ -41,7 +41,7 @@ module App = fun ctx -> async { let body: Types.TodoDetails = parseJson ctx.request.rawForm - do! Queries.updateTodoById todo body dbContext + do! Queries.updateTodo todo body dbContext return! respondWithTodo todo ctx }) @@ -50,14 +50,14 @@ module App = fun ctx -> async { let body: Types.PartialTodoDetails = parseJson ctx.request.rawForm - do! Queries.patchTodoById todo body dbContext + do! Queries.patchTodo todo body dbContext return! respondWithTodo todo ctx }) let deleteTodo = withTodoById (fun (todo, dbContext) -> fun ctx -> async { - do! Queries.deleteTodoById todo dbContext + do! Queries.deleteTodo todo dbContext return! respondWithTodo todo ctx }) diff --git a/fsharp/todolist-api/src/Db.fs b/fsharp/todolist-api/src/Db.fs index 8acbc2a..63ee383 100644 --- a/fsharp/todolist-api/src/Db.fs +++ b/fsharp/todolist-api/src/Db.fs @@ -85,13 +85,13 @@ module Queries = } |> Seq.toList - let updateTodoById (todo: DbTodo) (details: TodoDetails) (ctx: DbContext) = + let updateTodo (todo: DbTodo) (details: TodoDetails) (ctx: DbContext) = todo.Name <- details.name todo.Description <- details.description ctx.SubmitUpdatesAsync() - let patchTodoById (todo: DbTodo) (details: PartialTodoDetails) (ctx: DbContext) = + let patchTodo (todo: DbTodo) (details: PartialTodoDetails) (ctx: DbContext) = Option.iter (fun name -> todo.Name <- name) details.name Option.iter (fun description -> todo.Description <- description) details.description @@ -99,7 +99,7 @@ module Queries = then ctx.SubmitUpdatesAsync() else Async.result() - let deleteTodoById (todo: DbTodo) (ctx: DbContext) = + let deleteTodo (todo: DbTodo) (ctx: DbContext) = todo.Delete() ctx.SubmitUpdatesAsync() @@ -108,7 +108,7 @@ module Queries = async { let todo = ctx.Public.Todos.Create() - do! updateTodoById todo details ctx + do! updateTodo todo details ctx return todo }