def atualizaLink():
    if request.get_json() is None:
        abort(http.HTTPStatus.PRECONDITION_REQUIRED)
    try:
        body = request.get_json()
        obj = Link()
        obj.dictToLink(body)
        obj = service.update(obj)
        return jsonify(obj.linkToJson())
    except ModuleNotFoundError:
        abort(http.HTTPStatus.NO_CONTENT)
    except Exception:
        abort(http.HTTPStatus.INTERNAL_SERVER_ERROR)
def removerdoc():
    if request.get_json() is None:
        abort(http.HTTPStatus.PRECONDITION_REQUIRED)
    try:
        body = request.get_json()
        obj = Link()
        obj.dictToLink(body)
        service.findById(obj.id)
        if (obj is None):
            raise ModuleNotFoundError('Não encontrado')
        obj = service.remove(obj)
        return jsonify(obj.linkToJson())
    except ModuleNotFoundError:
        abort(http.HTTPStatus.BAD_REQUEST)
    except Exception:
        abort(http.HTTPStatus.BAD_REQUEST)
def atualizaUltimaColetaSementes():
    if request.get_json() is None:
        abort(http.HTTPStatus.PRECONDITION_REQUIRED)
    try:
        body = request.get_json()
        objn = Link()
        obj = Link()
        objn.dictToLink(body)
        obj = service.findById(objn.id)
        if (obj is None):
            raise ModuleNotFoundError('não encontrado.')
        obj.ultimaColeta = objn.ultimaColeta
        obj = service.update(obj)
        return jsonify(obj.linkToJson())
    except ModuleNotFoundError:
        abort(http.HTTPStatus.NO_CONTENT)
    except Exception:
        abort(http.HTTPStatus.INTERNAL_SERVER_ERROR)