Ejemplo n.º 1
0
def PostMove():
    try:

        if request.is_json:
            content = request.get_json()
            status = TypemovesDB.postMove(content)

            if status == 0:
                return Httpstatus.ok_server_post()
            else:
                return Httpstatus.int_server('server error')

        else:
            return Httpstatus.bad_request('bad request')

    except Exception as e:
        print(e)
        return Httpstatus.int_server('server error')
Ejemplo n.º 2
0
def PostHistorial():

    try:
        print(request.is_json)
        if request.is_json:
            content = request.get_json()

            status = HistorialDB.postHistorial(content)

            if status == 0:
                return Httpstatus.ok_server_post()
            else:
                return Httpstatus.int_server('server error')

        else:
            return Httpstatus.bad_request('bad request')

    except:
        return Httpstatus.int_server('server error')
Ejemplo n.º 3
0
def PostLugar():
    try:

        if request.is_json:
            content = request.get_json()
            status = LugarDB.postLugar(content)

            if status == 0:
                return Httpstatus.ok_server_post()
            elif status == 2:
                return Httpstatus.int_server('server error')
            elif status == 1:
                return Httpstatus.conflict('Conflicto')

        else:
            return Httpstatus.bad_request('bad request')

    except Exception as e:
        print(e)
        return Httpstatus.int_server('server error')
Ejemplo n.º 4
0
def ValidateSame():

    try:
        print(request.is_json)
        if request.is_json:
            content = request.get_json()

            status = InventDB.ValidateSamePlaces(content)

            if status == 0:
                return Httpstatus.ok_server_post()
            elif status == 2:
                return Httpstatus.conflict('not the same')
            elif status == 1:
                return Httpstatus.not_found('not found')

            else:
                return Httpstatus.int_server('server error')

        else:
            return Httpstatus.bad_request('bad request')

    except:
        return Httpstatus.int_server('server error')
Ejemplo n.º 5
0
def PostDevice():

    try:
        print(request.is_json)
        if request.is_json:
            content = request.get_json()

            status = InventDB.postDevice(content)

            if status == 0:
                return Httpstatus.ok_server_post()
            elif status == 2:
                return Httpstatus.int_server('server error')
            elif status == 1:
                return Httpstatus.conflict('ya existente')

            else:
                return Httpstatus.int_server('server error')

        else:
            return Httpstatus.bad_request('bad request')

    except:
        return Httpstatus.int_server('server error')