fix campaign_id in url
This commit is contained in:
parent
2458cff797
commit
3b78c15b85
@ -135,23 +135,16 @@ def delete_twitter_campaign():
|
|||||||
|
|
||||||
return "Twitter campaign succesfully deleted.", 200
|
return "Twitter campaign succesfully deleted.", 200
|
||||||
|
|
||||||
@campaign.route('/details', methods=['GET'])
|
@campaign.route('/<campaign_id>', methods=['GET'])
|
||||||
def get_twitter_campaign_details():
|
def get_twitter_campaign_details(campaign_id):
|
||||||
decoded_token = verify_token(request.headers)
|
decoded_token = verify_token(request.headers)
|
||||||
if not decoded_token:
|
if not decoded_token:
|
||||||
return "Not authorised!", 401
|
return "Not authorised!", 401
|
||||||
|
|
||||||
user_id = decoded_token['sub']
|
user_id = decoded_token['sub']
|
||||||
|
|
||||||
content_type = request.headers.get('Content-Type')
|
twitter_campaign = TwitterCampaign.query.filter_by(user_id=user_id, id=campaign_id).first()
|
||||||
if content_type != 'application/json':
|
campaign_posts = TwitterPost.query.filter_by(user_id=user_id, campaign_id=campaign_id).all()
|
||||||
return "Content-type not supported!", 400
|
|
||||||
|
|
||||||
if 'campaign_id' not in request.headers:
|
|
||||||
return "Invalid request!", 400
|
|
||||||
|
|
||||||
twitter_campaign = TwitterCampaign.query.filter_by(user_id=user_id, id=request.headers['campaign_id']).first()
|
|
||||||
campaign_posts = TwitterPost.query.filter_by(user_id=user_id, campaign_id=request.headers['campaign_id']).all()
|
|
||||||
|
|
||||||
posts = []
|
posts = []
|
||||||
for post in campaign_posts:
|
for post in campaign_posts:
|
||||||
|
Loading…
Reference in New Issue
Block a user