Table of Contents

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

cameraService ICameraService

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

camera Camera

The 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

id string

The 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 id cannot 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

request PaginationFilter

The pagination filter containing paging criteria.

withPoCs bool

Indicates 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 request parameter 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

textToSearch string

The 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

id string

The identifier of the camera to update, provided in the route.

camera Camera

The 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.