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 datetime import datetime
|
||||
from sqlalchemy import Column, String, Integer, Boolean, Time, PrimaryKeyConstraint
|
||||
from sqlalchemy.orm import declarative_base
|
||||
|
||||
class Raid(Object):
|
||||
def __init__(self, name, number, level, location, start_time, end_time, country):
|
||||
super().__init__()
|
||||
self.name = name
|
||||
self.number = number
|
||||
self.level = level
|
||||
self.location = location
|
||||
self.start_time = start_time
|
||||
self.end_time = end_time
|
||||
self.country = country
|
||||
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})"
|
||||
|
Loading…
Reference in new issue