Add Ticket to persistent model

This commit is contained in:
fr33domlover 2016-04-30 20:40:33 +00:00
parent dbf0c5a2cb
commit 5f909bd3b3
3 changed files with 21 additions and 8 deletions

View file

@ -41,10 +41,11 @@ Group
UniqueGroupIdent ident
Project
ident Text --CI
sharer SharerId
name Text Maybe
desc Text Maybe
ident Text --CI
sharer SharerId
name Text Maybe
desc Text Maybe
nextTicket Int default='0'
UniqueProject ident sharer
@ -62,3 +63,13 @@ PersonInGroup
group GroupId
UniquePersonInGroup person group
Ticket
project ProjectId
number Int
created UTCTime
title Text
desc Text -- Assume this is Pandoc Markdown
done Bool
UniqueTicket project number

View file

@ -38,10 +38,11 @@ checkIdentTemplate =
checkIdentUnique :: SharerId -> Field Handler Text -> Field Handler Text
checkIdentUnique sid = checkM $ \ ident -> do
let project = Project
{ projectIdent = ident
, projectSharer = sid
, projectName = Nothing
, projectDesc = Nothing
{ projectIdent = ident
, projectSharer = sid
, projectName = Nothing
, projectDesc = Nothing
, projectNextTicket = 0
}
mup <- runDB $ checkUnique project
return $ if isNothing mup

View file

@ -28,6 +28,7 @@ newProjectAForm sid = Project
<*> pure sid
<*> aopt textField "Name" Nothing
<*> aopt textField "Description" Nothing
<*> pure 0
newProjectForm :: SharerId -> Form Project
newProjectForm = renderDivs . newProjectAForm