| | |
| | | from datetime import datetime |
| | | |
| | | from cryptography.fernet import Fernet |
| | | from sqlalchemy import Column, Integer, String, Table, ForeignKey, DateTime |
| | | from sqlalchemy import Column, Integer, String, Table, ForeignKey, DateTime, UniqueConstraint |
| | | from sqlalchemy.orm import relationship, backref |
| | | |
| | | from app.config.config import settings |
| | |
| | | username = Column(String(255), unique=True, index=True) |
| | | hashed_password = Column(String(255)) |
| | | password = Column(String(255)) |
| | | compellation = Column(String(255), nullable=False, default="") |
| | | phone = Column(String(255), nullable=False, default="") |
| | | email = Column(String(255), nullable=False, default="") |
| | | description = Column(String(255), nullable=False, default="") |
| | | compellation = Column(String(255), default="") |
| | | phone = Column(String(255), default="") |
| | | email = Column(String(255), default="") |
| | | description = Column(String(255), default="") |
| | | ragflow_id = Column(String(32)) |
| | | bisheng_id = Column(Integer) |
| | | login_name = Column(String(100)) |
| | | status = Column(String(10), nullable=False, default="1") |
| | | status = Column(String(10), default="1") |
| | | creator = Column(String(36)) |
| | | sex = Column(String(1)) |
| | | permission = Column(String(16), nullable=False, default="general") |
| | | permission = Column(String(16), default="general") |
| | | age = Column(Integer) |
| | | created_at = Column(DateTime, default=datetime.now()) |
| | | updated_at = Column(DateTime, default=datetime.now(), onupdate=datetime.now()) |
| | | updated_at11 = Column(Integer) |
| | | |
| | | |
| | | |
| | |
| | | |
| | | |
| | | |
| | | class UserModel(Base): |
| | | __tablename__ = "user_test" |
| | | class UserAppModel(Base): |
| | | __tablename__ = "user_app" |
| | | __table_args__ = (UniqueConstraint('user_id', 'app_type', name='user_app_id_ix'),) |
| | | id = Column(Integer, primary_key=True, index=True) |
| | | username = Column(String(255), unique=True, index=True) |
| | | hashed_password = Column(String(255)) |
| | | username = Column(String(255)) |
| | | password = Column(String(255)) |
| | | compellation = Column(String(255), nullable=False, default="") |
| | | phone = Column(String(255), nullable=False, default="") |
| | | email = Column(String(255), nullable=False, default="") |
| | | description = Column(String(255), nullable=False, default="") |
| | | ragflow_id = Column(String(32)) |
| | | bisheng_id = Column(Integer) |
| | | email = Column(String(255), default="") |
| | | user_id = Column(Integer) |
| | | app_id = Column(String(36)) |
| | | app_type = Column(String(16)) |
| | | status = Column(String(10), default="1") |
| | | access_token = Column(String(1000)) |
| | | refresh_token = Column(String(1000)) |
| | | token_at = Column(DateTime, default=datetime.now()) |
| | | created_at = Column(DateTime, default=datetime.now()) |
| | | updated_at = Column(DateTime, default=datetime.now(), onupdate=datetime.now()) |
| | | |
| | | def to_json(self): |
| | | return { |
| | | 'id': self.id, |
| | | 'userName': self.username, |
| | | 'createTime': self.created_at.strftime('%Y-%m-%d %H:%M:%S') if self.created_at else "", |
| | | 'updateTime': self.updated_at.strftime('%Y-%m-%d %H:%M:%S') if self.created_at else "", |
| | | 'password': self.password, |
| | | 'email': self.email, |
| | | 'user_id': self.user_id, |
| | | 'app_id': self.app_id, |
| | | "app_type": self.app_type, |
| | | 'status': self.status, |
| | | } |