class Module3(db.Document): # Each document in this collection refers to a different school and contains information about module3 for that school. files = db.ListField(db.ReferenceField('File')) # The list of files in module3 for that school chats = db.ListField(db.ReferenceField('Chat')) # The list of posts in module3 for that school meta = {'collection': 'module3'}
class Module1(db.Document): # Each document in this collection refers to a different school and contains information about module1 for that school. files = db.ListField(db.ReferenceField('File')) # The list of files in module1 for that school chats = db.ListField(db.ReferenceField('Chat')) #'chats' refers to the posts made by a teacher on the 'module post board', was called 'module chat' but i have not since changed the naming convention to match the new feature name meta = {'collection': 'module1'}
class Module2(db.Document): # Each document in this collection refers to a different school and contains information about module2 for that school. files = db.ListField(db.ReferenceField('File')) # The list of files in module2 for that school chats = db.ListField(db.ReferenceField('Chat')) # List of posts for module post board made by a teacher meta = {'collection': 'module2'}
class Post(db.Document): # For teacher discussion forum, post refers to a question # Details for each question asked subject = db.StringField() author = db.StringField(required=True, max_length=50) description = db.StringField() created_at = db.DateTimeField(required=True, default=datetime.utcnow) comments = db.ListField(db.ReferenceField('Comment')) # Post will have a list of comments, comments being replies meta = {'collection': 'posts'}
class File(db.Document): # Each document in this collection refers to a different file # Files are NOT stored in database, Files are stored on the machine that is hosting the website # Files are stored in the 'Uploads Folder' # http://flask.pocoo.org/docs/1.0/patterns/fileuploads/ user = db.ReferenceField('User') filename = db.StringField() tags = db.ListField(db.StringField(), default=list) created_at = db.DateTimeField(required=True, default=datetime.utcnow) meta = {'collection': 'files'}
class School(db.Document): # There is a school document created for each indivdual school, it holds information about the school # School name, assignments, and posts and files added to each module # The info related to what each module contains for each school is not actually held in school document but is held in collections Module1,Module2,Module3 and then referencing those here. name = db.StringField(required=True, max_length=100) module1 = db.ReferenceField('Module1') # In create() for teachers on line 39 school.module1 = module1.id # ReferenceField allows us to reference to another document module2 = db.ReferenceField('Module2') module3 = db.ReferenceField('Module3') # A school will have a list of assignments assignments = db.ListField(db.ReferenceField('Assignment')) meta = {'collection': 'schools'}
class User(db.DynamicDocument): dl_docs_array = db.ListField(db.ReferenceField('File')) # This List was to keep track of all the files a user download, feature was not finished login_counter = db.IntField() # Counter for the amount of times the user has logged in, feature was not finished login_array = db.ListField(db.DateField()) # List of the last 5 times a user logged in, feature was not finished, this and two about meant for student progress title = db.StringField() # Title of user, Mr, Dr etc approved = db.BooleanField() # Boolean used to check if student is approved to class or not name = db.StringField(required=True, max_length=50) surname = db.StringField(required=True) email = db.EmailField(required=True) password = db.BinaryField(required=True) user_type = db.StringField(required=True) school = db.ReferenceField(School) # Here we will store what school the user is in posts = db.ListField(db.ReferenceField('Post')) # List of all the questions user has added to teacher discussion forum meta = {'collection': 'users'}
class Assignment(db.Document): title = db.StringField(required=True, max_length=200) description = db.StringField() # Who created the assignment. created_by = db.ReferenceField('User') # What school. school = db.ReferenceField('School') # Submission date submission_date = db.DateTimeField(required=True) # Status open or close. true means open false means close status = db.BooleanField(required=True, default=True) # Submitted documents documents = db.ListField(db.ReferenceField('Document')) meta = {'collection': 'assignments'}