143 lines
4.0 KiB
TypeScript
143 lines
4.0 KiB
TypeScript
import * as express from "express";
|
|
import { PanelService } from "../controller/visualization/panelService.ts";
|
|
const router = express.Router();
|
|
/**
|
|
* @swagger
|
|
* tags:
|
|
* - name: Panels
|
|
* description: API operations related to panels
|
|
*/
|
|
/**
|
|
* @swagger
|
|
* components:
|
|
* schemas:
|
|
* Panel:
|
|
* type: object
|
|
* properties:
|
|
* _id:
|
|
* type: string
|
|
* example: "60d0fe4f5311236168a109ca"
|
|
* zoneId:
|
|
* type: string
|
|
* example: "67e3d030ed12ffa47b4eade3"
|
|
* panelName:
|
|
* type: string
|
|
* example: "New Panel"
|
|
* widgets:
|
|
* type: array
|
|
* items:
|
|
* type: string
|
|
* example: []
|
|
* isArchive:
|
|
* type: boolean
|
|
* example: false
|
|
* required:
|
|
* - zoneId
|
|
* - panelName
|
|
* - widgets
|
|
* - isArchive
|
|
*/
|
|
|
|
/**
|
|
* @swagger
|
|
* /panel/save:
|
|
* post:
|
|
* summary: Create new panels for a given zone
|
|
* tags: [Panels]
|
|
* requestBody:
|
|
* required: true
|
|
* content:
|
|
* application/json:
|
|
* schema:
|
|
* type: object
|
|
* properties:
|
|
* organization:
|
|
* type: string
|
|
* example: "NEWORG"
|
|
* zoneId:
|
|
* type: string
|
|
* example: "67e3d030ed12ffa47b4eade3"
|
|
* panelOrder:
|
|
* type: array
|
|
* items:
|
|
* type: string
|
|
* example: ["up", "right", "left", "down"]
|
|
* responses:
|
|
* 201:
|
|
* description: Panels created successfully
|
|
* content:
|
|
* application/json:
|
|
* schema:
|
|
* type: object
|
|
* properties:
|
|
* message:
|
|
* type: string
|
|
* example: "Panels created successfully"
|
|
* panelID:
|
|
* type: array
|
|
* items:
|
|
* type: string
|
|
* example: ["60d0fe4f5311236168a109ca", "60d0fe4f5311236168a109cb"]
|
|
* 200:
|
|
* description: No new panels were created as they already exist
|
|
* content:
|
|
* application/json:
|
|
* schema:
|
|
* type: object
|
|
* properties:
|
|
* message:
|
|
* type: string
|
|
* example: "No new panels were created. All panels already exist."
|
|
* 404:
|
|
* description: Zone not found
|
|
* content:
|
|
* application/json:
|
|
* schema:
|
|
* type: object
|
|
* properties:
|
|
* message:
|
|
* type: string
|
|
* example: "Zone not found"
|
|
* 500:
|
|
* description: Server error
|
|
*/
|
|
router.post("/panel/save", PanelService.AddPanel);
|
|
|
|
/**
|
|
* @swagger
|
|
* /panel/delete:
|
|
* patch:
|
|
* summary: Delete the panel on the Zone
|
|
* tags: [Panels]
|
|
* requestBody:
|
|
* required: true
|
|
* content:
|
|
* application/json:
|
|
* schema:
|
|
* type: object
|
|
* properties:
|
|
* organization:
|
|
* type: string
|
|
* example: "NEWORG"
|
|
* zoneId:
|
|
* type: string
|
|
* example: "0114-58-064-925"
|
|
* panelID:
|
|
* type: string
|
|
* example: "67e4f754cc778ad6c123394b"
|
|
* responses:
|
|
* 200:
|
|
* description: Panel deleted successfully
|
|
* 409:
|
|
* description: Panel Already Deleted
|
|
* 404:
|
|
* description: Zone not found
|
|
* 500:
|
|
* description: Server error
|
|
*/
|
|
router.patch("/panel/delete", PanelService.deletePanel);
|
|
router.patch("/clearpanel", PanelService.clearPanel);
|
|
|
|
// router.get("/zone/:sceneID", Zoneservice.allZones);
|
|
export default router;
|