def get(self): response_details = dict(scoped_response) with session_scope(response_details) as session: users = get_all_user(session) response_details['user'] = marshal(users, UserDto.userModel) response_details[ 'message'] = "Successfully retrieve users details." return prepare_response(**response_details)
def post(self): data = userApi.payload response_details = dict(scoped_response) response_details['user'] = data with session_scope(response_details) as session: updated_user = add_or_update_user(session, data) session.flush() response_details['user'] = marshal(updated_user, UserDto.userModel) response_details['message'] = "User details are add/updated." return prepare_response(**response_details)
def get(self): response_details = dict(scoped_response) with session_scope(response_details) as session: logo = get_all_logo(session) if logo: response_details['data'] = marshal(logo, LookupDto.lookupModel) response_details[ 'message'] = "Successfully retrieve logo details." else: response_details['data'] = None response_details['message'] = "No match found." return prepare_response(**response_details)
def get(self): response_details = dict(scoped_response) with session_scope(response_details) as session: medias = get_all_media(session) if medias: response_details['data'] = marshal(medias, MediaDto.mediaModel) response_details[ 'message'] = "Successfully retrieve logo details." else: response_details['data'] = None response_details['message'] = "No match found." return prepare_response(**response_details)
def get(self): response_details = dict(scoped_response) with session_scope(response_details) as session: campaigns = get_all_campaigns(session) if campaigns: response_details['data'] = marshal(campaigns, CampaignDto.campaignModel) response_details[ 'message'] = "Successfully retrieve campaign details." else: response_details['data'] = None response_details['message'] = "No match found." return prepare_response(**response_details)
def get(self, user_id): response_details = dict(scoped_response) with session_scope(response_details) as session: user = get_user_by_id(session, user_id) if user: response_details['user'] = marshal(user, UserDto.userModel) response_details[ 'message'] = "Successfully retrieve user details." else: response_details['user'] = None response_details[ 'message'] = "No match found. Please use valid user id." return prepare_response(**response_details)
def get(self, camp_media_id): response_details = dict(scoped_response) with session_scope(response_details) as session: camp_media = get_media_analysis(session, camp_media_id) if camp_media: response_details['data'] = marshal( camp_media, CampaignMediaDto.campaign_mediaModel) response_details[ 'message'] = "Successfully retrieve camp media details." else: response_details['data'] = None response_details[ 'message'] = "No match found. Please use valid camp media id." return prepare_response(**response_details)
def get(self, campaign_id): response_details = dict(scoped_response) with session_scope(response_details) as session: camp_detail = get_campaign(session, campaign_id) if camp_detail: response_details['data'] = marshal( camp_detail, CampaignDto.campaignExploreModel) response_details[ 'message'] = "Successfully retrieve campaign details." else: response_details['data'] = None response_details[ 'message'] = "No match found. Please use valid campaign id." return prepare_response(**response_details)
def get(self): response_details = dict(scoped_response) with session_scope(response_details) as session: logo = get_all_campaign_detail(session) if logo: response_details['data'] = marshal( logo, CampaignDetailDto.campaigndetailModel) response_details[ 'message'] = "Successfully retrieve logo details." else: response_details['data'] = None response_details[ 'message'] = "No match found. Please use valid user id." return prepare_response(**response_details)
def post(self): response_details = dict(scoped_response) with session_scope(response_details) as session: email = userApi.payload['email'] password = userApi.payload['password'] user_login_data = user_login(session, email, password) print(len(user_login_data)) if (len(user_login_data) == 8): res_dict = {} res_dict['token'] = user_login_data[0] res_dict['first_name'] = user_login_data[3] res_dict['email'] = user_login_data[4] res_dict['enabled'] = user_login_data[5] res_dict['user_id'] = user_login_data[6] res_dict['last_name'] = user_login_data[7] response_details['user'] = res_dict else: pass response_details['message'] = user_login_data[1] response_details['status'] = user_login_data[2] return prepare_response(**response_details)