Introduce basic structures for teams
This commit is contained in:
parent
c176c65393
commit
aa3831ee6b
@ -896,7 +896,8 @@ getSubmission userId repoId commit challengeId subDescription chan = do
|
||||
submissionSubmitter=userId,
|
||||
submissionIsPublic=False,
|
||||
submissionIsHidden=False,
|
||||
submissionVersion=challengeVersion challenge}
|
||||
submissionVersion=challengeVersion challenge,
|
||||
submissionTeam=Nothing }
|
||||
|
||||
getSubmissionRepo :: UserId -> Key Challenge -> RepoSpec -> Channel -> Handler (Maybe (Key Repo))
|
||||
getSubmissionRepo userId challengeId repoSpec chan = getPossiblyExistingRepo checkRepoAvailibility userId challengeId repoSpec chan
|
||||
|
1
Model.hs
1
Model.hs
@ -9,6 +9,7 @@ import GEval.Core
|
||||
import GEval.EvaluationScheme
|
||||
import PersistMetric
|
||||
import PersistEvaluationScheme
|
||||
import PersistTeamActionType
|
||||
|
||||
-- You can define all of your database entities in the entities file.
|
||||
-- You can find more information on persistent and how to declare entities
|
||||
|
20
PersistTeamActionType.hs
Normal file
20
PersistTeamActionType.hs
Normal file
@ -0,0 +1,20 @@
|
||||
module PersistTeamActionType where
|
||||
|
||||
import ClassyPrelude.Yesod
|
||||
import Database.Persist.Sql
|
||||
|
||||
import qualified Data.Text as T
|
||||
|
||||
data TeamActionType = TeamCreation | TeamJoining | TeamLeaving
|
||||
deriving (Eq, Show, Read)
|
||||
|
||||
instance PersistField TeamActionType where
|
||||
toPersistValue m = PersistText (T.pack $ show m)
|
||||
|
||||
fromPersistValue (PersistText t) = case readMay t of
|
||||
Just val -> Right val
|
||||
Nothing -> Left ("Unexpected value '" ++ t ++ "'")
|
||||
fromPersistValue _ = Left "Unexpected value"
|
||||
|
||||
instance PersistFieldSql TeamActionType where
|
||||
sqlType _ = SqlString
|
@ -12,6 +12,20 @@ User
|
||||
triggerToken Text Maybe
|
||||
altRepoScheme Text Maybe
|
||||
deriving Typeable
|
||||
Team
|
||||
ident Text
|
||||
avatar ByteString Maybe
|
||||
UniqueTeam ident
|
||||
TeamMember
|
||||
user UserId
|
||||
team TeamId
|
||||
isCaptain Bool
|
||||
TeamLog
|
||||
stamp UTCTime default=now()
|
||||
actionType TeamActionType
|
||||
agens UserId
|
||||
patiens UserId Maybe
|
||||
verificationKey Text Maybe
|
||||
PublicKey
|
||||
user UserId
|
||||
pubkey Text
|
||||
@ -90,6 +104,7 @@ Submission
|
||||
isHidden Bool default=False
|
||||
-- challenge version present when the submission was done
|
||||
version SHA1
|
||||
team UserId Maybe
|
||||
UniqueSubmissionRepoCommitChallenge repo commit challenge
|
||||
Variant
|
||||
submission SubmissionId
|
||||
|
@ -27,6 +27,7 @@ library
|
||||
PersistEvaluationScheme
|
||||
PersistMetric
|
||||
PersistSHA1
|
||||
PersistTeamActionType
|
||||
Settings
|
||||
Settings.StaticFiles
|
||||
Handler.Common
|
||||
|
Loading…
Reference in New Issue
Block a user