acid-migrate:
* successful conversion and test
This commit is contained in:
parent
93268c683c
commit
1c4db3b576
1 changed files with 13 additions and 6 deletions
|
@ -160,7 +160,7 @@ getPost eid =
|
||||||
latestPosts :: Query Blog [Entry]
|
latestPosts :: Query Blog [Entry]
|
||||||
latestPosts =
|
latestPosts =
|
||||||
do b@Blog{..} <- ask
|
do b@Blog{..} <- ask
|
||||||
return $ IxSet.toDescList (Proxy :: Proxy UTCTime) $ blogEntries
|
return $ IxSet.toDescList (Proxy :: Proxy EDate) $ blogEntries
|
||||||
|
|
||||||
addSession :: Text -> User -> UTCTime -> Update Blog Session
|
addSession :: Text -> User -> UTCTime -> Update Blog Session
|
||||||
addSession sId u t =
|
addSession sId u t =
|
||||||
|
@ -199,9 +199,10 @@ instance JSON Comment where
|
||||||
readJSON val = do
|
readJSON val = do
|
||||||
obj <- jsonObject val
|
obj <- jsonObject val
|
||||||
scauthor <- jsonField "cauthor" obj
|
scauthor <- jsonField "cauthor" obj
|
||||||
scdate <- jsonField "cdate" obj
|
jsscdate <- jsonField "cdate" obj :: Result JSValue
|
||||||
sctext <- jsonField "cdate" obj
|
let rcdate = stripResult $ jsonInt jsscdate
|
||||||
return $ Comment (pack scauthor) (pack sctext) (parseSeconds scdate)
|
sctext <- jsonField "ctext" obj
|
||||||
|
return $ Comment (pack scauthor) (pack sctext) (parseSeconds rcdate)
|
||||||
|
|
||||||
instance JSON Entry where
|
instance JSON Entry where
|
||||||
showJSON = undefined
|
showJSON = undefined
|
||||||
|
@ -213,11 +214,11 @@ instance JSON Entry where
|
||||||
month <- jsonField "month" obj
|
month <- jsonField "month" obj
|
||||||
year <- jsonField "year" obj
|
year <- jsonField "year" obj
|
||||||
stext <- jsonField "text" obj
|
stext <- jsonField "text" obj
|
||||||
--comments <- jsonField "comments" obj
|
comments <- jsonField "comments" obj
|
||||||
oldid <- jsonField "_id" obj
|
oldid <- jsonField "_id" obj
|
||||||
let leTime = parseShittyTime year month day oldid
|
let leTime = parseShittyTime year month day oldid
|
||||||
return $ Entry (EntryId $ getUnixTime leTime) DE (pack sauthor) (pack $ stitle \\ "\n") (pack stext) (Text.empty)
|
return $ Entry (EntryId $ getUnixTime leTime) DE (pack sauthor) (pack $ stitle \\ "\n") (pack stext) (Text.empty)
|
||||||
leTime [] []
|
leTime [] comments
|
||||||
|
|
||||||
|
|
||||||
getUnixTime :: UTCTime -> Integer
|
getUnixTime :: UTCTime -> Integer
|
||||||
|
@ -268,3 +269,9 @@ convertEntries acid = do
|
||||||
forceHack !x = do
|
forceHack !x = do
|
||||||
xy <- pasteToDB acid x
|
xy <- pasteToDB acid x
|
||||||
return $ show xy
|
return $ show xy
|
||||||
|
|
||||||
|
testThis :: IO ()
|
||||||
|
testThis = do
|
||||||
|
acid <- openLocalState initialBlogState
|
||||||
|
allE <- query' acid LatestPosts
|
||||||
|
putStrLn $ show allE
|
Loading…
Reference in a new issue