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 ​
new ContainerController(options): ContainerController;Creates a new product controller instance.
Parameters ​
| Parameter | Type | Description |
|---|---|---|
options | BaseControllerOptions | The options passed to the base controller. |
Returns ​
ContainerController
Overrides ​
Properties ​
| Property | Modifier | Type | Description | Inherited from |
|---|---|---|---|---|
roleManager | protected | RoleManager | A reference to the role manager passed in the base controller options. | BaseController.roleManager |
specification | public | SwaggerSpecification | A reference to the swagger specification passed in the base controller options. | BaseController.specification |
Methods ​
createContainer() ​
createContainer(req, res): Promise<void>;POST /containers
Parameters ​
| Parameter | Type |
|---|---|
req | RequestWithToken |
res | Response |
Returns ​
Promise<void>
200 - The created container entity
Operation Id ​
createContainer
Tags ​
containers - Operations of container controller
Security ​
JWT
deleteContainer() ​
deleteContainer(req, res): Promise<void>;DELETE /containers/
Parameters ​
| Parameter | Type |
|---|---|
req | RequestWithToken |
res | Response |
Returns ​
Promise<void>
204 - Success
Operation Id ​
deleteContainer
Tags ​
containers - Operations of container controller
Security ​
JWT
getAllContainers() ​
getAllContainers(req, res): Promise<void>;GET /containers
Parameters ​
| Parameter | Type |
|---|---|
req | RequestWithToken |
res | Response |
Returns ​
Promise<void>
200 - All existing containers
Operation Id ​
getAllContainers
Tags ​
containers - Operations of container controller
Security ​
JWT
getPolicy() ​
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 ​
The policy of this controller.
Overrides ​
getProductsContainer() ​
getProductsContainer(req, res): Promise<void>;GET /containers/{id}/products
Parameters ​
| Parameter | Type |
|---|---|
req | RequestWithToken |
res | Response |
Returns ​
Promise<void>
200 - All products in the container
Operation Id ​
getProductsContainer
Tags ​
containers - Operations of container controller
Security ​
JWT
getPublicContainers() ​
getPublicContainers(req, res): Promise<void>;GET /containers/public
Parameters ​
| Parameter | Type |
|---|---|
req | RequestWithToken |
res | Response |
Returns ​
Promise<void>
200 - All existing public containers
Operation Id ​
getPublicContainers
Tags ​
containers - Operations of container controller
Security ​
JWT
getRouter() ​
getRouter(): Router;Returns ​
Router
the router used by this controller.
Inherited from ​
getSingleContainer() ​
getSingleContainer(req, res): Promise<void>;GET /containers/
Parameters ​
| Parameter | Type |
|---|---|
req | RequestWithToken |
res | Response |
Returns ​
Promise<void>
200 - The requested container
Operation Id ​
getSingleContainer
Tags ​
containers - Operations of container controller
Security ​
JWT
updateContainer() ​
updateContainer(req, res): Promise<void>;PATCH /containers/
Parameters ​
| Parameter | Type |
|---|---|
req | RequestWithToken |
res | Response |
Returns ​
Promise<void>
200 - The created container entity
Operation Id ​
updateContainer
Tags ​
containers - Operations of container controller
Security ​
JWT
getRelation() ​
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 ​
| Parameter | Type | Description |
|---|---|---|
req | RequestWithToken | - |
Returns ​
Promise<string>
whether container is connected to used token