Class CameraController
- Namespace
- adas_core.Controllers
- Assembly
- adas-core.dll
Retrieves API endPoints for managing Camera Service
[ApiController]
public class CameraController : ControllerBase
- Inheritance
-
CameraController
- Inherited Members
- Extension Methods
Constructors
CameraController(ICameraService)
Retrieves API endPoints for managing Camera Service
public CameraController(ICameraService cameraService)
Parameters
cameraServiceICameraService
Methods
CreateCamera(Camera)
Creates a new camera by inserting the provided camera data into the system.
Requires the caller to have the AuthSome permission role.
[HttpPost]
[AuthorizeRoles(PermissionEnum.RolesType.AuthSome)]
public Task<IActionResult> CreateCamera(Camera camera)
Parameters
cameraCameraThe camera entity to be created, provided in the request body.
Returns
- Task<IActionResult>
An IActionResult containing the newly inserted camera wrapped in an HTTP 200 OK response.
DeleteCamera(string)
Deletes a camera identified by the provided id after validating that the id is a well-formed ObjectId.
[HttpDelete("{id}")]
[AuthorizeRoles(PermissionEnum.RolesType.AuthSome)]
public Task<IActionResult> DeleteCamera(string id)
Parameters
idstringThe string representation of the camera's ObjectId to be deleted.
Returns
- Task<IActionResult>
An IActionResult containing the result of the delete operation when the id is valid.
Exceptions
- BadRequestException
Thrown when the provided
idcannot be parsed as a valid ObjectId.
GetPaginatedCamera(PaginationFilter, bool)
Retrieves a paginated list of cameras based on the provided pagination filter. Validates that the request is not null before delegating to the camera service.
[HttpPost("paginated")]
[AuthorizeRoles(PermissionEnum.RolesType.AuthSome)]
public Task<IActionResult> GetPaginatedCamera(PaginationFilter request, bool withPoCs)
Parameters
requestPaginationFilterThe pagination filter containing paging criteria.
withPoCsboolIndicates whether the result should include PoCs (Points of Contact).
Returns
- Task<IActionResult>
An IActionResult containing the paginated cameras returned by the service.
Exceptions
- BadRequestException
Thrown when the
requestparameter is null.
GetSearchByName(string)
Searches for cameras whose names match the specified search text and returns the matching results.
[HttpGet("{textToSearch}")]
[AuthorizeRoles(PermissionEnum.RolesType.AuthSome)]
public Task<IActionResult> GetSearchByName(string textToSearch)
Parameters
textToSearchstringThe text used to search for cameras by name.
Returns
- Task<IActionResult>
An IActionResult containing the list of cameras that match the search criteria.
UpdateCamera(string, Camera)
Updates an existing camera identified by the provided id with the supplied camera data. Throws a BadRequestException when the id cannot be parsed as a valid ObjectId.
[HttpPut("{id}")]
[AuthorizeRoles(PermissionEnum.RolesType.AuthSome)]
public Task<IActionResult> UpdateCamera(string id, Camera camera)
Parameters
idstringThe identifier of the camera to update, provided in the route.
cameraCameraThe camera payload containing the updated information.
Returns
- Task<IActionResult>
An IActionResult containing the updated camera when the operation succeeds.
Exceptions
- BadRequestException
Thrown when the provided id is not a valid ObjectId.