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
collabAnon RoleId Maybe
inbox InboxId
outbox OutboxId
followers FollowerSetId
UniqueProject ident sharer
UniqueProjectInbox inbox
UniqueProjectOutbox outbox
UniqueProjectFollowers followers
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 "Guest role" (Just $ projectCollabAnon project)
<*> pure (projectInbox project)
<*> pure (projectOutbox project)
<*> pure (projectFollowers project)
where
selectWiki =

View file

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

View file

@ -821,6 +821,20 @@ changes hLocal ctx =
"Outbox"
-- 120
, 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

View file

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