class user_roles(db.Model): __tablename__ = 'user_roles' role = db.Column(db.String(255), primary_key=True) access_json = db.Column(db.String(4095)) def __init__(self, role, access_json): self.role = role self.access_json = access_json
class error_message(db.Model): __tablename__ = 'error_message' msg_id = db.Column(db.Integer, primary_key=True) error_name = db.Column(db.String(23)) message = db.Column(db.String(1023)) def __init__(self, error_name, message): self.error_name = error_name self.message = message
class chatbot_users(db.Model): __tablename__ = 'chatbot_users' username = db.Column(db.String(255), primary_key=True) name = db.Column(db.String(255), nullable=False) password_hash = db.Column(db.String(255), nullable=False) role = db.Column(db.String(255), db.ForeignKey('user_roles.role'), nullable=False) def __init__(self, username, name, password_hash, role): self.username = username self.name = name self.password_hash = password_hash self.role = role
class chatbot_logs(db.Model): __tablename__ = 'chatbot_logs' log_id = db.Column(db.Integer, primary_key=True) username = db.Column(db.String(255)) user_query = db.Column(db.String(1023)) query_parameters = db.Column(db.NVARCHAR(None)) query_response = db.Column(db.NVARCHAR(None)) create_time = db.Column(db.DateTime()) status = db.Column(db.String(10)) error_name = db.Column(db.String(63)) error_message = db.Column(db.String(1023)) def __init__(self, username, user_query, query_parameters, query_response, create_time, status, error_name, error_message): self.username = username self.user_query = user_query self.query_response = query_response self.query_parameters = query_parameters self.create_time = create_time self.status = status self.error_name = error_name self.error_message = error_message