Give Project an Outbox in the DB

This commit is contained in:
fr33domlover 2019-06-16 21:34:06 +00:00
parent 64a377b12f
commit a65979f5af
6 changed files with 44 additions and 0 deletions

View file

@ -218,10 +218,12 @@ Project
collabUser RoleId Maybe collabUser RoleId Maybe
collabAnon RoleId Maybe collabAnon RoleId Maybe
inbox InboxId inbox InboxId
outbox OutboxId
followers FollowerSetId followers FollowerSetId
UniqueProject ident sharer UniqueProject ident sharer
UniqueProjectInbox inbox UniqueProjectInbox inbox
UniqueProjectOutbox outbox
UniqueProjectFollowers followers UniqueProjectFollowers followers
Repo Repo

View file

@ -0,0 +1,19 @@
Outbox
Project
ident PrjIdent
sharer Int64
name Text Maybe
desc Text Maybe
workflow Int64
nextTicket Int
wiki Int64 Maybe
collabUser Int64 Maybe
collabAnon Int64 Maybe
inbox Int64
outbox OutboxId
followers Int64
UniqueProject ident sharer
UniqueProjectInbox inbox
UniqueProjectFollowers followers

View file

@ -123,6 +123,7 @@ editProjectAForm sid (Entity jid project) = Project
<*> aopt selectRole "User role" (Just $ projectCollabUser project) <*> aopt selectRole "User role" (Just $ projectCollabUser project)
<*> aopt selectRole "Guest role" (Just $ projectCollabAnon project) <*> aopt selectRole "Guest role" (Just $ projectCollabAnon project)
<*> pure (projectInbox project) <*> pure (projectInbox project)
<*> pure (projectOutbox project)
<*> pure (projectFollowers project) <*> pure (projectFollowers project)
where where
selectWiki = selectWiki =

View file

@ -87,6 +87,7 @@ postProjectsR shr = do
pid <- requireAuthId pid <- requireAuthId
runDB $ do runDB $ do
ibid <- insert Inbox ibid <- insert Inbox
obid <- insert Outbox
fsid <- insert FollowerSet fsid <- insert FollowerSet
let project = Project let project = Project
{ projectIdent = npIdent np { projectIdent = npIdent np
@ -99,6 +100,7 @@ postProjectsR shr = do
, projectCollabAnon = Nothing , projectCollabAnon = Nothing
, projectCollabUser = Nothing , projectCollabUser = Nothing
, projectInbox = ibid , projectInbox = ibid
, projectOutbox = obid
, projectFollowers = fsid , projectFollowers = fsid
} }
jid <- insert project jid <- insert project

View file

@ -821,6 +821,20 @@ changes hLocal ctx =
"Outbox" "Outbox"
-- 120 -- 120
, removeField "OutboxItem" "person" , removeField "OutboxItem" "person"
-- 121
, addFieldRefRequired'
"Project"
Outbox20190616
(Just $ do
jids <- selectKeysList ([] :: [Filter Project20190616]) []
for_ jids $ \ jid -> do
obid <- insert Outbox20190616
update jid [Project20190616Outbox =. obid]
)
"outbox"
"Outbox"
-- 122
, addUnique "Project" $ Unique "UniqueProjectOutbox" ["outbox"]
] ]
migrateDB migrateDB

View file

@ -96,6 +96,9 @@ module Vervis.Migration.Model
, Outbox20190615Generic (..) , Outbox20190615Generic (..)
, OutboxItem20190615Generic (..) , OutboxItem20190615Generic (..)
, OutboxItem20190615 , OutboxItem20190615
, Project20190616Generic (..)
, Project20190616
, Outbox20190616Generic (..)
) )
where where
@ -207,3 +210,6 @@ makeEntitiesMigration "20190612"
makeEntitiesMigration "20190615" makeEntitiesMigration "20190615"
$(modelFile "migrations/2019_06_15.model") $(modelFile "migrations/2019_06_15.model")
makeEntitiesMigration "20190616"
$(modelFile "migrations/2019_06_16.model")