Add getAllLecturesCached
This commit is contained in:
+13
-1
@@ -130,6 +130,8 @@ data Document = Document
|
||||
, documentFaculty :: Faculty
|
||||
, documentLectures :: [Lecture]
|
||||
, documentDownloadable :: Bool
|
||||
, documentType :: Text
|
||||
, documentNumPages :: Int
|
||||
}
|
||||
deriving (Show, Generic)
|
||||
|
||||
@@ -171,7 +173,17 @@ getAllDocuments :: (SqueakCtx m, MonadIO m) => m (Either SqueakError [Document])
|
||||
getAllDocuments = fmap unDocuments <$> joinErrors <$> mkQuery
|
||||
"{ documents(filters: []) \
|
||||
\ { results \
|
||||
\ { id date semester publicComment downloadable faculty { id displayName } lectures { id displayName aliases } } \
|
||||
\ { id date semester publicComment downloadable faculty { id displayName } lectures { id displayName aliases } type numPages } \
|
||||
\ } \
|
||||
\}"
|
||||
|
||||
getDocumentsByLectureId :: (SqueakCtx m, MonadIO m) => Text -> m (Either SqueakError [Document])
|
||||
getDocumentsByLectureId lecture = fmap unDocuments <$> joinErrors <$> mkQueryWithVars
|
||||
(object ["lecture" .= lecture])
|
||||
"query DocumentsByLectureId($lecture: LectureId!) \
|
||||
\ { documents(filters: [{ lectures: [$lecture] }]) \
|
||||
\ { results \
|
||||
\ { id date semester publicComment downloadable faculty { id displayName } lectures { id displayName aliases } type numPages } \
|
||||
\ } \
|
||||
\}"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user