Skip to content

SudoSOS Back-end API / catalogue/containers / ContainerController

Class: ContainerController ​

The BaseController class is responsible for:

  • Storing route definitions.
  • Generating router objects based on the policy.

Extends ​

Constructors ​

Constructor ​

ts
new ContainerController(options): ContainerController;

Creates a new product controller instance.

Parameters ​

ParameterTypeDescription
optionsBaseControllerOptionsThe options passed to the base controller.

Returns ​

ContainerController

Overrides ​

BaseController.constructor

Properties ​

PropertyModifierTypeDescriptionInherited from
roleManagerprotectedRoleManagerA reference to the role manager passed in the base controller options.BaseController.roleManager
specificationpublicSwaggerSpecificationA reference to the swagger specification passed in the base controller options.BaseController.specification

Methods ​

createContainer() ​

ts
createContainer(req, res): Promise<void>;

POST /containers

Parameters ​

ParameterType
reqRequestWithToken
resResponse

Returns ​

Promise<void>

200 - The created container entity

Operation Id ​

createContainer

Tags ​

containers - Operations of container controller

Security ​

JWT


deleteContainer() ​

ts
deleteContainer(req, res): Promise<void>;

DELETE /containers/

Parameters ​

ParameterType
reqRequestWithToken
resResponse

Returns ​

Promise<void>

204 - Success

Operation Id ​

deleteContainer

Tags ​

containers - Operations of container controller

Security ​

JWT


getAllContainers() ​

ts
getAllContainers(req, res): Promise<void>;

GET /containers

Parameters ​

ParameterType
reqRequestWithToken
resResponse

Returns ​

Promise<void>

200 - All existing containers

Operation Id ​

getAllContainers

Tags ​

containers - Operations of container controller

Security ​

JWT


getPolicy() ​

ts
getPolicy(): Policy;

Gets the policy defined by child classes. This policy includes all routes that the controller accepts, the authorization middleware, and the final handler function for every route.

Returns ​

Policy

The policy of this controller.

Overrides ​

BaseController.getPolicy


getProductsContainer() ​

ts
getProductsContainer(req, res): Promise<void>;

GET /containers/{id}/products

Parameters ​

ParameterType
reqRequestWithToken
resResponse

Returns ​

Promise<void>

200 - All products in the container

Operation Id ​

getProductsContainer

Tags ​

containers - Operations of container controller

Security ​

JWT


getPublicContainers() ​

ts
getPublicContainers(req, res): Promise<void>;

GET /containers/public

Parameters ​

ParameterType
reqRequestWithToken
resResponse

Returns ​

Promise<void>

200 - All existing public containers

Operation Id ​

getPublicContainers

Tags ​

containers - Operations of container controller

Security ​

JWT


getRouter() ​

ts
getRouter(): Router;

Returns ​

Router

the router used by this controller.

Inherited from ​

BaseController.getRouter


getSingleContainer() ​

ts
getSingleContainer(req, res): Promise<void>;

GET /containers/

Parameters ​

ParameterType
reqRequestWithToken
resResponse

Returns ​

Promise<void>

200 - The requested container

Operation Id ​

getSingleContainer

Tags ​

containers - Operations of container controller

Security ​

JWT


updateContainer() ​

ts
updateContainer(req, res): Promise<void>;

PATCH /containers/

Parameters ​

ParameterType
reqRequestWithToken
resResponse

Returns ​

Promise<void>

200 - The created container entity

Operation Id ​

updateContainer

Tags ​

containers - Operations of container controller

Security ​

JWT


getRelation() ​

ts
static getRelation(req): Promise<string>;

Function to determine which credentials are needed to get container 'all' if user is not connected to container 'organ' if user is not connected to container via organ 'own' if user is connected to container

Parameters ​

ParameterTypeDescription
reqRequestWithToken-

Returns ​

Promise<string>

whether container is connected to used token