File tree Expand file tree Collapse file tree 2 files changed +8
-8
lines changed
Expand file tree Collapse file tree 2 files changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ namespace Tweet
22open User
33open Chessie.ErrorHandling
44
5- type PostId = PostId of System.Guid
5+ type TweetId = TweetId of System.Guid
66
77type Post = private Post of string with
88 static member TryCreate ( post : string ) =
@@ -14,7 +14,7 @@ type Post = private Post of string with
1414 let ( Post post ) = this
1515 post
1616
17- type CreatePost = UserId -> Post -> AsyncResult< PostId , System.Exception>
17+ type CreatePost = UserId -> Post -> AsyncResult< TweetId , System.Exception>
1818
1919
2020module Persistence =
@@ -23,16 +23,16 @@ module Persistence =
2323 open Database
2424 open System
2525
26- let createPost ( getDataCtx : GetDataContext ) ( UserId userId ) ( post : Post ) = asyncTrial {
26+ let createTweet ( getDataCtx : GetDataContext ) ( UserId userId ) ( post : Post ) = asyncTrial {
2727 let ctx = getDataCtx()
2828 let newTweet = ctx.Public.Tweets.Create()
29- let newPostId = Guid.NewGuid()
29+ let newTweetId = Guid.NewGuid()
3030
3131 newTweet.UserId <- userId
32- newTweet.Id <- newPostId
32+ newTweet.Id <- newTweetId
3333 newTweet.Post <- post.Value
3434 newTweet.TweetedAt <- DateTime.UtcNow
3535
3636 do ! submitUpdates ctx
37- return PostId newPostId
37+ return TweetId newTweetId
3838 }
Original file line number Diff line number Diff line change @@ -27,7 +27,7 @@ module Suave =
2727 return ! page " user/wall.liquid" vm ctx
2828 }
2929
30- let onCreateTweetSuccess ( PostId id) =
30+ let onCreateTweetSuccess ( TweetId id) =
3131 [ " id" , String ( id.ToString())]
3232 |> Map.ofList
3333 |> Object
@@ -53,7 +53,7 @@ module Suave =
5353 }
5454
5555 let webpart getDataCtx =
56- let createTweet = Persistence.createPost getDataCtx
56+ let createTweet = Persistence.createTweet getDataCtx
5757 choose [
5858 path " /wall" >=> requiresAuth renderWall
5959 POST >=> path " /tweets"
You can’t perform that action at this time.
0 commit comments