Class ConfigDisplayController
- Namespace
- adas_core.Controllers
- Assembly
- adas-core.dll
Provides endpoints for managing and retrieving display configuration data.
[Route("config-displays")]
[ApiController]
public class ConfigDisplayController : ControllerBase
- Inheritance
-
ConfigDisplayController
- Inherited Members
- Extension Methods
Constructors
ConfigDisplayController(IDisplayConfigService)
Provides endpoints for managing and retrieving display configuration data.
public ConfigDisplayController(IDisplayConfigService displayConfigService)
Parameters
displayConfigServiceIDisplayConfigServiceThe service used to handle display configuration operations.
Exceptions
- ArgumentNullException
Thrown when
displayConfigServiceis null.
Methods
DeleteChartConfig(string)
Deletes a chart configuration identified by its identifier. Validates the identifier format and returns success when the configuration is removed, or raises an error when deletion cannot be completed.
[HttpDelete("chart-config/{idConfig}")]
[AuthorizeRoles(PermissionEnum.RolesType.AuthSome)]
[PermissionAuthorize("Source", "DisplayId")]
public Task<IActionResult> DeleteChartConfig(string idConfig)
Parameters
idConfigstringThe string representation of the chart configuration's identifier to be deleted.
Returns
- Task<IActionResult>
An IActionResult that returns HTTP 200 (OK) with the result of the deletion when the chart configuration is successfully removed.
Exceptions
- InvalidFormatException
Thrown when
idConfigis not a valid identifier format.- ConflictException
Thrown when the chart configuration cannot be deleted due to a conflict.
DeleteDisplayConfig(string)
Deletes a display configuration identified by the provided identifier. Validates the identifier format and delegates the deletion to the display configuration service, returning a success response when the operation completes or raising a conflict when the deletion fails.
[HttpDelete("{idConfig}")]
[AuthorizeRoles(PermissionEnum.RolesType.AuthSome)]
[PermissionAuthorize("Source", "DisplayId")]
public Task<IActionResult> DeleteDisplayConfig(string idConfig)
Parameters
idConfigstringThe identifier of the display configuration to delete.
Returns
- Task<IActionResult>
An IActionResult containing the result of the deletion when successful.
Exceptions
- InvalidFormatException
Thrown when
idConfigis not a valid identifier format.- ConflictException
Thrown when the display configuration could not be deleted.
GetAllCardConfig()
Retrieves all card display configurations from the display configuration service. This endpoint allows anonymous access and returns the complete list of card configurations.
[HttpGet("get-all-card-config")]
[AllowAnonymous]
public Task<IActionResult> GetAllCardConfig()
Returns
- Task<IActionResult>
An IActionResult containing the HTTP 200 OK response with all card configurations.
Exceptions
- ArgumentNullException
Thrown when
displayConfigServiceis null.
GetAllMediaFiles(string)
GetByCodeSysAndCode all media files in a shared folder
[AllowAnonymous]
[HttpGet("allMediaFiles/{id}")]
public Task<IActionResult> GetAllMediaFiles(string id)
Parameters
idstringdisplay config id
Returns
- Task<IActionResult>
File details list
Exceptions
GetChartConfig(string)
Retrieves the chart configuration for the specified identifier. Returns the configuration when found, or throws a not-found exception when no matching configuration exists.
[HttpGet("chart-config/{idConfig}")]
[AllowAnonymous]
public Task<IActionResult> GetChartConfig(string idConfig)
Parameters
idConfigstringThe string identifier of the chart configuration to retrieve. Must be a valid ObjectId.
Returns
- Task<IActionResult>
The chart configuration wrapped in an HTTP 200 OK response when found.
Exceptions
- InvalidFormatException
Thrown when
idConfigis not a valid ObjectId format.- NotFoundException
Thrown when no chart configuration matches the provided identifier.
GetDisplayConfigLocations(string)
Retrieves the locations associated with the specified display configuration identifier. Validates that the provided identifier is a valid ObjectId; otherwise, an invalid format exception is thrown.
[HttpGet("{idConfig}/locations")]
[AuthorizeRoles(PermissionEnum.RolesType.AuthSome)]
[PermissionAuthorize("Source", "DisplayId")]
public Task<IActionResult> GetDisplayConfigLocations(string idConfig)
Parameters
idConfigstringThe display configuration identifier used to look up its associated locations.
Returns
- Task<IActionResult>
The display configuration locations returned by the service.
Exceptions
- InvalidFormatException
Thrown when
idConfigis not a valid ObjectId format.
Insert(DisplayConfig)
Inserts a new display configuration by delegating to the display configuration service and returns the created result.
[HttpPost]
[AuthorizeRoles(PermissionEnum.RolesType.AuthSome)]
[PermissionAuthorize("Source", "DisplayId")]
public Task<IActionResult> Insert(DisplayConfig config)
Parameters
configDisplayConfigThe display configuration to insert, supplied in the request body.
Returns
- Task<IActionResult>
An IActionResult containing the inserted display configuration wrapped in an HTTP 200 OK response.
Exceptions
- ArgumentNullException
Thrown when
displayConfigServiceis null.
InsertCardConfig(CreateDisplayConfigCardDto)
Handles the HTTP POST request to insert a new card configuration. Requires the caller to be authorized with the appropriate role and permission for the "Source" entity on the "DisplayId" field, delegating the actual creation to the display configuration service.
[HttpPost("card-config")]
[AuthorizeRoles(PermissionEnum.RolesType.AuthSome)]
[PermissionAuthorize("Source", "DisplayId")]
public Task<IActionResult> InsertCardConfig(CreateDisplayConfigCardDto updateDisplayConfigNameDto)
Parameters
updateDisplayConfigNameDtoCreateDisplayConfigCardDtoThe data transfer object containing the card configuration details to be created.
Returns
- Task<IActionResult>
An IActionResult containing the result of the insert operation wrapped in an HTTP 200 OK response.
Exceptions
- ArgumentNullException
Thrown when
displayConfigServiceis null.
InsertCardDetailConfig(CreateDisplayConfigCardDto)
Inserts a new card detail configuration for the source display. Requires the AuthSome role and "Source"-"DisplayId" permission to access.
[HttpPost("detail-config")]
[AuthorizeRoles(PermissionEnum.RolesType.AuthSome)]
[PermissionAuthorize("Source", "DisplayId")]
public Task<IActionResult> InsertCardDetailConfig(CreateDisplayConfigCardDto updateDisplayConfigNameDto)
Parameters
updateDisplayConfigNameDtoCreateDisplayConfigCardDtoThe data transfer object containing the details of the card display configuration to create.
Returns
- Task<IActionResult>
An IActionResult containing the result of the insert operation wrapped in an HTTP 200 OK response.
Exceptions
- ArgumentNullException
Thrown when
displayConfigServiceis null.
InsertChartConfig(CreateDisplayConfigCardDto)
Inserts a new chart configuration based on the provided display configuration data, applying role-based and permission-based authorization checks.
[HttpPost("chart-config")]
[AuthorizeRoles(PermissionEnum.RolesType.AuthSome)]
[PermissionAuthorize("Source", "DisplayId")]
public Task<IActionResult> InsertChartConfig(CreateDisplayConfigCardDto updateDisplayConfigNameDto)
Parameters
updateDisplayConfigNameDtoCreateDisplayConfigCardDtoThe data transfer object containing the chart configuration details to be created.
Returns
- Task<IActionResult>
An IActionResult containing the result of the chart configuration insertion wrapped in an HTTP 200 OK response.
Exceptions
- ArgumentNullException
Thrown when
displayConfigServiceis null.
InsertMinimal(CreateDisplayConfigDto)
Inserts a minimal display configuration. If a display config ID template is provided, the configuration is inserted using the template along with the specified type and hospital; otherwise, it is inserted using the minimal fields from the supplied DTO.
[HttpPost("compact")]
[AuthorizeRoles(PermissionEnum.RolesType.AuthSome)]
[PermissionAuthorize("Source", "DisplayId")]
public Task<IActionResult> InsertMinimal(CreateDisplayConfigDto config)
Parameters
configCreateDisplayConfigDtoThe display configuration payload received in the request body, which may optionally include a display config ID template.
Returns
- Task<IActionResult>
An IActionResult containing the result of the insertion operation.
Exceptions
- ArgumentNullException
Thrown when
displayConfigServiceis null.
InsertNurse()
Handles a GET request to the "insertion-test" endpoint, performing a test insertion via the display configuration service. Requires the caller to have the AuthSome role and the "Source.DisplayId" permission.
[HttpGet("insertion-test")]
[AuthorizeRoles(PermissionEnum.RolesType.AuthSome)]
[PermissionAuthorize("Source", "DisplayId")]
public Task<IActionResult> InsertNurse()
Returns
- Task<IActionResult>
An IActionResult containing the result of the test insertion wrapped in an HTTP 200 OK response.
Exceptions
- ArgumentNullException
Thrown when
displayConfigServiceis null.
List()
GetByCodeSysAndCode all display config list
[HttpGet]
[AuthorizeRoles(PermissionEnum.RolesType.AuthSome)]
[PermissionAuthorize("Source", "DisplayId")]
public Task<IActionResult> List()
Returns
- Task<IActionResult>
List
Exceptions
- ArgumentNullException
Thrown when
displayConfigServiceis null.
ListById(string)
GetByCodeSysAndCode display config by it object id
[HttpGet("{id}")]
[AuthorizeRoles(PermissionEnum.RolesType.AuthSome)]
[PermissionAuthorize("Source", "DisplayId")]
public Task<IActionResult> ListById(string id)
Parameters
idstring
Returns
- Task<IActionResult>
displayConfig
Exceptions
- ArgumentNullException
Thrown when
displayConfigServiceis null.
ListByType(DisplayType)
GetByCodeSysAndCode all display config list by type
[HttpGet("{type}/type")]
[AuthorizeRoles(PermissionEnum.RolesType.AuthSome)]
[PermissionAuthorize("Source", "DisplayId")]
public Task<IActionResult> ListByType(DisplayConfigEnums.DisplayType type)
Parameters
Returns
- Task<IActionResult>
List
Exceptions
- ArgumentNullException
Thrown when
displayConfigServiceis null.
ListCompact()
GetByCodeSysAndCode all display config compact
[HttpGet("compact")]
[AuthorizeRoles(PermissionEnum.RolesType.AuthSome)]
public Task<IActionResult> ListCompact()
Returns
- Task<IActionResult>
List
Exceptions
- ArgumentNullException
Thrown when
displayConfigServiceis null.
ListCompactPaginated(PaginationFilter)
GetByCodeSysAndCode all display config compact paginated
[HttpPost("paginated")]
[AuthorizeRoles(PermissionEnum.RolesType.AuthSome)]
[PermissionAuthorize("Source", "DisplayId")]
public Task<IActionResult> ListCompactPaginated(PaginationFilter request)
Parameters
requestPaginationFilter
Returns
- Task<IActionResult>
List
Exceptions
- ArgumentNullException
Thrown when
displayConfigServiceis null.
StreamMediaById(string, string)
Search media element
[HttpGet]
[AllowAnonymous]
[Route("{id}/getMedia/{filename}")]
public Task<IActionResult> StreamMediaById(string filename, string id)
Parameters
Returns
- Task<IActionResult>
File stream
Exceptions
UpdateBaseConfig(DisplayConfig)
Updates the base configuration for a display source.
[HttpPut("update/base-config")]
[AuthorizeRoles(PermissionEnum.RolesType.AuthSome)]
[PermissionAuthorize("Source", "DisplayId")]
public Task<IActionResult> UpdateBaseConfig(DisplayConfig baseConfig)
Parameters
baseConfigDisplayConfigThe display configuration to apply as the base configuration.
Returns
- Task<IActionResult>
An IActionResult containing the update result, or an "OkResouceNotModified" response when no changes were made.
Exceptions
- ArgumentNullException
Thrown when
displayConfigServiceis null.
UpdateCardConfig(CardConfig)
Updates the card configuration for a display based on the provided configuration data. Returns the updated configuration on success, or a "resource not modified" response if no changes were applied.
[HttpPut("update/card-config")]
[AuthorizeRoles(PermissionEnum.RolesType.AuthSome)]
[PermissionAuthorize("Source", "DisplayId")]
public Task<IActionResult> UpdateCardConfig(CardConfig baseConfig)
Parameters
baseConfigCardConfigThe card configuration data to be updated.
Returns
- Task<IActionResult>
An IActionResult containing the updated configuration or a not-modified response.
Exceptions
- ArgumentNullException
Thrown when
displayConfigServiceis null.
UpdateChartConfig(ChartConfig)
Updates the chart configuration for a display based on the provided configuration. Returns the result of the update operation if successful, or a not-modified response if no changes were applied.
[HttpPut("update/chart-config")]
[AuthorizeRoles(PermissionEnum.RolesType.AuthSome)]
[PermissionAuthorize("Source", "DisplayId")]
public Task<IActionResult> UpdateChartConfig(ChartConfig baseConfig)
Parameters
baseConfigChartConfigThe chart configuration to update.
Returns
- Task<IActionResult>
An IActionResult containing the update result, or an OkResouceNotModified response when the configuration was not changed.
Exceptions
- ArgumentNullException
Thrown when
displayConfigServiceis null.
UpdateConfig(string, object)
Update display Config and notify subscribers
[HttpPut("{id}")]
[AuthorizeRoles(PermissionEnum.RolesType.AuthSome)]
[PermissionAuthorize("Source", "DisplayId")]
public Task<IActionResult> UpdateConfig(string id, object newDisplayConfig)
Parameters
Returns
- Task<IActionResult>
display
Exceptions
- ArgumentNullException
Thrown when
displayConfigServiceis null.
UpdateConfigColor(string, ColorConfig)
Updates the color configuration for the specified display configuration identifier. Requires the AuthSome role and the "DisplayId" source permission, and validates the identifier format before delegating the update to the display configuration service.
[HttpPut("{idConfig}/color-config")]
[AuthorizeRoles(PermissionEnum.RolesType.AuthSome)]
[PermissionAuthorize("Source", "DisplayId")]
public Task<IActionResult> UpdateConfigColor(string idConfig, ColorConfig colorConfig)
Parameters
idConfigstringThe display configuration identifier; must be a valid ObjectId.
colorConfigColorConfigThe new color configuration to apply.
Returns
- Task<IActionResult>
An IActionResult containing the update result on success, or a not-modified status when the update produces no changes.
Exceptions
- InvalidFormatException
Thrown when
idConfigis not a valid ObjectId format.
UpdateDetailConfig(CardDetailsConfig)
Updates the card detail configuration by delegating to the display configuration service. Returns the service result on success, or a "resource not modified" response when the update produced no changes.
[HttpPut("update/detail-config")]
[AuthorizeRoles(PermissionEnum.RolesType.AuthSome)]
[PermissionAuthorize("Source", "DisplayId")]
public Task<IActionResult> UpdateDetailConfig(CardDetailsConfig baseConfig)
Parameters
baseConfigCardDetailsConfigThe card details configuration to be updated.
Returns
- Task<IActionResult>
An IActionResult containing the update result, or a not-modified message if the resource was not changed.
Exceptions
- ArgumentNullException
Thrown when
displayConfigServiceis null.
UpdateFieldList(string, List<Field>)
Updates the field list associated with a display configuration identified by its ID. Validates the configuration ID format before delegating the update to the display configuration service.
[HttpPut("{idConfig}/field-list")]
[AuthorizeRoles(PermissionEnum.RolesType.AuthSome)]
[PermissionAuthorize("Source", "DisplayId")]
public Task<IActionResult> UpdateFieldList(string idConfig, List<Field> fields)
Parameters
idConfigstringThe string identifier of the display configuration to update.
fieldsList<Field>The list of fields to be applied to the specified display configuration.
Returns
- Task<IActionResult>
An IActionResult containing the result of the update operation.
Exceptions
- InvalidFormatException
Thrown when the provided
idConfigis not a valid ObjectId format.
UpdateHeaderConfig(string, HeaderConfig)
Updates the header configuration associated with the specified display configuration identifier. Validates the identifier format and applies the new header configuration, returning the result of the operation or a not-modified response when no changes were applied.
[HttpPut("{idConfig}/header-config")]
[AuthorizeRoles(PermissionEnum.RolesType.AuthSome)]
[PermissionAuthorize("Source", "DisplayId")]
public Task<IActionResult> UpdateHeaderConfig(string idConfig, HeaderConfig headerConfig)
Parameters
idConfigstringThe display configuration identifier expected in a valid ObjectId format.
headerConfigHeaderConfigThe header configuration payload to be applied to the display configuration.
Returns
- Task<IActionResult>
An IActionResult containing the update result on success, or a response indicating that the resource was not modified when no changes were made.
Exceptions
- InvalidFormatException
Thrown when
idConfigcannot be parsed as a valid ObjectId.
UpdateName(string, UpdateDisplayConfigNameDto)
Updates the display name of a hospital display configuration identified by the given configuration ID. Validates the ID format and the new display name, returning a success result when the update is applied or a not-modified status when no change is made.
[HttpPost("{idConfig}/name")]
[AuthorizeRoles(PermissionEnum.RolesType.AuthSome)]
[PermissionAuthorize("Source", "DisplayId")]
public Task<IActionResult> UpdateName(string idConfig, UpdateDisplayConfigNameDto updateDisplayConfigNameDto)
Parameters
idConfigstringThe configuration identifier whose display name will be updated.
updateDisplayConfigNameDtoUpdateDisplayConfigNameDtoThe data transfer object containing the new display configuration name.
Returns
- Task<IActionResult>
An IActionResult containing the update result, or a not-modified status when the name is unchanged.
Exceptions
- InvalidFormatException
Thrown when the configuration ID is not a valid format or when the display name is empty.
UpdateSetHomeBanner(string, List<BannerItem>)
Updates the home banner configuration for a nurse display configuration identified by the given id. Validates the id format, ensures the configuration exists, and verifies its type is DisplayNurse before applying the banner update.
[HttpPut("{idConfig}/home-banner")]
[AuthorizeRoles(PermissionEnum.RolesType.AuthSome)]
[PermissionAuthorize("Source", "DisplayId")]
public Task<IActionResult> UpdateSetHomeBanner(string idConfig, List<BannerItem> bannerItems)
Parameters
idConfigstringThe string identifier of the display configuration whose home banner will be updated; must be a valid ObjectId.
bannerItemsList<BannerItem>The list of banner items to set as the home banner configuration.
Returns
- Task<IActionResult>
An IActionResult containing the update result on success, or the not-modified status code when no changes are applied.
Exceptions
- InvalidFormatException
Thrown when
idConfigis not a valid ObjectId format.- NotFoundException
Thrown when no display configuration is found for the parsed id.
- BadRequestException
Thrown when the found display configuration is not of type DisplayNurse.