from .object import Object from datetime import datetime from sqlalchemy import Column, String, Integer, Boolean, Time, PrimaryKeyConstraint from sqlalchemy.orm import declarative_base Base = declarative_base() class Raid(Object, Base): __tablename__ = "raid" name = Column(String(30)) number = Column(Integer) location = Column(String(50)) level = Column(Integer) start_time = Column(Time) end_time = Column(Time) country = Column(String(2)) PrimaryKeyConstraint(name, location, start_time, end_time, name="raid_pk") def is_dispawned(self): if datetime().now() > self.end_time: return True return False def __repr__(self): return f"(Raid: {self.name} - {self.level}-star - {self.location} - Start: {self.start_time} - End: {self.end_time})"