fix: raid's location, datetime and constructor

main
Khiem Ton 2 years ago
parent 131f657ce4
commit a64cd12e9f
Signed by: th4tkh13m
GPG Key ID: 4D9CF147DCADD05D

@ -1,5 +1,6 @@
from datetime import datetime
from sqlalchemy import Column, String, Integer, Boolean, Time, PrimaryKeyConstraint
from ispoof.spoofer.location import Location
from sqlalchemy import Column, String, Integer, Boolean, DateTime, PrimaryKeyConstraint
from sqlalchemy.orm import declarative_base
Base = declarative_base()
@ -9,12 +10,21 @@ class Raid(Base):
name = Column(String(30))
number = Column(Integer)
location = Column(String(50))
location = Column(Location)
level = Column(Integer)
start_time = Column(Time)
end_time = Column(Time)
start_time = Column(DateTime)
end_time = Column(DateTime)
country = Column(String(2))
PrimaryKeyConstraint(name, location, start_time, end_time, name="raid_pk")
PrimaryKeyConstraint(name, location, start_time, end_time, name="raid_pk", sqlite_on_conflict='IGNORE')
def __init__(self, name, number, level, location, start_time, end_time, country):
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
def is_dispawned(self):
if datetime().now() > self.end_time:

Loading…
Cancel
Save