async def post(self, request): file_id = get_id(request) data = await request.json() async with get_conn() as conn: key = await SharedFiles(conn).share(file_id, data['duration']) return UJSONResponse({'key': key})
async def post(self, request): file_id = get_id(request) data = await request.json() if 'tools_state' in data: async with get_conn() as conn: await Files(conn).update_tools_state( file_id, request.user.id, data['tools_state'], ) return UJSONResponse(data)
async def get(self, request): file_id = get_id(request) if not file_id: raise HTTPException(status_code=404) async with get_conn() as conn: master = await Replica(conn).master() file = await ReplicaFiles(conn).get_file_from_replica( master['id'], file_id) storage = await Storage.get(master) if not file: raise HTTPException(status_code=404) return await storage.serve(file)
async def get_patient_by_id(request): patient_id = get_id(request) async with get_conn() as conn: return await Patient(conn).get_extra(patient_id)
async def get(self, request): file_id = get_id(request) async with get_conn() as conn: data = await FileChange(conn).for_file(file_id) return UJSONResponse({'data': data})