Esempio n. 1
0
class Message(db.Model):

    id = Column(Integer, primary_key=True)
    user_id = Column('user_id', Integer, db.ForeignKey('user.id'))
    conversation_id = Column('conversation_id', Integer, db.ForeignKey('conversation.id'))
    body = Column(String)
    sent_time = Column(DateTime(), default=datetime.utcnow)
Esempio n. 2
0
class Class(db.Model):

    id = Column(Integer, primary_key=True)

    name = Column(String)
    joinCode = Column(String(8), index=True, unique=True)
    teacher_id = Column(Integer, db.ForeignKey('teacher.id'))
Esempio n. 3
0
class EmptyAnswer(db.Model):

    id = Column(Integer, primary_key=True)
    answerString = Column(String)
    is_correct = Column(Boolean, nullable=False)

    question_id = Column(Integer, db.ForeignKey('empty_question.id'))
Esempio n. 4
0
class SubmittedAnswer(db.Model):

    id = Column(Integer, primary_key=True)
    answerString = Column(String)
    is_correct = Column(Boolean, nullable=False)

    is_chosen = Column(Boolean, nullable=False, default=True)

    question_id = Column(Integer, db.ForeignKey('submitted_question.id'))
Esempio n. 5
0
class SubmittedQuestion(db.Model):

    id = Column(Integer, primary_key=True)

    points = Column(Float)

    questionString = Column(String)
    test_id = Column(Integer, db.ForeignKey('submitted_test.id'))
    answers = relationship('SubmittedAnswer', backref='question')
Esempio n. 6
0
class Skill(db.Model):
    id = Column(Integer, primary_key=True)
    user_id = Column('user_id', Integer, db.ForeignKey('user.id'))
    body = Column(String)
Esempio n. 7
0
class Likes(db.Model):

    id = Column(Integer, primary_key=True)
    liked_account_id = Column(Integer, db.ForeignKey('user.id'))
    current_account = Column(Integer, db.ForeignKey('user.id'))
Esempio n. 8
0
from src.ext import db, login_manager
from datetime import datetime
import random
from sqlalchemy import Column, Integer, String, Text, DateTime
from sqlalchemy.schema import Table
from sqlalchemy.orm import relationship
from flask_login import UserMixin

@login_manager.user_loader
def load_user(user_id):
    return User.query.get(int(user_id))

user_conversation = db.Table('user_conversation',
        Column('user_id', Integer, db.ForeignKey('user.id')),
        Column('conversation_id', Integer, db.ForeignKey('conversation.id'))
)

class Likes(db.Model):

    id = Column(Integer, primary_key=True)
    liked_account_id = Column(Integer, db.ForeignKey('user.id'))
    current_account = Column(Integer, db.ForeignKey('user.id'))

class User(db.Model, UserMixin):

    id = Column(Integer, primary_key=True)

    username = Column(String, unique=True)
    email = Column(String, unique=True)
    password = Column(String(256))
    slug = Column(String, index= True)
Esempio n. 9
0
class Teacher(db.Model):

    id = Column(Integer, primary_key=True)

    email = Column(String, unique=True)
    password = Column(String(256))
    username = Column(String, unique=True)
    slug = Column(String, index=True)

    classes = relationship("Class", backref="teacher")


# maps students to classes
student_class = db.Table(
    'student_class',
    Column('student_id', Integer, db.ForeignKey('student.id')),
    Column('class_id', Integer, db.ForeignKey('class.id')),
)


class Class(db.Model):

    id = Column(Integer, primary_key=True)

    name = Column(String)
    joinCode = Column(String(8), index=True, unique=True)
    teacher_id = Column(Integer, db.ForeignKey('teacher.id'))


class Student(db.Model):
Esempio n. 10
0
class SubmittedTest(db.Model):

    id = Column(Integer, primary_key=True)

    student_id = Column(Integer, db.ForeignKey('student.id'))
    questions = relationship('SubmittedQuestion', backref='test')