Rename "photo" to "image."

This commit is contained in:
Yaro Kasear 2025-07-11 13:01:08 -05:00
parent 84db8592cb
commit 7d96839af8
11 changed files with 78 additions and 72 deletions

View file

@ -3,15 +3,15 @@ if TYPE_CHECKING:
from .inventory import Inventory
from .rooms import Room
from .work_log import WorkLog
from .photo import Photo
from .image import Image
from sqlalchemy import Boolean, ForeignKey, Identity, Integer, Unicode, text
from sqlalchemy.orm import Mapped, mapped_column, relationship
from . import db
from .photo import PhotoAttachable
from .image import ImageAttachable
class User(db.Model, PhotoAttachable):
class User(db.Model, ImageAttachable):
__tablename__ = 'users'
id: Mapped[int] = mapped_column(Integer, Identity(start=1, increment=1), primary_key=True)
@ -21,14 +21,14 @@ class User(db.Model, PhotoAttachable):
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(Integer, ForeignKey("users.id"))
photo_id: Mapped[Optional[int]] = mapped_column(ForeignKey('photos.id'), nullable=True)
image_id: Mapped[Optional[int]] = mapped_column(ForeignKey('images.id'), nullable=True)
supervisor: Mapped[Optional['User']] = relationship('User', remote_side='User.id', back_populates='subordinates')
subordinates: Mapped[List['User']] = relationship('User', back_populates='supervisor')
work_logs: Mapped[List['WorkLog']] = relationship('WorkLog', back_populates='contact')
location: Mapped[Optional['Room']] = relationship('Room', back_populates='users')
inventory: Mapped[List['Inventory']] = relationship('Inventory', back_populates='owner')
photo: Mapped[Optional['Photo']] = relationship('Photo', back_populates='user')
image: Mapped[Optional['Image']] = relationship('Image', back_populates='user')
@property
def full_name(self) -> str: