def create_campaigns(): data = {'status': True} campaign_name = request.json.get('campaign_name') campaign_id = request.json.get('campaign_id') with Campaign() as _campaign: _campaign.add(campaign_id, campaign_name) return jsonify(data)
def update_campaign_status(): data = {'status': True} campaign_id = request.json.get('campaign_id') status = request.json.get('status') with Campaign() as _campaign: _campaign.update_status(campaign_id, status) return jsonify(data)
def campaigns(): data = {'status': True} with Campaign() as campaign: data['campaigns'] = campaign.get_all() return jsonify(data)
def __set_campaign_id(self): with Campaign() as campaign: camp = campaign.get_campaign_by_list(self.list_id) self.campaign_id = camp.get('campaign_id') if camp else 0