Software: Apache/2.4.41 (Ubuntu). PHP/8.0.30 uname -a: Linux apirnd 5.4.0-204-generic #224-Ubuntu SMP Thu Dec 5 13:38:28 UTC 2024 x86_64 uid=33(www-data) gid=33(www-data) groups=33(www-data) Safe-mode: OFF (not secure) /usr/local/lib/node_modules/homebridge-camera-ui/server/components/notifications/ drwxr-xr-x | |
| Viewing file: Select action/file-type: 'use-strict';
const NotificationsController = require('./notifications.controller');
const PaginationMiddleware = require('../../middlewares/pagination.middleware');
const PermissionMiddleware = require('../../middlewares/auth.permission.middleware');
const ValidationMiddleware = require('../../middlewares/auth.validation.middleware');
const NotificationsValidationMiddleware = require('../../middlewares/notifications.validation.middleware');
/**
* @swagger
* tags:
* name: Notifications
*/
exports.routesConfig = (app) => {
/**
* @swagger
* /api/notifications:
* get:
* tags: [Notifications]
* security:
* - bearerAuth: []
* summary: Get all notifications
* parameters:
* - in: query
* name: cameras
* description: Cameras
* example: "Camera One,Camera Two"
* type: string
* - in: query
* name: labels
* description: Labels
* example: "Human,Person,Face"
* type: string
* - in: query
* name: type
* description: Type
* example: "Snapshot,Video"
* type: string
* - in: query
* name: start
* type: number
* description: Start index
* - in: query
* name: page
* type: number
* description: Page
* - in: query
* name: pageSize
* type: number
* description: Page size
* - in: query
* name: from
* description: Start Date
* example: "2020-01-01"
* format: date
* pattern: "YYYY-MM-DD"
* minLength: 0
* maxLength: 10
* - in: query
* name: to
* description: End Date
* example: "2020-02-01"
* format: date
* pattern: "YYYY-MM-DD"
* minLength: 0
* maxLength: 10
* responses:
* 200:
* description: Successfull
* 401:
* description: Unauthorized
* 500:
* description: Internal server error
*/
app.get('/api/notifications', [
ValidationMiddleware.validJWTNeeded,
PermissionMiddleware.minimumPermissionLevelRequired('notifications:access'),
NotificationsController.list,
PaginationMiddleware.pages,
]);
/**
* @swagger
* /api/notifications:
* post:
* tags: [Notifications]
* security:
* - bearerAuth: []
* summary: Creates new notification
* requestBody:
* required: true
* content:
* application/json:
* schema:
* type: object
* properties:
* camera:
* type: string
* trigger:
* type: string
* responses:
* 201:
* description: Successfull
* 401:
* description: Unauthorized
* 500:
* description: Internal server error
*/
app.post('/api/notifications', [
ValidationMiddleware.validJWTNeeded,
PermissionMiddleware.minimumPermissionLevelRequired('notifications:edit'),
NotificationsValidationMiddleware.hasValidFields,
NotificationsController.insert,
]);
/**
* @swagger
* /api/notifications:
* delete:
* tags: [Notifications]
* security:
* - bearerAuth: []
* summary: Remove all notifications
* responses:
* 204:
* description: Successfull
* 401:
* description: Unauthorized
* 500:
* description: Internal server error
*/
app.delete('/api/notifications', [
ValidationMiddleware.validJWTNeeded,
PermissionMiddleware.minimumPermissionLevelRequired('notifications:edit'),
NotificationsController.removeAll,
]);
/**
* @swagger
* /api/notifications/{id}:
* get:
* tags: [Notifications]
* security:
* - bearerAuth: []
* summary: Get specific notifications by ID
* parameters:
* - in: path
* name: id
* schema:
* type: string
* required: true
* description: ID of the notification
* responses:
* 200:
* description: Successfull
* 401:
* description: Unauthorized
* 404:
* description: Not found
* 500:
* description: Internal server error
*/
app.get('/api/notifications/:id', [
ValidationMiddleware.validJWTNeeded,
PermissionMiddleware.minimumPermissionLevelRequired('notifications:access'),
NotificationsController.getById,
]);
/**
* @swagger
* /api/notifications/{id}:
* delete:
* tags: [Notifications]
* security:
* - bearerAuth: []
* summary: Delete notification by id
* parameters:
* - in: path
* name: id
* schema:
* type: string
* required: true
* description: ID of the notifications
* responses:
* 200:
* description: Successfull
* 400:
* description: Bad request
* 404:
* description: Not found
* 500:
* description: Internal server error
*/
app.delete('/api/notifications/:id', [
ValidationMiddleware.validJWTNeeded,
PermissionMiddleware.minimumPermissionLevelRequired('notifications:edit'),
NotificationsController.removeById,
]);
};
|
:: Command execute :: | |
--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.0537 ]-- |