Esempio n. 1
0
def delete(board_user_id: str, ver: str):
    session.rollback()
    data = request.data
    data.update({"deleted_by_id": request.user["id"]})
    old_data = query_helper.find_by_params(session,
                                           BoardUser, [{
                                               "id": {
                                                   "$eq": board_user_id
                                               }
                                           }, {
                                               "ver": {
                                                   "$eq": ver
                                               }
                                           }],
                                           json_result=True)
    result = query_helper.delete_by_params(session,
                                           BoardUser, [{
                                               "id": {
                                                   "$eq": board_user_id
                                               }
                                           }, {
                                               "ver": {
                                                   "$eq": ver
                                               }
                                           }],
                                           data=data,
                                           json_result=True)
    log_helper.log_update(session, BoardUser, request.user["id"], result,
                          old_data)
    session.commit()
    return json_dumps(model_helper.insert_field_objects(session, result))
Esempio n. 2
0
def delete(user_id: str, ver: str):
    session.rollback()
    old_data = query_helper.find_by_params(session,
                                           User, [{
                                               "id": {
                                                   "$eq": user_id
                                               }
                                           }, {
                                               "ver": {
                                                   "$eq": ver
                                               }
                                           }],
                                           json_result=True)
    result = query_helper.delete_by_params(
        session,
        User, [{
            "id": {
                "$eq": user_id
            }
        }, {
            "ver": {
                "$eq": ver
            }
        }], {'deleted_by_id': request.user['id']},
        json_result=True)
    log_helper.log_update(session, User, request.user["id"], result, old_data)
    session.commit()
    return json_dumps(model_helper.insert_field_objects(session, result))
Esempio n. 3
0
def delete(card_id: str, ver: str):
    session.rollback()
    data = deepcopy(request.data)
    data.update({"deleted_by_id": request.user["id"]})
    old_data = query_helper.find_by_params(
        session, Card, [{"id": {"$eq": card_id}}, {"ver": {"$eq": ver}}],
        json_result=True
    )
    result = query_helper.delete_by_params(
        session, Card, [{"id": {"$eq": card_id}}, {"ver": {"$eq": ver}}],
        data=data, json_result=True
    )
    log_helper.log_update(session, Card, request.user["id"], result, old_data)
    session.commit()
    return json_dumps(result)