(project_string_id)
| 13 | methods = ['POST']) |
| 14 | @Project_permissions.user_has_project(["admin", "Editor"]) |
| 15 | def remove_file(project_string_id): |
| 16 | with sessionMaker.session_scope() as session: |
| 17 | |
| 18 | # Same method for multiple types of files |
| 19 | |
| 20 | data = request.get_json(force = True) # Force = true if not set as application/json' |
| 21 | file = data.get('file', None) |
| 22 | if file is None: |
| 23 | return json.dumps("file is None"), 400, {'ContentType': 'application/json'} |
| 24 | |
| 25 | file_id = file.get('id', None) |
| 26 | if file_id is None: |
| 27 | return json.dumps("id is None"), 400, {'ContentType': 'application/json'} |
| 28 | |
| 29 | existing_file = session.query(File).filter(File.id == file_id).first() |
| 30 | |
| 31 | project = Project.get(session, project_string_id) |
| 32 | user_requesting = session.query(User).filter(User.id == getUserID(session = session)).one() |
| 33 | |
| 34 | working_dir = project.directory_default |
| 35 | |
| 36 | remove_core(session, working_dir, existing_file) |
| 37 | |
| 38 | # Flush / remove files from working dir? |
| 39 | out = {'success': True} |
| 40 | return jsonify(out), 200, {'ContentType': 'application/json'} |
| 41 | |
| 42 | # file was previously committed so we need to copy it |
| 43 | # A user may make changes to a file (resulting in a new file) |
| 44 | # But that new file may not be committed |
| 45 | # it will still have a parent_id which is why we have parent_id condition |
| 46 | |
| 47 | |
| 48 | def archive_related_tasks(session, file): |
nothing calls this directly
no test coverage detected