update models
This commit is contained in:
parent
0a810c14f7
commit
eaa0b37d14
|
|
@ -17,14 +17,14 @@ class UploadLog(Base):
|
|||
message = Column(Text)
|
||||
|
||||
|
||||
class Institution(Base):
|
||||
__tablename__ = "institutions"
|
||||
class Organization(Base):
|
||||
__tablename__ = "organizations"
|
||||
|
||||
id = Column(Integer, primary_key=True, index=True)
|
||||
name = Column(String(100), unique=True, nullable=False)
|
||||
address = Column(String(200), nullable=True)
|
||||
|
||||
users = relationship("User", back_populates="institution")
|
||||
users = relationship("User", back_populates="organization")
|
||||
|
||||
|
||||
class User(Base):
|
||||
|
|
@ -34,9 +34,9 @@ class User(Base):
|
|||
username = Column(String(50), unique=True, nullable=False)
|
||||
password_hash = Column(String(255), nullable=False)
|
||||
role = Column(String(50), nullable=False, default="user") # <── Added role
|
||||
institution_id = Column(Integer, ForeignKey("institutions.id"), nullable=True)
|
||||
organization_id = Column(Integer, ForeignKey("organizations.id"), nullable=True)
|
||||
active_token = Column(String(255), nullable=True)
|
||||
token_expired_at = Column(DateTime, nullable=True)
|
||||
last_login = Column(DateTime, nullable=True)
|
||||
|
||||
institution = relationship("Institution", back_populates="users")
|
||||
organization = relationship("Organization", back_populates="users")
|
||||
Loading…
Reference in New Issue
Block a user