示例#1
0
async def create_protocol_file(
    protocol_id: str,
    file: UploadFile = File(...),
    protocol_manager: ProtocolManager = Depends(get_protocol_manager)):
    proto = protocol_manager.get(protocol_id)
    proto.add(file)
    return route_models.ProtocolResponse(data=_to_response(proto))
示例#2
0
async def delete_protocol(
        protocolId: str,
        protocol_manager: ProtocolManager = Depends(get_protocol_manager)):
    proto = protocol_manager.remove(protocolId)
    return route_models.ProtocolResponse(
        data=_to_response(proto),
        links=get_root_links(router),
    )
示例#3
0
async def get_protocol(
        protocolId: str,
        protocol_manager: ProtocolManager = Depends(get_protocol_manager)):
    proto = protocol_manager.get(protocolId)
    return route_models.ProtocolResponse(
        data=_to_response(proto),
        links=get_protocol_links(router, proto.meta.identifier)
    )
示例#4
0
async def create_protocol_file(
        protocolId: str,
        file: UploadFile = File(...),
        protocol_manager: ProtocolManager = Depends(get_protocol_manager)):
    proto = protocol_manager.get(protocolId)
    proto.add(file)
    return route_models.ProtocolResponse(
        data=_to_response(proto),
        links=get_protocol_links(router, proto.meta.identifier),
    )
示例#5
0
async def create_protocol(
        protocol_file: UploadFile = File(..., description="The protocol file"),
        support_files: typing.List[UploadFile] = Body(
            default=list(),
            description="Any support files needed by the protocol (ie data "
            "files, additional python files)"),
        protocol_manager=Depends(get_protocol_manager)):
    """Create protocol from proto file plus optional support files"""
    new_proto = protocol_manager.create(
        protocol_file=protocol_file,
        support_files=support_files,
    )
    return route_models.ProtocolResponse(data=_to_response(new_proto))
示例#6
0
async def delete_protocol(
    protocol_id: str,
    protocol_manager: ProtocolManager = Depends(get_protocol_manager)):
    proto = protocol_manager.remove(protocol_id)
    return route_models.ProtocolResponse(data=_to_response(proto))