Skip to content

SudoSOS Back-end API / controller/user-notification-preference-controller / UserNotificationController

Class: UserNotificationController ​

The BaseController class is responsible for:

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

Extends ​

Constructors ​

Constructor ​

ts
new UserNotificationController(options): UserNotificationController;

Creates a new UserNotificationPreference controller instance

Parameters ​

ParameterTypeDescription
optionsBaseControllerOptionsThe options passed to the base controller.

Returns ​

UserNotificationController

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 ​

getAllUserNotificationPreferences() ​

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

GET /user-notification-preferences

Parameters ​

ParameterType
reqRequestWithToken
resResponse

Returns ​

Promise<void>

200 - All existing invoices

Operation Id ​

getAllUserNotificationPreferences

Tags ​

userNotificationPreferences - Operations of the user notification preference 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


getSingleUserNotificationPreference() ​

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

GET /user-notification-preferences/

Parameters ​

ParameterType
reqRequestWithToken
resResponse

Returns ​

Promise<void>

200 - The existing user notification preference

Operation Id ​

getSingleUserNotificationPreference

Tags ​

userNotificationPreferences - Operations of the user notification preference controller

Security ​

JWT


updateUserNotificationPreference() ​

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

PATCH /user-notification-preferences/

Parameters ​

ParameterType
reqRequestWithToken
resResponse

Returns ​

Promise<void>

200 - The existing user notification preference

Operation Id ​

updateUserNotificationPreference

Tags ​

userNotificationPreferences - Operations of the user notification preference controller

Security ​

JWT


filterRelation() ​

ts
static filterRelation(req): Promise<"all" | "own">;

Determines the relation between the user and the notification preference.

  • Returns own if user is connected to the notification preference
  • Returns all otherwise.

Parameters ​

ParameterTypeDescription
reqRequestWithTokenExpress request with user token and filters in query params.

Returns ​

Promise<"all" | "own">

'own' | 'all'


getRelation() ​

ts
static getRelation(req): Promise<"all" | "own">;

Determines which credentials are needed to get user notification preferences all if user is not connected to user notification preference own if user is connected to the notification preference

Parameters ​

ParameterTypeDescription
reqRequestWithTokenRequest with notification preference id as param

Returns ​

Promise<"all" | "own">

whether notification preference is connected to user token