diff --git a/app/api/routes/routes.py b/app/api/routes/routes.py index 1b24d21..aa5e7cf 100644 --- a/app/api/routes/routes.py +++ b/app/api/routes/routes.py @@ -118,6 +118,44 @@ def allowed_file(filename): return '.' in filename and \ filename.rsplit('.', 1)[1].lower() in ALLOWED_EXTENSIONS +@api.route('/upload/profile-picture', methods=['GET', 'POST']) +def upload_profile_picture_file(): + response = [] + + if request.method == 'POST': + logger.info('POST CALLED 0') + logger.info(f'POST CALLED 1 {request}') + logger.info(f'POST CALLED 2 {request.data}') + logger.info(f'POST CALLED 3 {request.files}') + + member_uid = request.form.get('member_uid' '') + token = request.form.get('token', '') # Use .get() to avoid errors if key is missing + + logger.info(f'POST CALLED 22 {member_uid}') + logger.info(f'POST CALLED 33 {token}') + + # check if the post request has the file part + if 'file' not in request.files: + logger.info('No file part') + + file = request.files['file'] + # If the user does not select a file, the browser submits an + # empty file without a filename. + logger.info(f'POST CALLED 4 {file}') + + if file.filename == '': + logger.info('No selected file') + + if file and allowed_file(file.filename): + logger.info(f'POST CALLED 5 {file.filename}') + response = FileUploadService.process_file_upload("WEB_MEDIA", file, member_uid) + + + if request.method == 'GET': + logger.info('GET CALLED') + + return response + @api.route('/upload/webfiles', methods=['GET', 'POST']) def upload_file(): @@ -620,7 +658,6 @@ def get_subcriptions_view_office(): filters = { 'subscription_uid': request.args.get('subscription_uid') } - response = OfficeDashboardService.get_subscription_view_data(filters) return response