Standardize foreign key references and column names for consistency across inventory, users, and work log models

This commit is contained in:
Yaro Kasear 2025-07-09 12:34:00 -05:00
parent b0927680b9
commit ae5ffc82b3
3 changed files with 15 additions and 15 deletions

View file

@ -12,13 +12,13 @@ from . import db
class User(db.Model):
__tablename__ = 'Users'
id: Mapped[int] = mapped_column("ID", Integer, Identity(start=1, increment=1), primary_key=True)
staff: Mapped[Optional[bool]] = mapped_column("Staff", Boolean, server_default=text('((0))'))
active: Mapped[Optional[bool]] = mapped_column("Active", Boolean, server_default=text('((0))'))
last_name: Mapped[Optional[str]] = mapped_column("Last", Unicode(255), nullable=True)
first_name: Mapped[Optional[str]] = mapped_column("First", Unicode(255), nullable=True)
id: Mapped[int] = mapped_column(Integer, Identity(start=1, increment=1), primary_key=True)
staff: Mapped[Optional[bool]] = mapped_column(Boolean, server_default=text('((0))'))
active: Mapped[Optional[bool]] = mapped_column(Boolean, server_default=text('((0))'))
last_name: Mapped[Optional[str]] = mapped_column(Unicode(255), nullable=True)
first_name: Mapped[Optional[str]] = mapped_column(Unicode(255), nullable=True)
location_id: Mapped[Optional[int]] = mapped_column(ForeignKey("Rooms.id"), nullable=True)
supervisor_id: Mapped[Optional[int]] = mapped_column("Supervisor", Integer, ForeignKey("Users.ID"))
supervisor_id: Mapped[Optional[int]] = mapped_column(Integer, ForeignKey("Users.id"))
supervisor: Mapped[Optional['User']] = relationship('User', remote_side='User.id', back_populates='subordinates')
subordinates: Mapped[List['User']] = relationship('User', back_populates='supervisor')