DB: Allow to record the delegator-Grant sent by people to projects/teams
This commit is contained in:
parent
7517db9619
commit
5d0f707c55
6 changed files with 163 additions and 7 deletions
17
migrations/552_2023-11-21_collab_deleg.model
Normal file
17
migrations/552_2023-11-21_collab_deleg.model
Normal file
|
@ -0,0 +1,17 @@
|
|||
CollabDelegLocal
|
||||
enable CollabEnableId
|
||||
recip CollabRecipLocalId
|
||||
grant OutboxItemId
|
||||
|
||||
UniqueCollabDelegLocal enable
|
||||
UniqueCollabDelegLocalRecip recip
|
||||
UniqueCollabDelegLocalGrant grant
|
||||
|
||||
CollabDelegRemote
|
||||
enable CollabEnableId
|
||||
recip CollabRecipRemoteId
|
||||
grant RemoteActivityId
|
||||
|
||||
UniqueCollabDelegRemote enable
|
||||
UniqueCollabDelegRemoteRecip recip
|
||||
UniqueCollabDelegRemoteGrant grant
|
91
migrations/553_2023-11-21_collab_deleg.model
Normal file
91
migrations/553_2023-11-21_collab_deleg.model
Normal file
|
@ -0,0 +1,91 @@
|
|||
Inbox
|
||||
FollowerSet
|
||||
|
||||
Outbox
|
||||
|
||||
OutboxItem
|
||||
outbox OutboxId
|
||||
activity PersistJSONObject
|
||||
published UTCTime
|
||||
|
||||
Actor
|
||||
name Text
|
||||
desc Text
|
||||
createdAt UTCTime
|
||||
inbox InboxId
|
||||
outbox OutboxId
|
||||
followers FollowerSetId
|
||||
justCreatedBy ActorId Maybe
|
||||
|
||||
UniqueActorInbox inbox
|
||||
UniqueActorOutbox outbox
|
||||
UniqueActorFollowers followers
|
||||
|
||||
Person
|
||||
username Username
|
||||
login Text
|
||||
passphraseHash ByteString
|
||||
email EmailAddress
|
||||
verified Bool
|
||||
verifiedKey Text
|
||||
verifiedKeyCreated UTCTime
|
||||
resetPassKey Text
|
||||
resetPassKeyCreated UTCTime
|
||||
actor ActorId
|
||||
-- reviewFollow Bool
|
||||
|
||||
UniquePersonUsername username
|
||||
UniquePersonLogin login
|
||||
UniquePersonEmail email
|
||||
UniquePersonActor actor
|
||||
|
||||
Collab
|
||||
role Role
|
||||
|
||||
CollabTopicProject
|
||||
collab CollabId
|
||||
project ProjectId
|
||||
|
||||
UniqueCollabTopicProject collab
|
||||
|
||||
Project
|
||||
actor ActorId
|
||||
create OutboxItemId
|
||||
|
||||
UniqueProjectActor actor
|
||||
UniqueProjectCreate create
|
||||
|
||||
CollabTopicGroup
|
||||
collab CollabId
|
||||
group GroupId
|
||||
|
||||
UniqueCollabTopicGroup collab
|
||||
|
||||
Group
|
||||
actor ActorId
|
||||
create OutboxItemId
|
||||
|
||||
UniqueGroupActor actor
|
||||
UniqueGroupCreate create
|
||||
|
||||
CollabRecipLocal
|
||||
collab CollabId
|
||||
person PersonId
|
||||
|
||||
UniqueCollabRecipLocal collab
|
||||
|
||||
CollabEnable
|
||||
collab CollabId
|
||||
grant OutboxItemId
|
||||
|
||||
UniqueCollabEnable collab
|
||||
UniqueCollabEnableGrant grant
|
||||
|
||||
CollabDelegLocal
|
||||
enable CollabEnableId
|
||||
recip CollabRecipLocalId
|
||||
grant OutboxItemId
|
||||
|
||||
UniqueCollabDelegLocal enable
|
||||
UniqueCollabDelegLocalRecip recip
|
||||
UniqueCollabDelegLocalGrant grant
|
|
@ -3049,6 +3049,23 @@ changes hLocal ctx =
|
|||
, addUnique' "Group" "Create" ["create"]
|
||||
-- 551
|
||||
, addEntities model_551_group_collab
|
||||
-- 552
|
||||
, addEntities model_552_collab_deleg
|
||||
-- 553
|
||||
, unchecked $ lift $ do
|
||||
collabIDs <-
|
||||
liftA2 (++)
|
||||
(map (collabTopicProject553Collab . entityVal) <$> selectList [] [])
|
||||
(map (collabTopicGroup553Collab . entityVal) <$> selectList [] [])
|
||||
let doc = persistJSONObjectFromDoc $ Doc hLocal emptyActivity
|
||||
for_ collabIDs $ \ collabID -> do
|
||||
e <- getKeyBy $ UniqueCollabEnable553 collabID
|
||||
r <- getBy $ UniqueCollabRecipLocal553 collabID
|
||||
for_ e $ \ enableID -> for_ r $ \ (Entity recipID (CollabRecipLocal553 _ personID)) -> do
|
||||
actorID <- person553Actor <$> getJust personID
|
||||
outboxID <- actor553Outbox <$> getJust actorID
|
||||
itemID <- insert $ OutboxItem553 outboxID doc defaultTime
|
||||
insert_ $ CollabDelegLocal553 enableID recipID itemID
|
||||
]
|
||||
|
||||
migrateDB
|
||||
|
|
|
@ -65,6 +65,7 @@ module Vervis.Migration.Entities
|
|||
, model_541_project
|
||||
, model_542_component
|
||||
, model_551_group_collab
|
||||
, model_552_collab_deleg
|
||||
)
|
||||
where
|
||||
|
||||
|
@ -252,3 +253,6 @@ model_542_component = $(schema "542_2023-06-26_component")
|
|||
|
||||
model_551_group_collab :: [Entity SqlBackend]
|
||||
model_551_group_collab = $(schema "551_2023-11-21_group_collab")
|
||||
|
||||
model_552_collab_deleg :: [Entity SqlBackend]
|
||||
model_552_collab_deleg = $(schema "552_2023-11-21_collab_deleg")
|
||||
|
|
|
@ -531,3 +531,6 @@ makeEntitiesMigration "547"
|
|||
|
||||
makeEntitiesMigration "549"
|
||||
$(modelFile "migrations/549_2023-11-21_group_create.model")
|
||||
|
||||
makeEntitiesMigration "553"
|
||||
$(modelFile "migrations/553_2023-11-21_collab_deleg.model")
|
||||
|
|
38
th/models
38
th/models
|
@ -682,13 +682,6 @@ CollabTopicGroup
|
|||
|
||||
UniqueCollabTopicGroup collab
|
||||
|
||||
CollabEnable
|
||||
collab CollabId
|
||||
grant OutboxItemId
|
||||
|
||||
UniqueCollabEnable collab
|
||||
UniqueCollabEnableGrant grant
|
||||
|
||||
-------------------------------- Collab recipient ----------------------------
|
||||
|
||||
CollabRecipLocal
|
||||
|
@ -721,6 +714,37 @@ CollabRecipRemoteAccept
|
|||
UniqueCollabRecipRemoteAcceptInvite invite
|
||||
UniqueCollabRecipRemoteAcceptAccept accept
|
||||
|
||||
-------------------------------- Collab enable -------------------------------
|
||||
|
||||
CollabEnable
|
||||
collab CollabId
|
||||
grant OutboxItemId
|
||||
|
||||
UniqueCollabEnable collab
|
||||
UniqueCollabEnableGrant grant
|
||||
|
||||
-- Component: N/A
|
||||
-- Project/Team: Witnesses that using the above Grant, the collaborator has
|
||||
-- sent me a delegator-Grant, which I can now use to extend chains to them
|
||||
|
||||
CollabDelegLocal
|
||||
enable CollabEnableId
|
||||
recip CollabRecipLocalId
|
||||
grant OutboxItemId
|
||||
|
||||
UniqueCollabDelegLocal enable
|
||||
UniqueCollabDelegLocalRecip recip
|
||||
UniqueCollabDelegLocalGrant grant
|
||||
|
||||
CollabDelegRemote
|
||||
enable CollabEnableId
|
||||
recip CollabRecipRemoteId
|
||||
grant RemoteActivityId
|
||||
|
||||
UniqueCollabDelegRemote enable
|
||||
UniqueCollabDelegRemoteRecip recip
|
||||
UniqueCollabDelegRemoteGrant grant
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
-- Components, from project perspective
|
||||
------------------------------------------------------------------------------
|
||||
|
|
Loading…
Reference in a new issue