Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 | import express from "express"; import { ThingyController } from "../controllers/thingyController"; const router = express.Router(); const thingyController = new ThingyController(); /** * @swagger * /api/thingys: * get: * tags: * - Thingys * summary: Get data from all thingys * description: Retrieve a list of thingys data. Supports filtering by macAddress, timestamp, temperature, humidity, pm_1, pm_2_5, and pm_10. * parameters: * - in: query * name: macAddress * schema: * type: string * description: Filter by Thingy MAC address * - in: query * name: startdate * schema: * type: string * format: date-time * description: Filter tags with timestamp greater than or equal to this value (ISO 8601) * - in: query * name: enddate * schema: * type: string * format: date-time * description: Filter tags with timestamp less than or equal to this value (ISO 8601) * - in: query * name: temperature * schema: * type: number * description: Filter by temperature * - in: query * name: humidity * schema: * type: number * description: Filter by humidity * - in: query * name: pm_1 * schema: * type: number * description: Filter by PM 1.0 value * - in: query * name: pm_2_5 * schema: * type: number * description: Filter by PM 2.5 value * - in: query * name: pm_10 * schema: * type: number * description: Filter by PM 10 value * - in: query * name: limit * schema: * type: number * description: Limit the number of results returned * responses: * 200: * description: A list of thingys data * content: * application/json: * schema: * type: array * items: * $ref: '#/components/schemas/Thingy' * 500: * description: Failed to fetch devices, Internal server error */ router.get("/", thingyController.getThingysData); /** * @swagger * /api/thingys/{_id}: * delete: * tags: * - Thingys * summary: Delete a thingy by its ObjectID * parameters: * - in: path * name: _id * required: true * schema: * type: string * description: The MongoDB ObjectID of the thingy * responses: * 200: * description: Thingy deleted successfully * 404: * description: Thingy not found * 400: * description: Invalid or missing ID * 500: * description: Failed to delete thingy, Internal server error */ router.delete("/:id", thingyController.deleteThingyById); export default router; |