def init():

    manager.create_api(Hardware, methods=['GET', 'POST', 'DELETE', 'PUT'],
    postprocessors={
        'POST': [post_post],
        'PATCH_SINGLE': [post_post],
    })
    initHardware(False)
Beispiel #2
0
def init():
    ## REST API FOR STEP
    manager.create_api(Step, methods=['GET', 'POST', 'DELETE', 'PUT'],allow_patch_many=True, postprocessors={'PATCH_SINGLE': [post_patch_many], 'DELETE_SINGLE': [post_patch_many], 'POST': [post_patch_many],'GET_MANY': [post_get]})
    s = Step.query.filter_by(state='A').first()
    if(s != None):
        app.brewapp_current_step = to_dict(s)
        if(s.timer_start != None):
            app.brewapp_current_step["endunix"] =  int((s.timer_start - datetime(1970,1,1)).total_seconds())*1000
Beispiel #3
0
def init():
    ## REST API FOR STEP
    manager.create_api(Step, methods=['GET', 'POST', 'DELETE', 'PUT'],allow_patch_many=True, results_per_page=None,postprocessors=
    {'GET_MANY': [post_get]})
    s = Step.query.filter_by(state='A').first()
    if(s != None):
        app.brewapp_current_step = to_dict(s)
        if(s.timer_start != None):
            app.brewapp_current_step["endunix"] =  int((s.timer_start - datetime(1970,1,1)).total_seconds())*1000
Beispiel #4
0
def init():
    manager.create_api(Config, methods=['GET', 'POST', 'DELETE', 'PUT'],
    preprocessors={
    'POST':[pre_post],
    'PATCH_SINGLE': [pre_post]},
    postprocessors={
    'POST':[post_post],
    'GET_MANY': [post_get_many],
    'GET_SINGLE':[post_post],
    'PATCH_SINGLE': [post_post]})
    readConfig()
Beispiel #5
0
def init():
    manager.create_api(Config, methods=['GET', 'POST', 'DELETE', 'PUT'], results_per_page=None,
    preprocessors={
    'POST':[pre_post],
    'PATCH_SINGLE': [pre_post]},
    postprocessors={
    'POST':[post_post],
    'GET_MANY': [post_get_many],
    'GET_SINGLE':[post_post],
    'PATCH_SINGLE': [post_post]})
    readConfig()
Beispiel #6
0
def init():
    app.brewapp_target_temp_method = setTargetTemp
    manager.create_api(Kettle, methods=['GET', 'POST', 'DELETE', 'PUT'],
    postprocessors={
    'POST': [post_post],
    'PATCH_SINGLE': [post_post],
    'GET_MANY':[post_get_many],
    'DELETE_SINGLE' : [post_delete],
    'GET_SINGLE':[post_get_single]},
    preprocessors={
    'POST':[pre_post],
    'PATCH_SINGLE': [pre_post]})
    initKettle()
Beispiel #7
0
def init():
    manager.create_api(Hardware, methods=['GET', 'POST', 'DELETE', 'PUT'], results_per_page=None,
    preprocessors={
        'POST': [pre_post],
        'PATCH_SINGLE': [pre_post]},
    postprocessors={
        'POST': [post_post],
        'GET_MANY': [post_get_many],
        'GET_SINGLE': [post_get_single],
        'PATCH_SINGLE': [post_post],
        'DELETE_SINGLE': [post_delete]
    })
    initHardware(False)
Beispiel #8
0
def initKettle():

    app.brewapp_target_temp_method = setTargetTemp

    manager.create_api(Kettle, methods=['GET', 'POST', 'DELETE', 'PUT'],
    postprocessors={
    'POST': [post_post],
    'PATCH_SINGLE': [post_post],
    'GET_MANY':[post_get_many],
    'DELETE_SINGLE' : [post_delete],
    'GET_SINGLE':[post_get_single]},
    preprocessors={
    'POST':[pre_post],
    'PATCH_SINGLE': [pre_post]})
    initKettle()
Beispiel #9
0
def init():
    manager.create_api(Hardware,
                       methods=['GET', 'POST', 'DELETE', 'PUT'],
                       results_per_page=None,
                       preprocessors={
                           'POST': [pre_post],
                           'PATCH_SINGLE': [pre_post]
                       },
                       postprocessors={
                           'POST': [post_post],
                           'GET_MANY': [post_get_many],
                           'GET_SINGLE': [post_get_single],
                           'PATCH_SINGLE': [post_post],
                           'DELETE_SINGLE': [post_delete]
                       })
    initHardware(False)
Beispiel #10
0
    app.cbp['FERMENTERS'][result["id"]].update(result)
    if app.cbp['CURRENT_TASK'].get(result["id"], None) is not None and  app.cbp['CURRENT_TASK'][result["id"]]["id"] == result["id"]:
        for key in ["name", "target_temp"]:
            app.cbp['CURRENT_TASK'][result["id"]][key] = result[key]


def reload_fermenter(id):
    f = Fermenter.query.get(id)
    d = to_dict(f, deep={'steps': []})
    app.cbp['FERMENTERS'][f.id] = d
    socketio.emit('fermenter_update', d, namespace='/brew')




manager.create_api(Fermenter, methods=['GET', 'POST', 'PUT', 'DELETE'], postprocessors={ 'PUT_SINGLE': [post_patch], 'POST': [post_post]})
manager.create_api(FermenterStep, methods=['GET', 'POST', 'PUT', 'DELETE'], postprocessors={'PUT_SINGLE': [post_patch]})

@app.route('/api/fermenter/step/order', methods=['POST'])
def fermentation_order_steps():
    data = request.get_json()
    for s in FermenterStep.query.filter_by(fermenter_id=int(data["id"])).order_by(FermenterStep.order).all():
        s.order = data["steps"][str(s.id)];
        db.session.add(s)
        db.session.commit()

    return ('', 204)

@app.route('/api/fermenter/<id>/next', methods=['POST'])
def next(id):
Beispiel #11
0
def init():
    manager.create_api(RecipeBooks, methods=['GET', 'POST', 'DELETE', 'PUT'])
    manager.create_api(RecipeBookSteps, methods=['GET', 'POST', 'DELETE', 'PUT'])
Beispiel #12
0
def init():
    manager.create_api(RecipeBooks, methods=['GET', 'POST', 'DELETE', 'PUT'])
    manager.create_api(RecipeBookSteps,
                       methods=['GET', 'POST', 'DELETE', 'PUT'])
Beispiel #13
0
    app.cbp['FERMENTERS'][result["id"]].update(result)
    if app.cbp['CURRENT_TASK'].get(result["id"], None) is not None and  app.cbp['CURRENT_TASK'][result["id"]]["id"] == result["id"]:
        for key in ["name", "target_temp"]:
            app.cbp['CURRENT_TASK'][result["id"]][key] = result[key]


def reload_fermenter(id):
    f = Fermenter.query.get(id)
    d = to_dict(f, deep={'steps': []})
    app.cbp['FERMENTERS'][f.id] = d
    socketio.emit('fermenter_update', d, namespace='/brew')




manager.create_api(Fermenter, methods=['GET', 'POST', 'PUT', 'DELETE'],  results_per_page=None, postprocessors={ 'PUT_SINGLE': [post_patch], 'POST': [post_post]})
manager.create_api(FermenterStep, methods=['GET', 'POST', 'PUT', 'DELETE'], results_per_page=None, postprocessors={'PUT_SINGLE': [post_patch]})

@app.route('/api/fermenter/step/order', methods=['POST'])
def fermentation_order_steps():
    data = request.get_json()
    for s in FermenterStep.query.filter_by(fermenter_id=int(data["id"])).order_by(FermenterStep.order).all():
        s.order = data["steps"][str(s.id)];
        db.session.add(s)
        db.session.commit()

    return ('', 204)

@app.route('/api/fermenter/<id>/next', methods=['POST'])
def next(id):