Refactor user, room, and inventory models to replace 'full_name' property with 'identifier' for consistency; update related templates and routes accordingly.

This commit is contained in:
Yaro Kasear 2025-07-22 11:49:47 -05:00
parent d12023ecd1
commit 462c077681
13 changed files with 129 additions and 88 deletions

View file

@ -74,10 +74,10 @@ class Inventory(db.Model, ImageAttachable):
parts.append(f"notes={repr(self.notes)}")
if self.owner:
parts.append(f"owner={repr(self.owner.full_name)}")
parts.append(f"owner={repr(self.owner.identifier)}")
if self.location:
parts.append(f"location={repr(self.location.full_name)}")
parts.append(f"location={repr(self.location.identifier)}")
return f"<Inventory({', '.join(parts)})>"

View file

@ -35,7 +35,7 @@ class Room(ValidatableMixin, db.Model):
return f"<Room(id={self.id}, room={repr(self.name)}, area_id={self.area_id}, function_id={self.function_id})>"
@property
def full_name(self):
def identifier(self):
name = self.name or ""
func = self.room_function.description if self.room_function else ""
return f"{name} - {func}".strip(" -")

View file

@ -31,7 +31,7 @@ class User(db.Model, ImageAttachable):
image: Mapped[Optional['Image']] = relationship('Image', back_populates='user', passive_deletes=True)
@property
def full_name(self) -> str:
def identifier(self) -> str:
return f"{self.first_name or ''} {self.last_name or ''}".strip()
def __init__(self, first_name: Optional[str] = None, last_name: Optional[str] = None,