diff --git a/migrations/638_2024-05-14_effort_squad.model b/migrations/638_2024-05-14_effort_squad.model new file mode 100644 index 0000000..5ae9b34 --- /dev/null +++ b/migrations/638_2024-05-14_effort_squad.model @@ -0,0 +1,363 @@ +------------------------------------------------------------------------------ +-- Team tracking its resources (project, repo-deck-loom) +------------------------------------------------------------------------------ + +Effort + role Role + holder GroupId + +-------------------------------- Effort topic -------------------------------- + +EffortTopicLocal + effort EffortId + + UniqueEffortTopicLocal effort + +EffortTopicProject + topic EffortTopicLocalId + project ProjectId + + UniqueEffortTopicProject topic + +EffortTopicComponent + topic EffortTopicLocalId + component KomponentId + + UniqueEffortTopicComponent topic + +EffortTopicRemote + effort EffortId + topic RemoteActorId + + UniqueEffortTopicRemote effort + +-------------------------------- Effort flow --------------------------------- + +EffortOriginUs + effort EffortId + + UniqueEffortOriginUs effort + +EffortOriginThem + effort EffortId + + UniqueEffortOriginThem effort + +-- Our collaborator's gesture +-- +-- OriginUs: The Add that started the sequence +-- OriginThem: N/A (they send their Accept but we don't record it) + +EffortUsGestureLocal + us EffortOriginUsId + add OutboxItemId + + UniqueEffortUsGestureLocal us + UniqueEffortUsGestureLocalAdd add + +EffortUsGestureRemote + us EffortOriginUsId + actor RemoteActorId + add RemoteActivityId + + UniqueEffortUsGestureRemote us + UniqueEffortUsGestureRemoteAdd add + +-- Our accept +-- +-- OriginUs: I checked the Add and sending my Accept +-- OriginThem: N/A + +EffortUsAccept + us EffortOriginUsId + accept OutboxItemId + + UniqueEffortUsAccept us + UniqueEffortUsAcceptAccept accept + +-- Their collaborator's gesture +-- +-- OriginUs: N/A (they send it but we don't record it) +-- OriginThem: The Add that started the sequence + +EffortThemGestureLocal + them EffortOriginThemId + add OutboxItemId + + UniqueEffortThemGestureLocal them + UniqueEffortThemGestureLocalAdd add + +EffortThemGestureRemote + them EffortOriginThemId + actor RemoteActorId + add RemoteActivityId + + UniqueEffortThemGestureRemote them + UniqueEffortThemGestureRemoteAdd add + +-- Their accept +-- +-- OriginUs: Seeing our accept and their collaborator's accept, they send their +-- own accept +-- OriginThem: Checking the Add, they send their Accept + +EffortThemAcceptLocal + topic EffortTopicLocalId + accept OutboxItemId + + UniqueEffortThemAcceptLocal topic + UniqueEffortThemAcceptLocalAccept accept + +EffortThemAcceptRemote + topic EffortTopicRemoteId + accept RemoteActivityId + + UniqueEffortThemAcceptRemote topic + UniqueEffortThemAcceptRemoteAccept accept + +-------------------------------- Effort enable ------------------------------- + +-- Witnesses that, seeing their approval and our collaborator's gesture, I've +-- sent them a delegator-Grant and now officially considering them a effort of +-- us +EffortUsSendDelegator + effort EffortId + grant OutboxItemId + + UniqueEffortUsSendDelegator effort + UniqueEffortUsSendDelegatorGrant grant + +-- Witnesses that, using the delegator-Grant, they sent us a start-Grant or +-- extension-Grant to delegate further + +EffortThemDelegateLocal + effort EffortThemAcceptLocalId + grant OutboxItemId + + UniqueEffortThemDelegateLocal grant + +EffortThemDelegateRemote + effort EffortThemAcceptRemoteId + grant RemoteActivityId + + UniqueEffortThemDelegateRemote grant + +-- Witnesses that, seeing the delegation from them, I've sent an +-- extension-Grant to a Dest of mine + +EffortUsDistribute + effort EffortUsSendDelegatorId + dest DestUsStartId + grant OutboxItemId + +EffortUsDistributeFromLocal + distribute EffortUsDistributeId + from EffortThemDelegateLocalId + + UniqueEffortUsDistributeFromLocal distribute + +EffortUsDistributeFromRemote + distribute EffortUsDistributeId + from EffortThemDelegateRemoteId + + UniqueEffortUsDistributeFromRemote distribute + +-- Witnesses that, seeing the delegation from them, I've sent a leaf-Grant to a +-- direct-collaborator of mine + +EffortUsLeaf + effort EffortUsSendDelegatorId + collab CollabEnableId + grant OutboxItemId + +EffortUsLeafFromLocal + leaf EffortUsLeafId + from EffortThemDelegateLocalId + + UniqueEffortUsLeafFromLocal leaf + +EffortUsLeafFromRemote + leaf EffortUsLeafId + from EffortThemDelegateRemoteId + + UniqueEffortUsLeafFromRemote leaf + +EffortUsLeafToLocal + leaf EffortUsLeafId + to CollabDelegLocalId + + UniqueEffortUsLeafToLocal leaf + +EffortUsLeafToRemote + leaf EffortUsLeafId + to CollabDelegRemoteId + + UniqueEffortUsLeafToRemote leaf + +-------------------------------- Effort remove ------------------------------- + +-- Witnesses there's a removal request from the child's side, and I'm waiting +-- for the child project/team to Accept, which is when I'll do the removal on +-- my side + +EffortRemove + send EffortUsSendDelegatorId + activity InboxItemId + + UniqueEffortRemove activity + +------------------------------------------------------------------------------ +-- Non-team resource tracking its teams +------------------------------------------------------------------------------ + +Squad + role Role + +SquadHolderProject + squad SquadId + project ProjectId + + UniqueSquadHolderProject squad + +SquadHolderComponent + squad SquadId + component KomponentId + + UniqueSquadHolderComponent squad + +---------------------------------- Squad topic -------------------------------- + +SquadTopicLocal + squad SquadId + group GroupId + + UniqueSquadTopicLocal squad + +SquadTopicRemote + squad SquadId + topic RemoteActorId + + UniqueSquadTopicRemote squad + +---------------------------------- Squad flow --------------------------------- + +SquadOriginUs + squad SquadId + + UniqueSquadOriginUs squad + +SquadOriginThem + squad SquadId + + UniqueSquadOriginThem squad + +-- Our collaborator's gesture +-- +-- OriginUs: The Add that started the sequence +-- OriginThem: Seeing the Add and their Accept, my collaborator has sent her +-- Accept + +SquadUsGestureLocal + squad SquadId + activity OutboxItemId + + UniqueSquadUsGestureLocal squad + UniqueSquadUsGestureLocalActivity activity + +SquadUsGestureRemote + squad SquadId + actor RemoteActorId + activity RemoteActivityId + + UniqueSquadUsGestureRemote squad + UniqueSquadUsGestureRemoteActivity activity + +-- Our accept +-- +-- OriginUs: Checking my collaborator's Add, I sent my Accept +-- OriginThem: Seeing the Add, their Accept and my collaborator's Accept, I +-- sent my Accept + +SquadUsAccept + squad SquadId + accept OutboxItemId + + UniqueSquadUsAccept squad + UniqueSquadUsAcceptAccept accept + +-- Their collaborator's gesture +-- +-- OriginUs: N/A (they send it but we don't record it) +-- OriginThem: The Add that started the sequence + +SquadThemGestureLocal + them SquadOriginThemId + add OutboxItemId + + UniqueSquadThemGestureLocal them + UniqueSquadThemGestureLocalAdd add + +SquadThemGestureRemote + them SquadOriginThemId + actor RemoteActorId + add RemoteActivityId + + UniqueSquadThemGestureRemote them + UniqueSquadThemGestureRemoteAdd add + +-- Their accept +-- +-- OriginUs: N/A +-- OriginThem: Seeing their collaborator's Add, they sent an Accept + +SquadThemAcceptLocal + them SquadOriginThemId + topic SquadTopicLocalId + accept OutboxItemId + + UniqueSquadThemAcceptLocal them + UniqueSquadThemAcceptLocalTopic topic + UniqueSquadThemAcceptLocalAccept accept + +SquadThemAcceptRemote + them SquadOriginThemId + topic SquadTopicRemoteId + accept RemoteActivityId + + UniqueSquadThemAcceptRemote them + UniqueSquadThemAcceptRemoteTopic topic + UniqueSquadThemAcceptRemoteAccept accept + +---------------------------------- Squad enable ------------------------------- + +-- Witnesses that, seeing our approval and their collaborator's gesture, +-- they've sent us a delegator-Grant, and we now officially consider them a +-- squad of us + +SquadThemSendDelegatorLocal + squad SquadUsAcceptId + topic SquadTopicLocalId + grant OutboxItemId + + UniqueSquadThemSendDelegatorLocal squad + UniqueSquadThemSendDelegatorLocalTopic topic + UniqueSquadThemSendDelegatorLocalGrant grant + +SquadThemSendDelegatorRemote + squad SquadUsAcceptId + topic SquadTopicRemoteId + grant RemoteActivityId + + UniqueSquadThemSendDelegatorRemote squad + UniqueSquadThemSendDelegatorRemoteTopic topic + UniqueSquadThemSendDelegatorRemoteGrant grant + +-- Witnesses that, seeing the delegator-Grant, I've sent my new parent a +-- start-Grant to delegate further + +SquadUsStart + squad SquadUsAcceptId + grant OutboxItemId + + UniqueSquadUsStart squad + UniqueSquadUsStartGrant grant diff --git a/src/Vervis/Migration.hs b/src/Vervis/Migration.hs index b537ab7..ccd8165 100644 --- a/src/Vervis/Migration.hs +++ b/src/Vervis/Migration.hs @@ -3809,6 +3809,8 @@ changes hLocal ctx = , removeEntity "StemIdentDeck" -- 637 , removeEntity "StemIdentLoom" + -- 638 + , addEntities model_638_effort_squad ] migrateDB diff --git a/src/Vervis/Migration/Entities.hs b/src/Vervis/Migration/Entities.hs index 633c022..e3658d1 100644 --- a/src/Vervis/Migration/Entities.hs +++ b/src/Vervis/Migration/Entities.hs @@ -76,6 +76,7 @@ module Vervis.Migration.Entities , model_601_permit_extend_resource , model_603_resource , model_626_komponent + , model_638_effort_squad ) where @@ -297,3 +298,6 @@ model_603_resource = $(schema "603_2024-04-20_resource") model_626_komponent :: [Entity SqlBackend] model_626_komponent = $(schema "626_2024-04-29_komponent") + +model_638_effort_squad :: [Entity SqlBackend] +model_638_effort_squad = $(schema "638_2024-05-14_effort_squad") diff --git a/th/models b/th/models index 29c3f88..2e81062 100644 --- a/th/models +++ b/th/models @@ -1616,3 +1616,367 @@ DestUsStart UniqueDestUsStart dest UniqueDestUsStartGrant grant + +------------------------------------------------------------------------------ +-- Team tracking its resources (project, repo-deck-loom) +------------------------------------------------------------------------------ + +Effort + role Role + holder GroupId + +-------------------------------- Effort topic -------------------------------- + +EffortTopicLocal + effort EffortId + + UniqueEffortTopicLocal effort + +EffortTopicProject + topic EffortTopicLocalId + project ProjectId + + UniqueEffortTopicProject topic + +EffortTopicComponent + topic EffortTopicLocalId + component KomponentId + + UniqueEffortTopicComponent topic + +EffortTopicRemote + effort EffortId + topic RemoteActorId + + UniqueEffortTopicRemote effort + +-------------------------------- Effort flow --------------------------------- + +EffortOriginUs + effort EffortId + + UniqueEffortOriginUs effort + +EffortOriginThem + effort EffortId + + UniqueEffortOriginThem effort + +-- Our collaborator's gesture +-- +-- OriginUs: The Add that started the sequence +-- OriginThem: N/A (they send their Accept but we don't record it) + +EffortUsGestureLocal + us EffortOriginUsId + add OutboxItemId + + UniqueEffortUsGestureLocal us + UniqueEffortUsGestureLocalAdd add + +EffortUsGestureRemote + us EffortOriginUsId + actor RemoteActorId + add RemoteActivityId + + UniqueEffortUsGestureRemote us + UniqueEffortUsGestureRemoteAdd add + +-- Our accept +-- +-- OriginUs: I checked the Add and sending my Accept +-- OriginThem: N/A + +EffortUsAccept + us EffortOriginUsId + accept OutboxItemId + + UniqueEffortUsAccept us + UniqueEffortUsAcceptAccept accept + +-- Their collaborator's gesture +-- +-- OriginUs: N/A (they send it but we don't record it) +-- OriginThem: The Add that started the sequence + +EffortThemGestureLocal + them EffortOriginThemId + add OutboxItemId + + UniqueEffortThemGestureLocal them + UniqueEffortThemGestureLocalAdd add + +EffortThemGestureRemote + them EffortOriginThemId + actor RemoteActorId + add RemoteActivityId + + UniqueEffortThemGestureRemote them + UniqueEffortThemGestureRemoteAdd add + +-- Their accept +-- +-- OriginUs: Seeing our accept and their collaborator's accept, they send their +-- own accept +-- OriginThem: Checking the Add, they send their Accept + +EffortThemAcceptLocal + topic EffortTopicLocalId + accept OutboxItemId + + UniqueEffortThemAcceptLocal topic + UniqueEffortThemAcceptLocalAccept accept + +EffortThemAcceptRemote + topic EffortTopicRemoteId + accept RemoteActivityId + + UniqueEffortThemAcceptRemote topic + UniqueEffortThemAcceptRemoteAccept accept + +-------------------------------- Effort enable ------------------------------- + +-- Witnesses that, seeing their approval and our collaborator's gesture, I've +-- sent them a delegator-Grant and now officially considering them a effort of +-- us +EffortUsSendDelegator + effort EffortId + grant OutboxItemId + + UniqueEffortUsSendDelegator effort + UniqueEffortUsSendDelegatorGrant grant + +-- Witnesses that, using the delegator-Grant, they sent us a start-Grant or +-- extension-Grant to delegate further + +EffortThemDelegateLocal + effort EffortThemAcceptLocalId + grant OutboxItemId + + UniqueEffortThemDelegateLocal grant + +EffortThemDelegateRemote + effort EffortThemAcceptRemoteId + grant RemoteActivityId + + UniqueEffortThemDelegateRemote grant + +-- Witnesses that, seeing the delegation from them, I've sent an +-- extension-Grant to a Dest of mine + +EffortUsDistribute + effort EffortUsSendDelegatorId + dest DestUsStartId + grant OutboxItemId + +EffortUsDistributeFromLocal + distribute EffortUsDistributeId + from EffortThemDelegateLocalId + + UniqueEffortUsDistributeFromLocal distribute + +EffortUsDistributeFromRemote + distribute EffortUsDistributeId + from EffortThemDelegateRemoteId + + UniqueEffortUsDistributeFromRemote distribute + +-- Witnesses that, seeing the delegation from them, I've sent a leaf-Grant to a +-- direct-collaborator of mine + +EffortUsLeaf + effort EffortUsSendDelegatorId + collab CollabEnableId + grant OutboxItemId + +EffortUsLeafFromLocal + leaf EffortUsLeafId + from EffortThemDelegateLocalId + + UniqueEffortUsLeafFromLocal leaf + +EffortUsLeafFromRemote + leaf EffortUsLeafId + from EffortThemDelegateRemoteId + + UniqueEffortUsLeafFromRemote leaf + +EffortUsLeafToLocal + leaf EffortUsLeafId + to CollabDelegLocalId + + UniqueEffortUsLeafToLocal leaf + +EffortUsLeafToRemote + leaf EffortUsLeafId + to CollabDelegRemoteId + + UniqueEffortUsLeafToRemote leaf + +-------------------------------- Effort remove ------------------------------- + +-- Witnesses there's a removal request from the child's side, and I'm waiting +-- for the child project/team to Accept, which is when I'll do the removal on +-- my side + +EffortRemove + send EffortUsSendDelegatorId + activity InboxItemId + + UniqueEffortRemove activity + +------------------------------------------------------------------------------ +-- Non-team resource tracking its teams +------------------------------------------------------------------------------ + +Squad + role Role + +SquadHolderProject + squad SquadId + project ProjectId + + UniqueSquadHolderProject squad + +SquadHolderComponent + squad SquadId + component KomponentId + + UniqueSquadHolderComponent squad + +---------------------------------- Squad topic -------------------------------- + +SquadTopicLocal + squad SquadId + group GroupId + + UniqueSquadTopicLocal squad + +SquadTopicRemote + squad SquadId + topic RemoteActorId + + UniqueSquadTopicRemote squad + +---------------------------------- Squad flow --------------------------------- + +SquadOriginUs + squad SquadId + + UniqueSquadOriginUs squad + +SquadOriginThem + squad SquadId + + UniqueSquadOriginThem squad + +-- Our collaborator's gesture +-- +-- OriginUs: The Add that started the sequence +-- OriginThem: Seeing the Add and their Accept, my collaborator has sent her +-- Accept + +SquadUsGestureLocal + squad SquadId + activity OutboxItemId + + UniqueSquadUsGestureLocal squad + UniqueSquadUsGestureLocalActivity activity + +SquadUsGestureRemote + squad SquadId + actor RemoteActorId + activity RemoteActivityId + + UniqueSquadUsGestureRemote squad + UniqueSquadUsGestureRemoteActivity activity + +-- Our accept +-- +-- OriginUs: Checking my collaborator's Add, I sent my Accept +-- OriginThem: Seeing the Add, their Accept and my collaborator's Accept, I +-- sent my Accept + +SquadUsAccept + squad SquadId + accept OutboxItemId + + UniqueSquadUsAccept squad + UniqueSquadUsAcceptAccept accept + +-- Their collaborator's gesture +-- +-- OriginUs: N/A (they send it but we don't record it) +-- OriginThem: The Add that started the sequence + +SquadThemGestureLocal + them SquadOriginThemId + add OutboxItemId + + UniqueSquadThemGestureLocal them + UniqueSquadThemGestureLocalAdd add + +SquadThemGestureRemote + them SquadOriginThemId + actor RemoteActorId + add RemoteActivityId + + UniqueSquadThemGestureRemote them + UniqueSquadThemGestureRemoteAdd add + +-- Their accept +-- +-- OriginUs: N/A +-- OriginThem: Seeing their collaborator's Add, they sent an Accept + +SquadThemAcceptLocal + them SquadOriginThemId + topic SquadTopicLocalId + accept OutboxItemId + + UniqueSquadThemAcceptLocal them + UniqueSquadThemAcceptLocalTopic topic + UniqueSquadThemAcceptLocalAccept accept + +SquadThemAcceptRemote + them SquadOriginThemId + topic SquadTopicRemoteId + accept RemoteActivityId + + UniqueSquadThemAcceptRemote them + UniqueSquadThemAcceptRemoteTopic topic + UniqueSquadThemAcceptRemoteAccept accept + +---------------------------------- Squad enable ------------------------------- + +-- Witnesses that, seeing our approval and their collaborator's gesture, +-- they've sent us a delegator-Grant, and we now officially consider them a +-- squad of us + +SquadThemSendDelegatorLocal + squad SquadUsAcceptId + topic SquadTopicLocalId + grant OutboxItemId + + UniqueSquadThemSendDelegatorLocal squad + UniqueSquadThemSendDelegatorLocalTopic topic + UniqueSquadThemSendDelegatorLocalGrant grant + +SquadThemSendDelegatorRemote + squad SquadUsAcceptId + topic SquadTopicRemoteId + grant RemoteActivityId + + UniqueSquadThemSendDelegatorRemote squad + UniqueSquadThemSendDelegatorRemoteTopic topic + UniqueSquadThemSendDelegatorRemoteGrant grant + +-- Witnesses that, seeing the delegator-Grant, I've sent my new parent a +-- start-Grant to delegate further + +SquadUsStart + squad SquadUsAcceptId + grant OutboxItemId + + UniqueSquadUsStart squad + UniqueSquadUsStartGrant grant