def update_band(cls, user_id, follow_count, transaction): band_data = ArangoCore.get_vertex_in_collection( ArangoVertex.BAND, user_id) band_data['follow_count'] = follow_count ArangoCore.update_vertex_in_collection(ArangoVertex.BAND, band_data, transaction) band_data['_id'] = '{0}/{1}'.format('rv_users', user_id) ArangoCore.update_vertex_in_collection(ArangoVertex.USER, band_data, transaction)
def prepare_data_to_save(cls, user_id, user_data, is_new=True): data_to_save = {} if is_new else ArangoCore.get_vertex_in_collection( ArangoVertex.USER, user_id) for user_field in USER_FIELDS: if user_data and user_field in user_data: data_to_save[user_field] = user_data[user_field] # if data_to_save['avatar'] != '' and data_to_save['avatar'][:4] != 'http': # data_to_save['avatar_host'] = settings.AWS_URL if data_to_save['is_avatar_uploaded_to_s3'] else settings.API_URL # else: # data_to_save['avatar_host'] = '' # # if data_to_save['background'] != '': # data_to_save['background_host'] = settings.AWS_URL if data_to_save['is_background_uploaded_to_s3'] else settings.API_URL # else: # data_to_save['background_host'] = '' return data_to_save