parent
a3964db328
commit
7a0ad476eb
@ -0,0 +1,3 @@
|
|||||||
|
from .player import Player
|
||||||
|
from .pokemon import Pokemon
|
||||||
|
from .raid import Raid
|
@ -1,15 +1,25 @@
|
|||||||
from .object import Object
|
from .object import Object
|
||||||
|
from datetime import datetime
|
||||||
|
from sqlalchemy import Column, String, Integer, Boolean, Time, PrimaryKeyConstraint
|
||||||
|
from sqlalchemy.orm import declarative_base
|
||||||
|
|
||||||
class Raid(Object):
|
Base = declarative_base()
|
||||||
def __init__(self, name, number, level, location, start_time, end_time, country):
|
class Raid(Object, Base):
|
||||||
super().__init__()
|
__tablename__ = "raid"
|
||||||
self.name = name
|
|
||||||
self.number = number
|
name = Column(String(30))
|
||||||
self.level = level
|
number = Column(Integer)
|
||||||
self.location = location
|
location = Column(String(50))
|
||||||
self.start_time = start_time
|
level = Column(Integer)
|
||||||
self.end_time = end_time
|
start_time = Column(Time)
|
||||||
self.country = country
|
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):
|
def __repr__(self):
|
||||||
return f"(Raid: {self.name} - {self.level}-star - {self.location} - Start: {self.start_time} - End: {self.end_time})"
|
return f"(Raid: {self.name} - {self.level}-star - {self.location} - Start: {self.start_time} - End: {self.end_time})"
|
||||||
|
Loading…
Reference in new issue