Compiles again. Model complete enough for initial run; exam support missing
This commit is contained in:
parent
12996816df
commit
8fc45cfd23
@ -20,12 +20,22 @@ Term json
|
|||||||
name Text
|
name Text
|
||||||
start UTCTime
|
start UTCTime
|
||||||
end UTCTime
|
end UTCTime
|
||||||
|
holidays [UTCTime]
|
||||||
UniqueTerm name
|
UniqueTerm name
|
||||||
deriving Eq
|
deriving Eq
|
||||||
School json
|
School json
|
||||||
name Text
|
name Text
|
||||||
UniqueSchool name
|
UniqueSchool name
|
||||||
deriving Eq
|
deriving Eq
|
||||||
|
Degree json
|
||||||
|
name Text
|
||||||
|
schoolId SchoolId
|
||||||
|
UniqueDegree name schoolId
|
||||||
|
deriving Eq
|
||||||
|
DegreeCourse json
|
||||||
|
degreeId DegreeId
|
||||||
|
courseId CourseId
|
||||||
|
UniqueDegreeCourse degreeId courseId
|
||||||
Course json
|
Course json
|
||||||
name Text
|
name Text
|
||||||
owner UserId
|
owner UserId
|
||||||
@ -37,13 +47,13 @@ Course json
|
|||||||
registerFrom UTCTime
|
registerFrom UTCTime
|
||||||
registerTo UTCTime
|
registerTo UTCTime
|
||||||
Lecturer
|
Lecturer
|
||||||
userId UserId
|
userId UserId
|
||||||
courseId CourseId
|
courseId CourseId
|
||||||
UniqueLecturer userId courseId
|
UniqueLecturer userId courseId
|
||||||
CourseParticipant
|
CourseParticipant
|
||||||
userId UserId
|
userId UserId
|
||||||
courseId CourseId
|
courseId CourseId
|
||||||
registration UTCTime
|
registration UTCTime
|
||||||
UniqueCourseParticipant userId courseId
|
UniqueCourseParticipant userId courseId
|
||||||
Sheet
|
Sheet
|
||||||
courseId CourseId
|
courseId CourseId
|
||||||
@ -54,7 +64,7 @@ Sheet
|
|||||||
exerciseId FileId Maybe
|
exerciseId FileId Maybe
|
||||||
hintId FileId Maybe
|
hintId FileId Maybe
|
||||||
solutionId FileId Maybe
|
solutionId FileId Maybe
|
||||||
markingId FIleID Maybe
|
markingId FileId Maybe
|
||||||
markingText Text
|
markingText Text
|
||||||
activeFrom UTCTime
|
activeFrom UTCTime
|
||||||
activeTo UTCTime
|
activeTo UTCTime
|
||||||
@ -65,8 +75,8 @@ Sheet
|
|||||||
createdBy UserId
|
createdBy UserId
|
||||||
changedBy UserId
|
changedBy UserId
|
||||||
File
|
File
|
||||||
name Text
|
title Text
|
||||||
content ByteStream
|
content ByteString
|
||||||
Submission
|
Submission
|
||||||
sheetId SheetId
|
sheetId SheetId
|
||||||
fileId FileId
|
fileId FileId
|
||||||
@ -91,46 +101,55 @@ SubmissionGroup
|
|||||||
createdBy UserId
|
createdBy UserId
|
||||||
changedBy UserId
|
changedBy UserId
|
||||||
SubmissionGroupUser
|
SubmissionGroupUser
|
||||||
solutionGroupId SolutionGroupId
|
submissionGroupId SubmissionGroupId
|
||||||
userId UserId
|
userId UserId
|
||||||
UniqueSubmissionGroupUser solutionGroupId userId
|
UniqueSubmissionGroupUser submissionGroupId userId
|
||||||
--
|
|
||||||
Tutorial json
|
Tutorial json
|
||||||
name Text
|
name Text
|
||||||
tutor UserId
|
tutor UserId
|
||||||
TutorialParticipant
|
TutorialUser
|
||||||
userId UserId
|
userId UserId
|
||||||
tutorialId TutorialId
|
tutorialId TutorialId
|
||||||
UniqueTutorialParticipant userId tutorialId
|
UniqueTutorialUser userId tutorialId
|
||||||
-- Unclear how to model this correctly
|
Booking
|
||||||
|
termId TermId
|
||||||
|
begin UTCTime
|
||||||
|
end UTCTime
|
||||||
|
weekly Bool
|
||||||
|
exceptions [UTCTime]
|
||||||
|
created UTCTime
|
||||||
|
changed UTCTime
|
||||||
|
createdBy UserId
|
||||||
|
changedBy UserId
|
||||||
Room
|
Room
|
||||||
name Text
|
name Text
|
||||||
capacity Int Maybe
|
capacity Int Maybe
|
||||||
building Text
|
building Text
|
||||||
RoomCourse
|
RoomCourse
|
||||||
roomId RoomId
|
|
||||||
courseId CourseId
|
courseId CourseId
|
||||||
-- not unique, as a course might happen several times
|
tutorialId TutorialId Maybe
|
||||||
RoomTutorial
|
examId ExamId Maybe
|
||||||
roomId RoomId
|
roomId RoomId
|
||||||
tutorialId TutorialId
|
bookingId BookingId
|
||||||
RoomExam
|
UniqueRoomCourse courseId roomId bookingId
|
||||||
roomId RoomId
|
Exam
|
||||||
examId ExamId
|
courseId CourseId
|
||||||
RoomBookingRecurring
|
name Text
|
||||||
roomId RoomId
|
description Text
|
||||||
termId termId
|
begin UTCTime
|
||||||
start TimeOfDay
|
end UTCTime
|
||||||
end TimeOfDay
|
registrationBegin UTCTime
|
||||||
day Weekday
|
registrationEnd UTCTime
|
||||||
created UTCTime
|
deregistrationEnd UTCTime
|
||||||
changed UTCTime
|
ratingVisible Bool
|
||||||
RoomBooking
|
statisticsVisible Bool
|
||||||
roomId RoomId
|
created UTCTime
|
||||||
begin UTCTime
|
changed UTCTime
|
||||||
end UTCTime
|
createdBy UserId
|
||||||
created UTCTime
|
changedBy UserId
|
||||||
changed UTCTime
|
ExamUser
|
||||||
|
userId UserId
|
||||||
|
examId ExamId
|
||||||
|
-- CONTINUE HERE: Inlcude rating in this table or seperatly?
|
||||||
|
UniqueExamUser userId examId
|
||||||
-- By default this file is used in Model.hs (which is imported by Foundation.hs)
|
-- By default this file is used in Model.hs (which is imported by Foundation.hs)
|
||||||
|
|||||||
@ -4,3 +4,4 @@ module Import
|
|||||||
|
|
||||||
import Foundation as Import
|
import Foundation as Import
|
||||||
import Import.NoFoundation as Import
|
import Import.NoFoundation as Import
|
||||||
|
import ModelData as Import
|
||||||
|
|||||||
@ -11,6 +11,9 @@ module Model where
|
|||||||
|
|
||||||
import ClassyPrelude.Yesod
|
import ClassyPrelude.Yesod
|
||||||
import Database.Persist.Quasi
|
import Database.Persist.Quasi
|
||||||
|
-- import Data.Time
|
||||||
|
-- import Data.ByteString
|
||||||
|
import ModelData
|
||||||
|
|
||||||
-- You can define all of your database entities in the entities file.
|
-- You can define all of your database entities in the entities file.
|
||||||
-- You can find more information on persistent and how to declare entities
|
-- You can find more information on persistent and how to declare entities
|
||||||
@ -20,7 +23,7 @@ share [mkPersist sqlSettings, mkMigrate "migrateAll"]
|
|||||||
$(persistFileWith lowerCaseSettings "config/models")
|
$(persistFileWith lowerCaseSettings "config/models")
|
||||||
|
|
||||||
instance Show Term where
|
instance Show Term where
|
||||||
show = termName
|
show = ClassyPrelude.Yesod.unpack . termName
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -9,13 +9,11 @@ data SheetType = Regular | Bonus | Extra
|
|||||||
deriving (Show, Read, Eq, Ord, Enum, Bounded)
|
deriving (Show, Read, Eq, Ord, Enum, Bounded)
|
||||||
derivePersistField "SheetType"
|
derivePersistField "SheetType"
|
||||||
|
|
||||||
{- Not needed
|
data ExamStatus = Attended | NoShow | Voided
|
||||||
data Weekday = Mon | Tue | Wed | Thu | Fri | Sat | Sun
|
|
||||||
deriving (Show, Read, Eq, Ord, Enum, Bounded)
|
deriving (Show, Read, Eq, Ord, Enum, Bounded)
|
||||||
derivePersistField "Weekday"
|
derivePersistField "ExamStatus"
|
||||||
-}
|
|
||||||
|
|
||||||
{-
|
{- Modelled in DB
|
||||||
data Season = WS | SO
|
data Season = WS | SO
|
||||||
deriving (Show, Read, Eq, Enum)
|
deriving (Show, Read, Eq, Enum)
|
||||||
derivePersistField "Season"
|
derivePersistField "Season"
|
||||||
@ -24,9 +22,10 @@ data Term = Term { season:: Season, year :: Int }
|
|||||||
|
|
||||||
instance Show Term where
|
instance Show Term where
|
||||||
show (Term {season, year}) = take 1 (show season) ++ (show year)
|
show (Term {season, year}) = take 1 (show season) ++ (show year)
|
||||||
|
|
||||||
|
instance PersistField Term where
|
||||||
|
toPersistValue (Term {season, year}) = undefined
|
||||||
|
fromPersistValue (Term {season, year}) = undefined
|
||||||
|
sqlType _ = SqlInteger
|
||||||
|
isNullable _ = False
|
||||||
-}
|
-}
|
||||||
-- instance PersistField Term where
|
|
||||||
-- toPersistValue (Term {season, year}) = undefined
|
|
||||||
-- fromPersistValue (Term {season, year}) = undefined
|
|
||||||
-- sqlType _ = SqlInteger
|
|
||||||
-- isNullable _ = False
|
|
||||||
Loading…
Reference in New Issue
Block a user