Skip to content

SudoSOS Back-end API / internal/files / SimpleFileController

Class: SimpleFileController ​

This is a mock-controller since there is no actual use for this controller in sudoSOS. This controller allows you to upload files to the server and retrieve them, however in actual production environment we only want to upload files with associations.

For example, the product controller would use the file-service to upload files.

Extends ​

Constructors ​

Constructor ​

ts
new SimpleFileController(options): SimpleFileController;

Creates a new product controller instance.

Parameters ​

ParameterTypeDescription
optionsBaseControllerOptionsThe options passed to the base controller.

Returns ​

SimpleFileController

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 ​

deleteFile() ​

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

DELETE /files/

Parameters ​

ParameterType
reqRequestWithToken
resResponse

Returns ​

Promise<void>

204 - Success

Operation Id ​

deleteFile

Tags ​

files - Operations of the simple files controller

Security ​

JWT


downloadFile() ​

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

GET /files/

Parameters ​

ParameterType
reqRequestWithToken
resResponse

Returns ​

Promise<void>

200 - The requested file

Operation Id ​

getFile

Tags ​

files - Operations of the simple files 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


getRouter() ​

ts
getRouter(): Router;

Returns ​

Router

the router used by this controller.

Inherited from ​

BaseController.getRouter


uploadFile() ​

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

POST /files

Parameters ​

ParameterType
reqRequestWithToken
resResponse

Returns ​

Promise<void>

200 - The uploaded file entity

Operation Id ​

createFile

Tags ​

files - Operations of the simple files controller

Consumes ​

multipart/form-data

Security ​

JWT