Compare commits

..

No commits in common. "b990805566961a835f9617cb335fc68f2ed589da" and "a76d19706c2b4f9e84acb2517e08d76e230c5b31" have entirely different histories.

4 changed files with 0 additions and 87 deletions

View file

@ -1,16 +0,0 @@
from typing import List, Optional
from sqlalchemy import Unicode
from sqlalchemy.orm import Mapped, mapped_column, relationship
from crudkit.core.base import Base, CRUDMixin
class DeviceType(Base, CRUDMixin):
__tablename__ = 'item'
description: Mapped[Optional[str]] = mapped_column(Unicode(255), nullable=True)
inventory: Mapped[List['Inventory']] = relationship('Inventory', back_populates='device_type')
def __repr__(self):
return f"<Item(id={self.id}, description={repr(self.description)})>"

View file

@ -1,24 +0,0 @@
from typing import List, Optional
from sqlalchemy import ForeignKey, Integer, Unicode
from sqlalchemy.orm import Mapped, mapped_column, relationship
from crudkit.core.base import Base, CRUDMixin
class Room(Base, CRUDMixin):
__tablename__ = 'rooms'
name: Mapped[Optional[str]] = mapped_column(Unicode(255), nullable=True)
area: Mapped[Optional['Area']] = relationship('Area', back_populates='rooms')
area_id: Mapped[Optional[int]] = mapped_column(Integer, ForeignKey("area.id"), nullable=True, index=True)
inventory: Mapped[List['Inventory']] = relationship('Inventory', back_populates='location')
users: Mapped[List['User']] = relationship('User', back_populates='location')
room_function: Mapped[Optional['RoomFunction']] = relationship('RoomFunction', back_populates='rooms')
room_function_id: Mapped[Optional[int]] = mapped_column('function_id', Integer, ForeignKey("room_function.id"), nullable=True, index=True)
def __repr__(self):
return f"<Room(id={self.id}, name={repr(self.name)}, area={repr(self.area.name)}, function={repr(self.room_function.description)})>"

View file

@ -1,16 +0,0 @@
from typing import List, Optional
from sqlalchemy import Unicode
from sqlalchemy.orm import Mapped, mapped_column, relationship
from crudkit.core.base import Base, CRUDMixin
class RoomFunction(Base, CRUDMixin):
__tablename__ = "room_function"
description: Mapped[Optional[str]] = mapped_column(Unicode(255), nullable=True)
rooms: Mapped[List['Room']] = relationship('Room', back_populates='room_function')
def __repr__(self):
return f"<RoomFunction(id={self.id}, description={repr(self.description)})>"

View file

@ -1,31 +0,0 @@
from typing import List, Optional
from sqlalchemy import Boolean, Integer, ForeignKey, Unicode
from sqlalchemy.orm import Mapped, mapped_column, relationship
from crudkit.core.base import Base, CRUDMixin
class User(Base, CRUDMixin):
__tablename__ = 'users'
first_name: Mapped[Optional[str]] = mapped_column(Unicode(255), nullable=True)
last_name: Mapped[Optional[str]] = mapped_column(Unicode(255), nullable=True)
title: Mapped[Optional[str]] = mapped_column(Unicode(255), nullable=True)
active: Mapped[Optional[bool]] = mapped_column(Boolean, nullable=False, default=False)
staff: Mapped[Optional[bool]] = mapped_column(Boolean, nullable=False, default=False)
image: Mapped[Optional['Image']] = relationship('Image', back_populates='user', passive_deletes=True)
image_id: Mapped[Optional[int]] = mapped_column(Integer, ForeignKey("images.id", ondelete="SET NULL"), nullable=True, index=True)
inventory: Mapped[List['Inventory']] = relationship('Inventory', back_populates='owner')
location: Mapped[Optional['Room']] = relationship('Room', back_populates='owner')
location_id: Mapped[Optional[int]] = mapped_column(Integer, ForeignKey("users.id"), nullable=True, index=True)
supervisor: Mapped[Optional['User']] = relationship('User', back_populates='subordinates')
supervisor_id: Mapped[Optional[int]] = mapped_column(Integer, ForeignKey("user.id"), nullable=True, index=True)
subordinates: Mapped[List['User']] = relationship('User', back_populates='supervisor')
def __repr__(self):
return f"<User(id={self.id}, first_name={repr(self.first_name)}, last_name={repr(self.last_name)})>"