Esempio n. 1
0
class ItemModel(ResortItemModel):
    __abstract__ = True

    state = db.Column(db.String(2), default='OO')
    type = db.Column(db.String(2), default='-')
    open_from = db.Column(db.String(5), default='-')
    open_till = db.Column(db.String(5), default='-')
Esempio n. 2
0
class SlopeModel(ItemModel):
    __tablename__ = 'slopes'

    night_open_from = db.Column(db.String(5), default='19:00')
    night_open_till = db.Column(db.String(5), default='22:45')
    level = db.Column(db.String(10), default='green')
    length = db.Column(db.Integer)
    height = db.Column(db.Integer)
    night = db.Column(db.String(10), default='off')
    south = db.Column(db.Boolean, default=False)

    def __repr__(self):
        return f'Slope {self.name}'
Esempio n. 3
0
class ResortItemModel(BaseModel):
    __abstract__ = True

    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String(80), unique=True)
    name_en = db.Column(db.String(80), unique=True)
    updated = db.Column(db.String(40))
    updated_by = db.Column(db.String(40), default='root')
    inactive = db.Column(db.Boolean, default=False)

    def save_to_db(self):
        self.updated = datetime.datetime.now()
        db.session.add(self)
        db.session.commit()
Esempio n. 4
0
class ActModel(ItemModel):
    __tablename__ = 'acts'

    icon = db.Column(db.String(80))

    def __repr__(self):
        return f'Act {self.name}'
Esempio n. 5
0
class WeatherZeroModel(ResortItemModel):
    __abstract__ = True

    height = db.Column(db.Integer)

    # Weather
    weather_sky = db.Column(db.String(80), default='-')
    weather_temp = db.Column(db.Integer, default=0)
    weather_sky_day = db.Column(db.String(80), default='-')
    weather_temp_day = db.Column(db.Integer, default=0)

    # Wind
    wind_velocity = db.Column(db.Integer, default=0)
    wind_direction = db.Column(db.String(20), default='-')
    wind_velocity_day = db.Column(db.Integer, default=0)
    wind_direction_day = db.Column(db.String(20), default='-')

    # Snow
    snow_state = db.Column(db.String(80), default='-')
    snow_height = db.Column(db.Integer, default=0)
    snow_height_new = db.Column(db.Integer, default=0)
    snow_date = db.Column(db.String(20), default='-')
    snow_avalanche = db.Column(db.Integer, default=0)

    # # Source
    source = db.Column(db.String(20), default='yrno')
Esempio n. 6
0
class UserModel(UserMixin, ResortItemModel):
    __tablename__ = 'users'

    admin = db.Column(db.Boolean, default=False)
    password = db.Column(db.String(40), nullable=False)

    def check_password(self, password: str):
        return password == self.find_by_name(name=self.name).password

    def __repr__(self):
        return f'User {self.name}'
Esempio n. 7
0
class TechModel(db.Model):
    __abstract__ = True

    name = db.Column(db.String(20), primary_key=True)
    code = db.Column(db.String(5), unique=True, nullable=False)
Esempio n. 8
0
class LiftModel(ItemModel):
    __tablename__ = 'lifts'

    length = db.Column(db.Integer)
    night = db.Column(db.String(10), default='off')
    # night = db.Column(db.Boolean, default=False)
    night_open_from = db.Column(db.String(5), default='19:00')
    night_open_till = db.Column(db.String(5), default='22:45')
    summer = db.Column(db.Boolean, default=False)
    add_time = db.Column(db.String(50), default=None)
    add_time_open_from = db.Column(db.String(5), default=None)
    add_time_open_till = db.Column(db.String(5), default=None)
    last_up0 = db.Column(db.String(50), default=None)
    last_up0_open_from = db.Column(db.String(5), default=None)
    last_up0_open_till = db.Column(db.String(5), default=None)
    last_up1 = db.Column(db.String(50), default=None)
    last_up1_open_from = db.Column(db.String(5), default=None)
    last_up1_open_till = db.Column(db.String(5), default=None)
    last_up2 = db.Column(db.String(50), default=None)
    last_up2_open_from = db.Column(db.String(5), default=None)
    last_up2_open_till = db.Column(db.String(5), default=None)
    last_up3 = db.Column(db.String(50), default=None)
    last_up3_open_from = db.Column(db.String(5), default=None)
    last_up3_open_till = db.Column(db.String(5), default=None)

    def __repr__(self):
        return f'Lift {self.name}'