Esempio n. 1
0
def rebuild_database():
    db.drop_all()
    db.create_all()

    irreg2 = Irregular(
        school_id=123456789,
        date=time.strftime("%B %d, %Y"),
        day=5,
        month=1,
        year=2016,
        kinder_morning_class=False,
        kinder_afternoon_class=False,
        primary_morning_class=False,
        primary_afternoon_class=False,
        junior_morning_class=False,
        junior_afternoon_class=False,
        senior_morning_class=False,
        senior_afternoon_class=False,
        kinder_morning_start=str(now.replace(hour=7, minute=30, second=0))[11:16],
        kinder_morning_end=str(now.replace(hour=7, minute=30, second=0))[11:16],
        kinder_afternoon_start=str(now.replace(hour=7, minute=30, second=0))[11:16],
        kinder_afternoon_end=str(now.replace(hour=7, minute=30, second=0))[11:16],
        primary_morning_start=str(now.replace(hour=7, minute=30, second=0))[11:16],
        primary_morning_end=str(now.replace(hour=7, minute=30, second=0))[11:16],
        primary_afternoon_start=str(now.replace(hour=7, minute=30, second=0))[11:16],
        primary_afternoon_end=str(now.replace(hour=7, minute=30, second=0))[11:16],
        junior_morning_start=str(now.replace(hour=7, minute=30, second=0))[11:16],
        junior_morning_end=str(now.replace(hour=7, minute=30, second=0))[11:16],
        junior_afternoon_start=str(now.replace(hour=7, minute=30, second=0))[11:16],
        junior_afternoon_end=str(now.replace(hour=7, minute=30, second=0))[11:16],
        senior_morning_start=str(now.replace(hour=7, minute=30, second=0))[11:16],
        senior_morning_end=str(now.replace(hour=7, minute=30, second=0))[11:16],
        senior_afternoon_start=str(now.replace(hour=7, minute=30, second=0))[11:16],
        senior_afternoon_end=str(now.replace(hour=7, minute=30, second=0))[11:16]
        )

    sched2 = Regular(
        school_id=123456789,
        kinder_morning_class=True,
        kinder_afternoon_class=True,
        primary_morning_class=True,
        primary_afternoon_class=True,
        junior_morning_class=True,
        junior_afternoon_class=True,
        senior_morning_class=True,
        senior_afternoon_class=True,
        kinder_morning_start=str(now.replace(hour=8, minute=0, second=0))[11:16],
        kinder_morning_end=str(now.replace(hour=8, minute=0, second=0))[11:16],
        kinder_afternoon_start=str(now.replace(hour=8, minute=0, second=0))[11:16],
        kinder_afternoon_end=str(now.replace(hour=8, minute=0, second=0))[11:16],
        primary_morning_start=str(now.replace(hour=8, minute=0, second=0))[11:16],
        primary_morning_end=str(now.replace(hour=8, minute=0, second=0))[11:16],
        primary_afternoon_start=str(now.replace(hour=8, minute=0, second=0))[11:16],
        primary_afternoon_end=str(now.replace(hour=8, minute=0, second=0))[11:16],
        junior_morning_start=str(now.replace(hour=8, minute=0, second=0))[11:16],
        junior_morning_end=str(now.replace(hour=8, minute=0, second=0))[11:16],
        junior_afternoon_start=str(now.replace(hour=8, minute=0, second=0))[11:16],
        junior_afternoon_end=str(now.replace(hour=8, minute=0, second=0))[11:16],
        senior_morning_start=str(now.replace(hour=8, minute=0, second=0))[11:16],
        senior_morning_end=str(now.replace(hour=8, minute=0, second=0))[11:16],
        senior_afternoon_start=str(now.replace(hour=8, minute=0, second=0))[11:16],
        senior_afternoon_end=str(now.replace(hour=8, minute=0, second=0))[11:16]
        )

    school2 = School(
        id=123456789,
        api_key='ecc67d28db284a2fb351d58fe18965f9',
        name='Sacred Heart College'
        )

    db.session.add(sched2)
    db.session.add(irreg2)
    db.session.add(school2)
    db.session.commit()

    return jsonify(status='success'), 201
Esempio n. 2
0
def rebuild_database():
    db.drop_all()
    db.create_all()

    client = Client(
        api_key='435674859374657483949',
        name='BPI - Lucena',
        category='business',
        email='*****@*****.**',
        username='******',
        password=generate_password_hash('jasper'),
        country='Philippines',
        city='Manila',
        contact_no='09159484200'
        )

    user = User(
        api_key='435674859374657483948',
        first_name='Jasper',
        last_name='Barcelona',
        email='*****@*****.**',
        msisdn='09159484200',
        country='Philippines',
        )

    user1 = User(
        api_key='435674859374657483950',
        first_name='Joseph ',
        last_name='Sallao',
        email='*****@*****.**',
        msisdn='09183339068',
        country='Philippines',
        )

    user2 = User(
        api_key='435674859374657483951',
        first_name='Tobie',
        last_name='Delos Reyes',
        email='*****@*****.**',
        msisdn='09183339069',
        country='Philippines',
        )

    user3 = User(
        api_key='435674859374657483952',
        first_name='Janno  ',
        last_name='Armamento',
        email='*****@*****.**',
        msisdn='09183339060',
        country='Philippines',
        )

    service = Service(
        client_id=1,
        name='Bank Deposit',
        desc='Deposit cash to bank account',
        code='BD',
        avg_time = datetime.timedelta(hours=00,minutes=00,seconds=00),
        current = None
        )

    service1 = Service(
        client_id=1,
        name='Withdrawal',
        desc='Withdraw cash from bank account',
        code='BW',
        avg_time = datetime.timedelta(hours=00,minutes=00,seconds=00),
        current = None
        )

    db.session.add(client)
    db.session.add(user)
    db.session.add(user1)
    db.session.add(user2)
    db.session.add(user3)
    db.session.add(service)
    db.session.add(service1)
    db.session.commit()

    return jsonify(status='success'), 200