def add():
    try:
        assigned_employee_for_review = assigned_employee_for_review_service.save(
            None, request.get_json())
        return jsonify({'response': assigned_employee_for_review.to_json()})
    except DuplicateUserError:
        raise BadRequest('Duplicate assigned_employee_for_review', None, 1062)
    except ServiceError:
        raise BadRequest('Could not add a new assigned_employee_for_review')
def add():
    try:
        performance_phrase = performance_phrase_service.save(
            None, request.get_json())
        return jsonify({'response': performance_phrase.to_json()})
    except DuplicateUserError:
        raise BadRequest('Duplicate performance_phrase', None, 1062)
    except ServiceError:
        raise BadRequest('Could not add a new performance_phrase')
Esempio n. 3
0
def add():
    try:
        user = user_service.save(None, request.get_json())
        return jsonify({
            'response': user.to_json()
        })
    except DuplicateUserError:
        raise BadRequest('Duplicate user', None, 1062)
    except ServiceError:
        raise BadRequest('Could not add a new user')
Esempio n. 4
0
def find():
    try:
        items, totalCount = user_service.find_filtered(request.oauth.user, request.get_json())
        response = [n.to_json() for n in items]
        return jsonify({'response': response, 'totalCount': totalCount})
    except ServiceError:
        raise BadRequest('A service error occurred')
Esempio n. 5
0
def delete(user_id: int):
    try:
        user_service.delete(user_id)
        return jsonify({
            'response': 'Deleted user with id {id}'.format(id=user_id)
        })
    except ServiceError:
        raise BadRequest('Could not delete user with id {id}'.format(id=user_id))
Esempio n. 6
0
def update(user_id: int):
    try:
        user = user_service.save(user_id, request.get_json())
        return jsonify({
            'response': user.to_json()
        })
    except ServiceError:
        raise BadRequest('Could not update user with id {id}'.format(id=user_id))
Esempio n. 7
0
def uploadPic(user_id: int):
    try:
        user = user_service.upload_image(user_id, request)
        return jsonify({
            'response': user.to_json()
        })
    except ServiceError:
        raise BadRequest('Could not upload pic for user with id {id}'.format(id=user_id))
Esempio n. 8
0
def find_one(user_id: int):
    try:
        user = user_service.find_one(user_id)
        if user is None:
            raise NotFound('User with id {id} was not found'.format(id=user_id))
        return jsonify({'response': user.to_json()})
    except ServiceError:
        raise BadRequest('A service error occurred')
def update(assigned_employee_for_review_id: int):
    try:
        assigned_employee_for_review = assigned_employee_for_review_service.save(
            assigned_employee_for_review_id, request.get_json())
        return jsonify({'response': assigned_employee_for_review.to_json()})
    except ServiceError:
        raise BadRequest(
            'Could not update assigned_employee_for_review with id {id}'.
            format(id=assigned_employee_for_review_id))
def find_all():
    try:
        response = [
            n.to_json()
            for n in assigned_employee_for_review_service.find_all()
        ]
        return jsonify({'response': response})
    except ServiceError:
        raise BadRequest('A service error occurred')
def update(performance_phrase_id: int):
    try:
        performance_phrase = performance_phrase_service.save(
            performance_phrase_id, request.get_json())
        return jsonify({'response': performance_phrase.to_json()})
    except ServiceError:
        raise BadRequest(
            'Could not update performance_phrase with id {id}'.format(
                id=performance_phrase_id))
def find_one(assigned_employee_for_review_id: int):
    try:
        assigned_employee_for_review = assigned_employee_for_review_service.find_one(
            assigned_employee_for_review_id)
        if assigned_employee_for_review is None:
            raise NotFound('User with id {id} was not found'.format(
                id=assigned_employee_for_review_id))
        return jsonify({'response': assigned_employee_for_review.to_json()})
    except ServiceError:
        raise BadRequest('A service error occurred')
def find_one(performance_phrase_id: int):
    try:
        performance_phrase = performance_phrase_service.find_one(
            performance_phrase_id)
        if performance_phrase is None:
            raise NotFound('User with id {id} was not found'.format(
                id=performance_phrase_id))
        return jsonify({'response': performance_phrase.to_json()})
    except ServiceError:
        raise BadRequest('A service error occurred')
def delete(assigned_employee_for_review_id: int):
    try:
        assigned_employee_for_review = assigned_employee_for_review_service.delete(
            assigned_employee_for_review_id)
        return jsonify({
            'response':
            'Deleted assigned_employee_for_review with id {id}'.format(
                id=assigned_employee_for_review_id)
        })
    except ServiceError:
        raise BadRequest(
            'Could not delete assigned_employee_for_review with id {id}'.
            format(id=assigned_employee_for_review_id))
def delete(performance_phrase_id: int):
    try:
        performance_phrase = performance_phrase_service.delete(
            performance_phrase_id)
        return jsonify({
            'response':
            'Deleted performance_phrase with id {id}'.format(
                id=performance_phrase_id)
        })
    except ServiceError:
        raise BadRequest(
            'Could not delete performance_phrase with id {id}'.format(
                id=performance_phrase_id))
def find_all():
    try:
        response = [n.to_json() for n in performance_phrase_service.find_all()]
        return jsonify({'response': response})
    except ServiceError:
        raise BadRequest('A service error occurred')