def is_document_exists(): """Check if documents with gdrive_ids are exists""" DocumentEndpoint.validate_doc_request(request.json) ids = request.json["gdrive_ids"] result_set = db.session.query(all_models.Document.id, all_models.Document.gdrive_id).filter( all_models.Document.gdrive_id.in_(ids)) response = DocumentEndpoint.build_doc_exists_response( request.json, result_set) return Response(json.dumps(response), mimetype='application/json')
def is_document_exists(): """Check if documents with gdrive_ids are exists""" DocumentEndpoint.validate_doc_request(request.json) ids = request.json["gdrive_ids"] result_set = db.session.query(all_models.Document.id, all_models.Document.gdrive_id).filter( all_models.Document.gdrive_id.in_(ids)) response = DocumentEndpoint.build_doc_exists_response(request.json, result_set) return Response(json.dumps(response), mimetype='application/json')
def make_document_admin(): """Add current user as document admin""" DocumentEndpoint.validate_doc_request(request.json) ids = request.json["gdrive_ids"] docs = all_models.Document.query.filter( all_models.Document.gdrive_id.in_(ids)) for doc in docs: doc.add_admin_role() db.session.commit() response = DocumentEndpoint.build_make_admin_response(request.json, docs) return Response(json.dumps(response), mimetype='application/json')