forked from filipg/gonito
Team in end-points
This commit is contained in:
parent
b38342fb0e
commit
602f4c39ca
@ -73,6 +73,7 @@ import Data.HashMap.Strict.InsOrd (fromList)
|
|||||||
instance ToJSON LeaderboardEntry where
|
instance ToJSON LeaderboardEntry where
|
||||||
toJSON entry = object
|
toJSON entry = object
|
||||||
[ "submitter" .= (formatSubmitter $ leaderboardUser entry)
|
[ "submitter" .= (formatSubmitter $ leaderboardUser entry)
|
||||||
|
, "team" .= (teamIdent <$> entityVal <$> leaderboardTeam entry)
|
||||||
, "when" .= (submissionStamp $ leaderboardBestSubmission entry)
|
, "when" .= (submissionStamp $ leaderboardBestSubmission entry)
|
||||||
, "version" .= (formatVersion $ leaderboardVersion entry)
|
, "version" .= (formatVersion $ leaderboardVersion entry)
|
||||||
, "description" .= descriptionToBeShown (leaderboardBestSubmission entry)
|
, "description" .= descriptionToBeShown (leaderboardBestSubmission entry)
|
||||||
@ -171,6 +172,7 @@ instance ToSchema LeaderboardEntryView where
|
|||||||
& type_ .~ SwaggerObject
|
& type_ .~ SwaggerObject
|
||||||
& properties .~
|
& properties .~
|
||||||
fromList [ ("submitter", stringSchema)
|
fromList [ ("submitter", stringSchema)
|
||||||
|
, ("team", stringSchema)
|
||||||
, ("when", stringSchema)
|
, ("when", stringSchema)
|
||||||
, ("version", stringSchema)
|
, ("version", stringSchema)
|
||||||
, ("description", stringSchema)
|
, ("description", stringSchema)
|
||||||
@ -1081,7 +1083,8 @@ convertTableEntryToView tests entry = do
|
|||||||
submissionViewIsOwner = (entityKey <$> mUserId) == Just (submissionSubmitter submission),
|
submissionViewIsOwner = (entityKey <$> mUserId) == Just (submissionSubmitter submission),
|
||||||
submissionViewIsReevaluable = isReevaluable,
|
submissionViewIsReevaluable = isReevaluable,
|
||||||
submissionViewIsVisible = isVisible,
|
submissionViewIsVisible = isVisible,
|
||||||
submissionViewIsPublic = submissionIsPublic submission
|
submissionViewIsPublic = submissionIsPublic submission,
|
||||||
|
submissionViewTeam = teamIdent <$> entityVal <$> tableEntryTeam entry
|
||||||
}
|
}
|
||||||
where submission = entityVal $ tableEntrySubmission entry
|
where submission = entityVal $ tableEntrySubmission entry
|
||||||
|
|
||||||
@ -1176,7 +1179,8 @@ data SubmissionView = SubmissionView {
|
|||||||
submissionViewIsOwner :: Bool,
|
submissionViewIsOwner :: Bool,
|
||||||
submissionViewIsReevaluable :: Bool,
|
submissionViewIsReevaluable :: Bool,
|
||||||
submissionViewIsVisible :: Bool,
|
submissionViewIsVisible :: Bool,
|
||||||
submissionViewIsPublic :: Bool
|
submissionViewIsPublic :: Bool,
|
||||||
|
submissionViewTeam :: Maybe Text
|
||||||
}
|
}
|
||||||
|
|
||||||
instance ToJSON SubmissionView where
|
instance ToJSON SubmissionView where
|
||||||
@ -1195,6 +1199,7 @@ instance ToJSON SubmissionView where
|
|||||||
, "isReevaluable" .= submissionViewIsReevaluable s
|
, "isReevaluable" .= submissionViewIsReevaluable s
|
||||||
, "isVisible" .= submissionViewIsVisible s
|
, "isVisible" .= submissionViewIsVisible s
|
||||||
, "isPublic" .= submissionViewIsPublic s
|
, "isPublic" .= submissionViewIsPublic s
|
||||||
|
, "team" .= submissionViewTeam s
|
||||||
]
|
]
|
||||||
|
|
||||||
instance ToSchema SubmissionView where
|
instance ToSchema SubmissionView where
|
||||||
@ -1222,6 +1227,7 @@ instance ToSchema SubmissionView where
|
|||||||
, ("isReevaluable", boolSchema)
|
, ("isReevaluable", boolSchema)
|
||||||
, ("isVisible", boolSchema)
|
, ("isVisible", boolSchema)
|
||||||
, ("isPublic", boolSchema)
|
, ("isPublic", boolSchema)
|
||||||
|
, ("team", stringSchema)
|
||||||
]
|
]
|
||||||
& required .~ [ "id", "variant", "rank", "submitter", "when", "version",
|
& required .~ [ "id", "variant", "rank", "submitter", "when", "version",
|
||||||
"description", "tags", "hash", "evaluations",
|
"description", "tags", "hash", "evaluations",
|
||||||
|
Loading…
Reference in New Issue
Block a user