def find(board_user_id: str): session.rollback() result = query_helper.find_by_id(session, BoardUser, board_user_id, json_result=True) return json_dumps(model_helper.insert_field_objects(session, result))
def find(card_list_id: str): session.rollback() result = query_helper.find_by_id(session, CardList, card_list_id, json_result=True) return json_dumps(model_helper.insert_field_objects(session, result))
def insert_field_objects(session_obj, obj_dict: dict): mapped_columns = FIELD_MODEL_MAPPING.keys() for column in mapped_columns: if column in obj_dict: if obj_dict[column]: label = FIELD_MODEL_MAPPING[column]["label"] cls = FIELD_MODEL_MAPPING[column]["cls"] obj_dict[label] = query_helper.find_by_id(session_obj, cls, obj_dict[column], json_result=True) return obj_dict
def setup_admin_account(_id): if not query_helper.find_by_id(session, User, _id): query_helper.save( session, User, { "id": _id, "email": "*****@*****.**", "username": "******", "password": password_helper.encrypt_password(str("password").strip()), "created_by_id": _id, "created_at": datetime.utcnow() }) session.commit()
async def find_user(request, session_obj, user_obj, user_id): result = query_helper.find_by_id(session_obj, User, user_id, True) return json(result)
def find(user_id): result = query_helper.find_by_id(session, User, user_id, json_result=True) return json_dumps(model_helper.insert_field_objects(session, result))