def fetch_data_doc_editors(doc_id): with DBSession() as session: doc = datadoc_collab.get_datadoc(doc_id, session=session) if doc: editors = logic.get_data_doc_editors_by_doc_id(doc_id, session=session) editor_dicts = [editor.to_dict() for editor in editors] socketio.emit( "data_doc_editors", (request.sid, editor_dicts), namespace=DATA_DOC_NAMESPACE, broadcast=False, room=request.sid, ) send_data_doc_session_info(doc_id, room=request.sid)
def fetch_data_doc_access_requests(doc_id): with DBSession() as session: doc = datadoc_collab.get_datadoc(doc_id, session=session) if doc: access_requests = logic.get_data_doc_access_requests_by_doc_id( doc_id, session=session ) access_request_dicts = [ access_request.to_dict() for access_request in access_requests ] socketio.emit( "data_doc_access_requests", (request.sid, access_request_dicts), namespace=DATA_DOC_NAMESPACE, broadcast=False, room=request.sid, ) send_data_doc_session_info(doc_id, room=request.sid)
def get_datadoc(id): doc = datadoc_collab.get_datadoc(id) api_assert(doc, "Invalid doc") return doc