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 ​
new UserNotificationController(options): UserNotificationController;Creates a new UserNotificationPreference controller instance
Parameters ​
| Parameter | Type | Description |
|---|---|---|
options | BaseControllerOptions | The options passed to the base controller. |
Returns ​
UserNotificationController
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 ​
getAllUserNotificationPreferences() ​
getAllUserNotificationPreferences(req, res): Promise<void>;GET /user-notification-preferences
Parameters ​
| Parameter | Type |
|---|---|
req | RequestWithToken |
res | Response |
Returns ​
Promise<void>
200 - All existing invoices
Operation Id ​
getAllUserNotificationPreferences
Tags ​
userNotificationPreferences - Operations of the user notification preference 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 ​
getRouter() ​
getRouter(): Router;Returns ​
Router
the router used by this controller.
Inherited from ​
getSingleUserNotificationPreference() ​
getSingleUserNotificationPreference(req, res): Promise<void>;GET /user-notification-preferences/
Parameters ​
| Parameter | Type |
|---|---|
req | RequestWithToken |
res | Response |
Returns ​
Promise<void>
200 - The existing user notification preference
Operation Id ​
getSingleUserNotificationPreference
Tags ​
userNotificationPreferences - Operations of the user notification preference controller
Security ​
JWT
updateUserNotificationPreference() ​
updateUserNotificationPreference(req, res): Promise<void>;PATCH /user-notification-preferences/
Parameters ​
| Parameter | Type |
|---|---|
req | RequestWithToken |
res | Response |
Returns ​
Promise<void>
200 - The existing user notification preference
Operation Id ​
updateUserNotificationPreference
Tags ​
userNotificationPreferences - Operations of the user notification preference controller
Security ​
JWT
filterRelation() ​
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 ​
| Parameter | Type | Description |
|---|---|---|
req | RequestWithToken | Express request with user token and filters in query params. |
Returns ​
Promise<"all" | "own">
'own' | 'all'
getRelation() ​
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 ​
| Parameter | Type | Description |
|---|---|---|
req | RequestWithToken | Request with notification preference id as param |
Returns ​
Promise<"all" | "own">
whether notification preference is connected to user token