class Lesson(db.Model, Entity): __tablename__ = 'tm_lesson' id = db.Column('lesson_id', db.BigInteger, db.Sequence('tm_lesson_lesson_id_seq'), primary_key=True) title = db.Column(db.String(140), nullable=False) type = db.Column(db.String(20), nullable=False, default='video') document_id = db.Column(db.ForeignKey(u'tm_document.document_id'), nullable=False, index=True) price = db.Column(db.Numeric, nullable=False) user_id = db.Column(db.ForeignKey(u'tm_user.user_id'), nullable=False, index=True) topic_id = db.Column(db.ForeignKey(u'tm_topic.topic_id'), index=True) user = db.relationship(u'UserPrincipal') active = db.Column(db.String, nullable=False, server_default='I') created_at = db.Column(db.DateTime(timezone=False), default=datetime.now) update_at = db.Column(db.DateTime(timezone=False), onupdate=datetime.now) # Hiding the json key in http get __json_hidden__ = [ 'user.hash_password', 'user.account_non_expired', 'user.credentials_non_expired', 'user.account_non_locked' ] def __init__(self, obj=None): Entity.__init__(self, obj)
class TaskGroup(db.Model, Entity): __tablename__ = 'tm_task_group' task_id = db.Column(db.ForeignKey(u'tm_task.task_id'), nullable=False, primary_key=True) group_id = db.Column(db.ForeignKey(u'tm_learning_group.group_id'), nullable=False, primary_key=True) created_at = db.Column(db.DateTime(timezone=False), default=datetime.now) update_at = db.Column(db.DateTime(timezone=False), onupdate=datetime.now) def __init__(self, obj=None): Entity.__init__(self, obj)
class LessonViewer(db.Model, Entity): __tablename__ = 'tm_lesson_viewer' user_id = db.Column(db.ForeignKey(u'tm_user.user_id'), nullable=False, primary_key=True) lesson_id = db.Column(db.ForeignKey(u'tm_lesson.lesson_id'), nullable=False, primary_key=True) created_at = db.Column(db.DateTime(timezone=False), default=datetime.now) update_at = db.Column(db.DateTime(timezone=False), onupdate=datetime.now) def __init__(self, obj=None): Entity.__init__(self, obj)
class Friend(db.Model, Entity): __tablename__ = 'tm_friend' user_id = db.Column(db.ForeignKey(u'tm_user.user_id'), nullable=False, primary_key=True) friend_id = db.Column(db.ForeignKey(u'tm_user.user_id'), nullable=False, primary_key=True) status = db.Column(db.String(10), nullable=False, server_default='') created_at = db.Column(db.DateTime(timezone=False), default=datetime.now) update_at = db.Column(db.DateTime(timezone=False), onupdate=datetime.now) def __init__(self, obj=None): Entity.__init__(self, obj)
class LearningGroup(db.Model, Entity): __tablename__ = "tm_learning_group" id = db.Column('group_id', db.BigInteger, db.Sequence('tm_learning_group_group_id_seq'), primary_key=True) name = db.Column(db.String(120)) user_id = db.Column(db.ForeignKey(u'tm_user.user_id'), nullable=False) document_id = db.Column(db.ForeignKey(u'tm_document.document_id'), index=True) created_at = db.Column(db.DateTime(timezone=False), default=datetime.now) update_at = db.Column(db.DateTime(timezone=False), onupdate=datetime.now) def __init__(self, obj=None): Entity.__init__(self, obj)
class TaskScore(db.Model, Entity): __tablename__ = 'tm_task_score' id = db.Column('task_score_id', db.BigInteger, db.Sequence('tm_task_score_task_score_id_seq'), primary_key=True) task_id = db.Column(db.ForeignKey(u'tm_task.task_id'), nullable=False) user_id = db.Column(db.ForeignKey(u'tm_user.user_id'), nullable=False) score = db.Column(db.Numeric, nullable=False) __table_args__ = (db.UniqueConstraint( 'user_id', 'task_id', name='uix_task_score_task_id_user_id'), ) created_at = db.Column(db.DateTime(timezone=False), default=datetime.now) update_at = db.Column(db.DateTime(timezone=False), onupdate=datetime.now) def __init__(self, obj=None): Entity.__init__(self, obj)
class UserAuthority(db.Model, Entity): __tablename__ = 'tm_user_authority' id = db.Column('user_authority_id', db.BigInteger, db.Sequence('tm_user_authority_user_authority_id_seq'), primary_key=True) authority = db.Column(db.String(255)) user_id = db.Column(db.ForeignKey(u'tm_user.user_id'), nullable=False)
class QuestionScore(db.Model, Entity): __tablename__ = 'tm_question_score' id = db.Column('question_score_id', db.BigInteger, db.Sequence('tm_question_score_question_score_id_seq'), primary_key=True) question_id = db.Column(db.ForeignKey('tm_task_question.question_id'), nullable=False) user_id = db.Column(db.ForeignKey(u'tm_user.user_id'), nullable=False) task_id = db.Column(db.ForeignKey(u'tm_task.task_id')) score = db.Column(db.Numeric, nullable=False) user_answer = db.Column(db.Text, nullable=False, server_default='') __table_args__ = (db.UniqueConstraint( 'user_id', 'question_id', name='uix_question_score_question_id_user_id'), ) def __init__(self, obj=None): Entity.__init__(self, obj)
class Topic(db.Model, Entity): __tablename__ = 'tm_topic' id = db.Column('topic_id', db.BigInteger, db.Sequence('tm_topic_topic_id_seq'), primary_key=True) name = db.Column(db.Text, nullable=False) user_id = db.Column(db.ForeignKey(u'tm_user.user_id'), nullable=False, index=True) level_id = db.Column(db.ForeignKey(u'tm_school_level.school_level_id'), index=True) class_id = db.Column(db.ForeignKey(u'tm_school_class.school_class_id'), index=True) created_at = db.Column(db.DateTime(timezone=False), default=datetime.now) update_at = db.Column(db.DateTime(timezone=False), onupdate=datetime.now) def __init__(self, obj=None): Entity.__init__(self, obj)
class UserPrincipal(db.Model, Entity): __tablename__ = 'tm_user' id = db.Column('user_id', db.BigInteger, db.Sequence('tm_user_user_id_seq'), primary_key=True) document_id = db.Column(db.ForeignKey(u'tm_document.document_id'), index=True) phone_number = db.Column(db.String(20), nullable=False, unique=True) username = db.Column(db.String(60), nullable=False, unique=True) fullname = db.Column(db.String(100), nullable=False) gender = db.Column(db.String(1), nullable=False) hash_password = db.Column(db.LargeBinary(60), nullable=False) address_id = db.Column(db.ForeignKey(u'tm_address.address_id'), nullable=True, index=True) enabled = db.Column(db.Boolean, nullable=False, default=False) account_non_expired = db.Column(db.Boolean, nullable=False, default=False) account_non_locked = db.Column(db.Boolean, nullable=False, default=False) credentials_non_expired = db.Column(db.Boolean, nullable=False, default=False) register_type = db.Column(db.String(20), nullable=False, default='', server_default='') class_id = db.Column(db.ForeignKey(u'tm_school_class.school_class_id'), index=True) level_id = db.Column(db.ForeignKey(u'tm_school_level.school_level_id'), index=True) created_at = db.Column(db.DateTime(timezone=False), default=datetime.now) update_at = db.Column(db.DateTime(timezone=False), onupdate=datetime.now) __json_hidden__ = [ 'hash_password', 'enabled', 'account_non_expired', 'account_non_locked', 'credentials_non_expired' ] def __init__(self, obj=None): Entity.__init__(self, obj) def to_dict(self): return super().to_dict()
class LessonComment(db.Model, Entity): __tablename__ = 'tm_lesson_comment' id = db.Column('lesson_comment_id', db.BigInteger, db.Sequence('tmlesson_comment_lesson_comment_id_seq'), primary_key=True) sender_user_id = db.Column(db.ForeignKey(u'tm_user.user_id'), nullable=False) lesson_id = db.Column(db.ForeignKey(u'tm_lesson.lesson_id'), nullable=False) message = db.Column(db.Text, nullable=False) created_at = db.Column(db.DateTime(timezone=False), default=datetime.now) update_at = db.Column(db.DateTime(timezone=False), onupdate=datetime.now) user = db.relationship(u'UserPrincipal') __json_hidden__ = [ 'user.hash_password', 'user.account_non_expired', 'user.credentials_non_expired', 'user.account_non_locked' ] def __init__(self, obj=None): Entity.__init__(self, obj)
class TaskAnswer(db.Model, Entity): __tablename__ = "tm_task_answer" id = db.Column('answer_id', db.BigInteger, db.Sequence('tm_task_answer_answer_id_seq'), primary_key=True) question_id = db.Column(db.ForeignKey(u'tm_task_question.question_id'), nullable=False) answer = db.Column(db.Text, nullable=False, server_default='') created_at = db.Column(db.DateTime(timezone=False), default=datetime.now) update_at = db.Column(db.DateTime(timezone=False), onupdate=datetime.now) def __init__(self, obj=None): Entity.__init__(self, obj)
class Task(db.Model, Entity): __tablename__ = 'tm_task' id = db.Column('task_id', db.BigInteger, db.Sequence('tm_task_task_id_seq'), primary_key=True) title = db.Column(db.Text, nullable=False) user_id = db.Column(db.ForeignKey(u'tm_user.user_id'), nullable=False) active = db.Column(db.Boolean, nullable=False, default=True) time_limit = db.Column(db.BigInteger, nullable=False, default=0) created_at = db.Column(db.DateTime(timezone=False), default=datetime.now) update_at = db.Column(db.DateTime(timezone=False), onupdate=datetime.now) def __init__(self, obj=None): Entity.__init__(self, obj)
class TaskQuestion(db.Model, Entity): __tablename__ = 'tm_task_question' id = db.Column('question_id', db.BigInteger, db.Sequence('tm_task_question_question_id_seq'), primary_key=True) task_id = db.Column(db.ForeignKey(u'tm_task.task_id'), nullable=False) question = db.Column(db.Text, nullable=False, server_default='') question_type = db.Column(db.String(10), nullable=False, server_default='') answer_key = db.Column(db.Text, nullable=False, server_default='') answers = db.relationship(u'TaskAnswer') created_at = db.Column(db.DateTime(timezone=False), default=datetime.now) update_at = db.Column(db.DateTime(timezone=False), onupdate=datetime.now) def __init__(self, obj=None): Entity.__init__(self, obj)
class Notification(db.Model, Entity): __tablename__ = 'tm_notification' id = db.Column('notification_id', db.BigInteger, db.Sequence('tm_notification_notification_id_seq'), primary_key=True) user_id = db.Column(db.ForeignKey(u'tm_user.user_id'), nullable=False) message = db.Column(db.String(60), nullable=False) title = db.Column(db.String(60), nullable=False) text = db.Column(db.Text, nullable=False) sent = db.Column(db.Boolean, nullable=False, server_default='f') created_at = db.Column(db.DateTime(timezone=False), default=datetime.now) update_at = db.Column(db.DateTime(timezone=False), onupdate=datetime.now) def __init__(self, obj=None): Entity.__init__(self, obj)
class Activity(db.Model, Entity): __tablename__ = 'tm_activity' id = db.Column('activity_id', db.BigInteger, db.Sequence('tm_activity_activity_id_seq'), primary_key=True) message = db.Column(db.Text, nullable=False) user_id = db.Column(db.ForeignKey(u'tm_user.user_id'), nullable=False, index=True) raw = db.Column(db.Text, nullable=False, server_default='-', default='') created_at = db.Column(db.DateTime(timezone=False), default=datetime.now) update_at = db.Column(db.DateTime(timezone=False), onupdate=datetime.now) user = db.relationship(u'UserPrincipal') doc_type = db.Column(db.String(20)) __json_hidden__ = [ 'user.hash_password', 'user.account_non_expired', 'user.credentials_non_expired', 'user.account_non_locked' ] def __init__(self, obj=None): Entity.__init__(self, obj)
db.Column('grant_name', db.String(255), nullable=False)) t_client_redirect = db.Table( 'tm_client_redirect', db.metadata, db.Column('client_id', db.String(255), nullable=False), db.Column('redirect_uri', db.String(255))) t_client_scope = db.Table( 'tm_client_scope', db.metadata, db.Column('client_id', db.String(255), nullable=False), db.Column('scope', db.String(255))) t_learning_group_user = db.Table( 'tm_learning_group_user', db.metadata, db.Column('group_id', db.ForeignKey(u'tm_learning_group.group_id'), nullable=False, primary_key=True), db.Column('user_id', db.ForeignKey(u'tm_user.user_id'), nullable=False, primary_key=True)) class UserPrincipal(db.Model, Entity): __tablename__ = 'tm_user' id = db.Column('user_id', db.BigInteger, db.Sequence('tm_user_user_id_seq'), primary_key=True) document_id = db.Column(db.ForeignKey(u'tm_document.document_id'),