Created
November 16, 2012 14:59
-
-
Save svdberg/4087945 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
postFeedingsR :: Handler RepJson | |
postFeedingsR = do | |
muser <- maybeAuth | |
parsedFeeding <- parseJsonBody_ --get content as JSON | |
let userId = getUserId muser | |
feedingWithUser = Feeding (feedingDate parsedFeeding) (feedingSide parsedFeeding) (feedingTime parsedFeeding) (feedingExcrements parsedFeeding) (feedingRemarks parsedFeeding) userId --should be linked to user.. | |
fid <- runDB $ insert parsedFeeding --feedingWithUser --store in database | |
--runDB $ update fid [ FeedingUserId =. userId ] --link the feeding to the user | |
sendResponseCreated $ FeedingR fid --return the id |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment