Table of Contents

Class PumpController

Namespace
adas_core.Controllers
Assembly
adas-core.dll
[Route("pumps")]
public class PumpController : ControllerBase
Inheritance
PumpController
Inherited Members
Extension Methods

Constructors

PumpController(IPumpService, IHistoricalConfigChangesService)

public PumpController(IPumpService pumpService, IHistoricalConfigChangesService historicalConfigChangesService)

Parameters

pumpService IPumpService
historicalConfigChangesService IHistoricalConfigChangesService

Methods

DeletePumpConfig(string)

Deletes a pump configuration identified by the specified id, retrieving it first, removing it, and logging the historical change after the deletion.

[HttpDelete("{id}")]
[AuthorizeRoles(PermissionEnum.RolesType.AuthSome)]
[PermissionAuthorize("Source", "DisplayId")]
public Task<IActionResult> DeletePumpConfig(string id)

Parameters

id string

The identifier of the pump configuration to delete.

Returns

Task<IActionResult>

An IActionResult containing the result of the deletion operation.

GetAllPumpConfig()

Retrieves all pump configuration records as an HTTP 200 OK response. Requires the caller to have the "AuthSome" role and "DisplayId" permission on the "Source" resource.

[HttpGet]
[AuthorizeRoles(PermissionEnum.RolesType.AuthSome)]
[PermissionAuthorize("Source", "DisplayId")]
public Task<IActionResult> GetAllPumpConfig()

Returns

Task<IActionResult>

An IActionResult containing the result of _pumpService.GetAllPumpConfig().

GetPumpConfigById(string)

Retrieves the pump configuration identified by the specified identifier, restricted to callers with the AuthSome role and DisplayId permission on the Source resource.

[HttpGet("{id}")]
[AuthorizeRoles(PermissionEnum.RolesType.AuthSome)]
[PermissionAuthorize("Source", "DisplayId")]
public Task<IActionResult> GetPumpConfigById(string id)

Parameters

id string

The unique identifier of the pump configuration to retrieve.

Returns

Task<IActionResult>

An HTTP 200 response containing the pump configuration that matches the specified identifier.

InsertPumpConfig(ConfigPumps)

Inserts a new pump configuration record after validating the request payload. Requires the caller to have the appropriate role and source-related permission.

[HttpPost]
[AuthorizeRoles(PermissionEnum.RolesType.AuthSome)]
[PermissionAuthorize("Source", "DisplayId")]
public Task<IActionResult> InsertPumpConfig(ConfigPumps config)

Parameters

config ConfigPumps

The pump configuration data supplied in the request body to be inserted.

Returns

Task<IActionResult>

An IActionResult containing the outcome of the pump configuration insertion.

Exceptions

BadRequestException

Thrown when config is null, indicating that required parameters are missing.

PaginatedPump(PaginationFilter)

Retrieves a paginated list of pumps based on the supplied filter configuration.

[HttpPost("paginated")]
[AuthorizeRoles(PermissionEnum.RolesType.AuthSome)]
[PermissionAuthorize("Source", "DisplayId")]
public Task<IActionResult> PaginatedPump(PaginationFilter config)

Parameters

config PaginationFilter

The pagination filter that defines the paging parameters for the pump query.

Returns

Task<IActionResult>

An IActionResult containing the paginated pump result.

Exceptions

BadRequestException

Thrown when the config parameter is null.

ProcessRequest(PumpDto)

Processes an incoming pump request by constructing an ApiRequest from the provided DTO and persisting it, using a synchronous save when the request indicates a wait-for-result, and an asynchronous save otherwise.

[HttpPost("request")]
[AuthorizeRoles(PermissionEnum.RolesType.AuthSome)]
[PermissionAuthorize("Source", "DisplayId")]
public IActionResult ProcessRequest(PumpDto pumpDto)

Parameters

pumpDto PumpDto

The pump data transfer object received in the request body, containing the patient number, location, pump observations, message time, and wait result flag.

Returns

IActionResult

An IActionResult representing an HTTP 200 OK response.

UpdatePumpConfig(ConfigPumps)

Updates an existing pump configuration and records the change in the historical log. Validates the incoming configuration payload, retrieving the previous configuration to enable historical tracking of changes.

[HttpPut]
[AuthorizeRoles(PermissionEnum.RolesType.AuthSome)]
[PermissionAuthorize("Source", "DisplayId")]
public Task<IActionResult> UpdatePumpConfig(ConfigPumps configPumps)

Parameters

configPumps ConfigPumps

The pump configuration data to update, provided in the request body.

Returns

Task<IActionResult>

An IActionResult containing the updated pump configuration wrapped in an Ok response.

Exceptions

BadRequestException

Thrown when the configPumps parameter is null.