Serve live URIs for Team (Squad) records for project, repo, deck, loom

This commit is contained in:
Pere Lev 2024-05-20 20:39:05 +03:00
parent 646e17fa56
commit 4f5954de7e
No known key found for this signature in database
GPG key ID: 5252C5C863E5E57D
6 changed files with 57 additions and 0 deletions

View file

@ -162,6 +162,7 @@ type CollabEnableKeyHashid = KeyHashid CollabEnable
type StemKeyHashid = KeyHashid Stem type StemKeyHashid = KeyHashid Stem
type PermitFulfillsInviteKeyHashid = KeyHashid PermitFulfillsInvite type PermitFulfillsInviteKeyHashid = KeyHashid PermitFulfillsInvite
type DestUsStartKeyHashid = KeyHashid DestUsStart type DestUsStartKeyHashid = KeyHashid DestUsStart
type SquadUsStartKeyHashid = KeyHashid SquadUsStart
-- This is where we define all of the routes in our application. For a full -- This is where we define all of the routes in our application. For a full
-- explanation of the syntax, please see: -- explanation of the syntax, please see:
@ -950,6 +951,7 @@ instance YesodBreadcrumbs App where
RepoAddTeamR r -> ("", Nothing) RepoAddTeamR r -> ("", Nothing)
RepoApproveTeamR r t -> ("", Nothing) RepoApproveTeamR r t -> ("", Nothing)
RepoRemoveTeamR r t -> ("", Nothing) RepoRemoveTeamR r t -> ("", Nothing)
RepoTeamLiveR _ _ -> ("", Nothing)
DeckR d -> ("Ticket Tracker =" <> keyHashidText d, Just HomeR) DeckR d -> ("Ticket Tracker =" <> keyHashidText d, Just HomeR)
DeckInboxR d -> ("Inbox", Just $ DeckR d) DeckInboxR d -> ("Inbox", Just $ DeckR d)
@ -983,6 +985,7 @@ instance YesodBreadcrumbs App where
DeckAddTeamR d -> ("", Nothing) DeckAddTeamR d -> ("", Nothing)
DeckApproveTeamR d t -> ("", Nothing) DeckApproveTeamR d t -> ("", Nothing)
DeckRemoveTeamR d t -> ("", Nothing) DeckRemoveTeamR d t -> ("", Nothing)
DeckTeamLiveR _ _ -> ("", Nothing)
TicketR d t -> ("#" <> keyHashidText t, Just $ DeckTicketsR d) TicketR d t -> ("#" <> keyHashidText t, Just $ DeckTicketsR d)
TicketDiscussionR d t -> ("Discussion", Just $ TicketR d t) TicketDiscussionR d t -> ("Discussion", Just $ TicketR d t)
@ -1024,6 +1027,7 @@ instance YesodBreadcrumbs App where
LoomAddTeamR l -> ("", Nothing) LoomAddTeamR l -> ("", Nothing)
LoomApproveTeamR l t -> ("", Nothing) LoomApproveTeamR l t -> ("", Nothing)
LoomRemoveTeamR l t -> ("", Nothing) LoomRemoveTeamR l t -> ("", Nothing)
LoomTeamLiveR _ _ -> ("", Nothing)
ClothR l c -> ("#" <> keyHashidText c, Just $ LoomClothsR l) ClothR l c -> ("#" <> keyHashidText c, Just $ LoomClothsR l)
ClothDiscussionR l c -> ("Discussion", Just $ ClothR l c) ClothDiscussionR l c -> ("Discussion", Just $ ClothR l c)
@ -1085,6 +1089,7 @@ instance YesodBreadcrumbs App where
ProjectAddTeamR _ -> ("", Nothing) ProjectAddTeamR _ -> ("", Nothing)
ProjectApproveTeamR _ _ -> ("", Nothing) ProjectApproveTeamR _ _ -> ("", Nothing)
ProjectRemoveTeamR _ _ -> ("", Nothing) ProjectRemoveTeamR _ _ -> ("", Nothing)
ProjectTeamLiveR _ _ -> ("", Nothing)
PersonErrboxR p -> ("Errbox", Just $ PersonR p) PersonErrboxR p -> ("Errbox", Just $ PersonR p)
GroupErrboxR g -> ("Errbox", Just $ GroupR g) GroupErrboxR g -> ("Errbox", Just $ GroupR g)

View file

@ -49,6 +49,7 @@ module Vervis.Handler.Deck
, postDeckAddTeamR , postDeckAddTeamR
, postDeckApproveTeamR , postDeckApproveTeamR
, postDeckRemoveTeamR , postDeckRemoveTeamR
, getDeckTeamLiveR
@ -748,6 +749,17 @@ postDeckRemoveTeamR deckHash squadID = do
setMessage "Remove sent" setMessage "Remove sent"
redirect $ DeckCollabsR deckHash redirect $ DeckCollabsR deckHash
getDeckTeamLiveR :: KeyHashid Deck -> KeyHashid SquadUsStart -> Handler ()
getDeckTeamLiveR deckHash startHash = do
deckID <- decodeKeyHashid404 deckHash
startID <- decodeKeyHashid404 startHash
runDB $ do
deck <- get404 deckID
SquadUsStart usAcceptID _ <- get404 startID
SquadUsAccept squadID _ <- getJust usAcceptID
Squad _ resourceID <- getJust squadID
unless (resourceID == deckResource deck) notFound
{- {-
getProjectsR :: ShrIdent -> Handler Html getProjectsR :: ShrIdent -> Handler Html
getProjectsR ident = do getProjectsR ident = do

View file

@ -40,6 +40,7 @@ module Vervis.Handler.Loom
, postLoomAddTeamR , postLoomAddTeamR
, postLoomApproveTeamR , postLoomApproveTeamR
, postLoomRemoveTeamR , postLoomRemoveTeamR
, getLoomTeamLiveR
) )
where where
@ -563,3 +564,14 @@ postLoomRemoveTeamR loomHash squadID = do
Right removeID -> Right removeID ->
setMessage "Remove sent" setMessage "Remove sent"
redirect $ LoomCollabsR loomHash redirect $ LoomCollabsR loomHash
getLoomTeamLiveR :: KeyHashid Loom -> KeyHashid SquadUsStart -> Handler ()
getLoomTeamLiveR loomHash startHash = do
loomID <- decodeKeyHashid404 loomHash
startID <- decodeKeyHashid404 startHash
runDB $ do
loom <- get404 loomID
SquadUsStart usAcceptID _ <- get404 startID
SquadUsAccept squadID _ <- getJust usAcceptID
Squad _ resourceID <- getJust squadID
unless (resourceID == loomResource loom) notFound

View file

@ -58,6 +58,7 @@ module Vervis.Handler.Project
, postProjectAddTeamR , postProjectAddTeamR
, postProjectApproveTeamR , postProjectApproveTeamR
, postProjectRemoveTeamR , postProjectRemoveTeamR
, getProjectTeamLiveR
) )
where where
@ -1371,3 +1372,14 @@ postProjectRemoveTeamR projectHash squadID = do
Right removeID -> Right removeID ->
setMessage "Remove sent" setMessage "Remove sent"
redirect $ ProjectCollabsR projectHash redirect $ ProjectCollabsR projectHash
getProjectTeamLiveR :: KeyHashid Project -> KeyHashid SquadUsStart -> Handler ()
getProjectTeamLiveR projectHash startHash = do
projectID <- decodeKeyHashid404 projectHash
startID <- decodeKeyHashid404 startHash
runDB $ do
project <- get404 projectID
SquadUsStart usAcceptID _ <- get404 startID
SquadUsAccept squadID _ <- getJust usAcceptID
Squad _ resourceID <- getJust squadID
unless (resourceID == projectResource project) notFound

View file

@ -57,6 +57,7 @@ module Vervis.Handler.Repo
, postRepoAddTeamR , postRepoAddTeamR
, postRepoApproveTeamR , postRepoApproveTeamR
, postRepoRemoveTeamR , postRepoRemoveTeamR
, getRepoTeamLiveR
@ -988,6 +989,17 @@ postRepoRemoveTeamR repoHash squadID = do
setMessage "Remove sent" setMessage "Remove sent"
redirect $ RepoCollabsR repoHash redirect $ RepoCollabsR repoHash
getRepoTeamLiveR :: KeyHashid Repo -> KeyHashid SquadUsStart -> Handler ()
getRepoTeamLiveR repoHash startHash = do
repoID <- decodeKeyHashid404 repoHash
startID <- decodeKeyHashid404 startHash
runDB $ do
repo <- get404 repoID
SquadUsStart usAcceptID _ <- get404 startID
SquadUsAccept squadID _ <- getJust usAcceptID
Squad _ resourceID <- getJust squadID
unless (resourceID == repoResource repo) notFound

View file

@ -245,6 +245,7 @@
/repos/#RepoKeyHashid/add-team RepoAddTeamR POST /repos/#RepoKeyHashid/add-team RepoAddTeamR POST
/repos/#RepoKeyHashid/approve-team/#SquadId RepoApproveTeamR POST /repos/#RepoKeyHashid/approve-team/#SquadId RepoApproveTeamR POST
/repos/#RepoKeyHashid/remove-team/#SquadId RepoRemoveTeamR POST /repos/#RepoKeyHashid/remove-team/#SquadId RepoRemoveTeamR POST
/repos/#RepoKeyHashid/teams/#SquadUsStartKeyHashid/live RepoTeamLiveR GET
---- Deck -------------------------------------------------------------------- ---- Deck --------------------------------------------------------------------
@ -281,6 +282,7 @@
/decks/#DeckKeyHashid/add-team DeckAddTeamR POST /decks/#DeckKeyHashid/add-team DeckAddTeamR POST
/decks/#DeckKeyHashid/approve-team/#SquadId DeckApproveTeamR POST /decks/#DeckKeyHashid/approve-team/#SquadId DeckApproveTeamR POST
/decks/#DeckKeyHashid/remove-team/#SquadId DeckRemoveTeamR POST /decks/#DeckKeyHashid/remove-team/#SquadId DeckRemoveTeamR POST
/decks/#DeckKeyHashid/teams/#SquadUsStartKeyHashid/live DeckTeamLiveR GET
---- Ticket ------------------------------------------------------------------ ---- Ticket ------------------------------------------------------------------
@ -340,6 +342,7 @@
/looms/#LoomKeyHashid/add-team LoomAddTeamR POST /looms/#LoomKeyHashid/add-team LoomAddTeamR POST
/looms/#LoomKeyHashid/approve-team/#SquadId LoomApproveTeamR POST /looms/#LoomKeyHashid/approve-team/#SquadId LoomApproveTeamR POST
/looms/#LoomKeyHashid/remove-team/#SquadId LoomRemoveTeamR POST /looms/#LoomKeyHashid/remove-team/#SquadId LoomRemoveTeamR POST
/looms/#LoomKeyHashid/teams/#SquadUsStartKeyHashid/live LoomTeamLiveR GET
---- Cloth ------------------------------------------------------------------- ---- Cloth -------------------------------------------------------------------
@ -418,3 +421,4 @@
/projects/#ProjectKeyHashid/add-team ProjectAddTeamR POST /projects/#ProjectKeyHashid/add-team ProjectAddTeamR POST
/projects/#ProjectKeyHashid/approve-team/#SquadId ProjectApproveTeamR POST /projects/#ProjectKeyHashid/approve-team/#SquadId ProjectApproveTeamR POST
/projects/#ProjectKeyHashid/remove-team/#SquadId ProjectRemoveTeamR POST /projects/#ProjectKeyHashid/remove-team/#SquadId ProjectRemoveTeamR POST
/projects/#ProjectKeyHashid/teams/#SquadUsStartKeyHashid/live ProjectTeamLiveR GET