Ejemplo n.º 1
0
class UserRole(db.Model):
    id = db.Column(db.Integer(), primary_key=True, autoincrement=True)
    user_id = db.Column(db.Integer(), db.ForeignKey('user.id'))
    role = db.Column(db.String(20))
    created_at = db.Column(db.DateTime(timezone=True), server_default=func.now())
    updated_at = db.Column(db.DateTime(timezone=True), onupdate=func.now())
    deleted_at = db.Column(db.DateTime())
Ejemplo n.º 2
0
class ShortStoryContent(db.Model):
    id = db.Column(db.Integer(), primary_key=True, autoincrement=True)
    short_story_id = db.Column(db.Integer(), db.ForeignKey('short_story.id'))
    language = db.Column(db.String(10))
    content = db.Column(db.Text())
    created_at = db.Column(db.DateTime(timezone=True),
                           server_default=func.now())
    updated_at = db.Column(db.DateTime(timezone=True), onupdate=func.now())
    deleted_at = db.Column(db.DateTime())
Ejemplo n.º 3
0
class LanguageHistory(db.Model):
    id = db.Column(db.Integer(), primary_key=True, autoincrement=True)
    user_id = db.Column(db.Integer(), db.ForeignKey('user.id'))
    language = db.Column(db.String(10))
    years_of_study = db.Column(db.Integer())
    proficiency_level = db.Column(db.String(30))
    created_at = db.Column(db.DateTime(timezone=True), server_default=func.now())
    updated_at = db.Column(db.DateTime(timezone=True), onupdate=func.now())
    deleted_at = db.Column(db.DateTime())
Ejemplo n.º 4
0
class SchoolLevelTranslation(db.Model):
    id = db.Column(db.Integer(), primary_key=True, autoincrement=True)
    school_level_id = db.Column(db.Integer(), db.ForeignKey('school_level.id'))
    language = db.Column(db.String(10))
    name = db.Column(db.String(100))
    sequence = db.Column(db.Integer())
    created_at = db.Column(db.DateTime(timezone=True),
                           server_default=func.now())
    updated_at = db.Column(db.DateTime(timezone=True), onupdate=func.now())
    deleted_at = db.Column(db.DateTime())
Ejemplo n.º 5
0
class UserStoryAttempt(db.Model):
    id = db.Column(db.Integer(), primary_key=True, autoincrement=True)
    user_id = db.Column(db.Integer(), db.ForeignKey('user.id'))
    short_story_id = db.Column(db.Integer(), db.ForeignKey('short_story.id'))
    short_story_translation_id = db.Column(db.Integer(), db.ForeignKey('short_story_translation.id'))
    language = db.Column(db.String(10))
    score = db.Column(db.Float())
    responses = db.Column(db.JSON())
    is_complete = db.Column(db.Boolean())
    created_at = db.Column(db.DateTime(timezone=True), server_default=func.now())
    updated_at = db.Column(db.DateTime(timezone=True), onupdate=func.now())
    deleted_at = db.Column(db.DateTime())
Ejemplo n.º 6
0
class MultipleChoiceQuestionTranslation(db.Model):
    id = db.Column(db.Integer(), primary_key=True, autoincrement=True)
    short_story_id = db.Column(db.Integer(), db.ForeignKey('short_story.id'))
    multiple_choice_question_id = db.Column(db.Integer(), db.ForeignKey('multiple_choice_question.id'))
    language = db.Column(db.String(10))
    question = db.Column(db.Text())
    sequence = db.Column(db.Integer())
    created_at = db.Column(db.DateTime(timezone=True), server_default=func.now())
    updated_at = db.Column(db.DateTime(timezone=True), onupdate=func.now())
    deleted_at = db.Column(db.DateTime())

    multiple_choice_answer_translations = relationship('MultipleChoiceAnswerTranslation')
Ejemplo n.º 7
0
class SchoolLevel(db.Model):
    id = db.Column(db.Integer(), primary_key=True, autoincrement=True)
    language = db.Column(db.String(10))
    name = db.Column(
        db.String(100)
    )  # Like ShortStory this is being used now to story the English name
    sequence = db.Column(db.Integer())
    created_at = db.Column(db.DateTime(timezone=True),
                           server_default=func.now())
    updated_at = db.Column(db.DateTime(timezone=True), onupdate=func.now())
    deleted_at = db.Column(db.DateTime())

    short_stories = relationship('ShortStory')
    translations = relationship('SchoolLevelTranslation')
class MultipleChoiceAnswer(db.Model):
    id = db.Column(db.Integer(), primary_key=True, autoincrement=True)
    multiple_choice_question_id = db.Column(
        db.Integer(), db.ForeignKey('multiple_choice_question.id'))
    language = db.Column(db.String(10))
    answer = db.Column(db.Text())
    order = db.Column(db.Integer())
    is_correct = db.Column(db.Boolean())
    created_at = db.Column(db.DateTime(timezone=True),
                           server_default=func.now())
    updated_at = db.Column(db.DateTime(timezone=True), onupdate=func.now())
    deleted_at = db.Column(db.DateTime())

    multiple_choice_answer_translations = relationship(
        'MultipleChoiceAnswerTranslation')
class ShortStoryTranslation(db.Model):
    id = db.Column(db.Integer(), primary_key=True, autoincrement=True)
    short_story_id = db.Column(db.Integer(), db.ForeignKey('short_story.id'))
    language = db.Column(db.String(10))
    title = db.Column(db.String(256))
    sequence = db.Column(db.Integer())
    word_count = db.Column(db.Integer())
    difficulty = db.Column(db.String(20))
    translated_by = db.Column(db.String(256))
    translated_by_user_id = db.Column(db.Integer(), db.ForeignKey('user.id'))
    published_at = db.Column(db.DateTime())
    created_at = db.Column(db.DateTime(timezone=True),
                           server_default=func.now())
    updated_at = db.Column(db.DateTime(timezone=True), onupdate=func.now())
    deleted_at = db.Column(db.DateTime())
Ejemplo n.º 10
0
class LanguageSynonym(db.Model):
    id = db.Column(db.Integer(), primary_key=True, autoincrement=True)
    source = db.Column(db.String(20))
    short_name = db.Column(db.String(10))
    long_name = db.Column(db.String(50))
    created_at = db.Column(db.DateTime(timezone=True), server_default=func.now())
    updated_at = db.Column(db.DateTime(timezone=True), onupdate=func.now())
    deleted_at = db.Column(db.DateTime())
Ejemplo n.º 11
0
class ShortStory(db.Model):
    id = db.Column(db.Integer(), primary_key=True, autoincrement=True)
    school_level_id = db.Column(db.Integer(), db.ForeignKey('school_level.id'))
    # Added a separate ShortStoryTranslation table, but we will keep all these other fields
    # and have the English translation on here as well as a record on the ShortStoryTranslation table
    language = db.Column(db.String(10))
    title = db.Column(db.String(256)) # Default title in English
    illustration_url = db.Column(db.String(128))
    sequence = db.Column(db.Integer())
    word_count = db.Column(db.Integer())
    difficulty = db.Column(db.String(20))
    story_by = db.Column(db.String(256))
    story_by_user_id = db.Column(db.Integer(), db.ForeignKey('user.id'))
    published_at = db.Column(db.DateTime())
    created_at = db.Column(db.DateTime(timezone=True), server_default=func.now())
    updated_at = db.Column(db.DateTime(timezone=True), onupdate=func.now())
    deleted_at = db.Column(db.DateTime())
    # TODO Eventually add who translated/vetted the story?

    short_story_content = relationship('ShortStoryContent')
    short_story_translation = relationship('ShortStoryTranslation')
    multiple_choice_questions = relationship('MultipleChoiceQuestion')
Ejemplo n.º 12
0
class User(db.Model):
    id = db.Column(db.Integer(), primary_key=True, autoincrement=True)
    email = db.Column(db.Text(), unique=True)
    email_lower = db.Column(db.Text(), unique=True)
    username = db.Column(db.String(30), unique=True)
    password_hash = db.Column(db.String(128))
    native_language = db.Column(db.String(10))
    language_i_want_to_learn = db.Column(db.String(10))
    has_studied_foreign_language = db.Column(db.Boolean())
    avatar_url = db.Column(db.String(128))
    email_verified = db.Column(db.Boolean())
    verify_email_link_sent = db.Column(db.Boolean())
    created_at = db.Column(db.DateTime(timezone=True),
                           server_default=func.now())
    updated_at = db.Column(db.DateTime(timezone=True), onupdate=func.now())
    deleted_at = db.Column(db.DateTime())

    score = relationship('UserScore', uselist=False)
    language_history = relationship('LanguageHistory')
Ejemplo n.º 13
0
class UserResetPasswordToken(db.Model):
    id = db.Column(db.Integer(), primary_key=True, autoincrement=True)
    user_id = db.Column(db.Integer(), db.ForeignKey('user.id'))
    token = db.Column(db.String(36))
    created_at = db.Column(db.DateTime(timezone=True),
                           server_default=func.now())