diff --git a/src/Vervis/Handler/Repo.hs b/src/Vervis/Handler/Repo.hs index 4494aa9..4deb27f 100644 --- a/src/Vervis/Handler/Repo.hs +++ b/src/Vervis/Handler/Repo.hs @@ -231,7 +231,24 @@ getRepoDevR :: ShrIdent -> RpIdent -> ShrIdent -> Handler Html getRepoDevR shr rp dev = error "Not implemented" deleteRepoDevR :: ShrIdent -> RpIdent -> ShrIdent -> Handler Html -deleteRepoDevR shr rp dev = error "Not implemented" +deleteRepoDevR shr rp dev = do + runDB $ do + rid <- do + Entity s _ <- getBy404 $ UniqueSharer shr + Entity r _ <- getBy404 $ UniqueRepo rp s + return r + pid <- do + Entity s _ <- getBy404 $ UniqueSharer dev + Entity p _ <- getBy404 $ UniquePersonIdent s + return p + Entity cid _collab <- getBy404 $ UniqueCollab rid pid + delete cid + setMessage "Collaborator removed." + redirect $ RepoDevsR shr rp postRepoDevR :: ShrIdent -> RpIdent -> ShrIdent -> Handler Html -postRepoDevR shr rp dev = error "Not implemented" +postRepoDevR shr rp dev = do + mmethod <- lookupPostParam "_method" + case mmethod of + Just "DELETE" -> deleteRepoDevR shr rp dev + _ -> notFound