hassio-nextcloud-backup/nextcloud_backup/backend/src/routes/messages.ts
2024-08-13 16:43:19 +02:00

24 lines
556 B
TypeScript

import express from "express";
import messageManager from "../tools/messageManager.js";
const messageRouter = express.Router();
messageRouter.get("/", (req, res) => {
res.json(messageManager.get());
});
messageRouter.patch("/:messageId/readed", (req, res) => {
if (messageManager.markReaded(req.params.messageId)) {
res.json(messageManager.get());
} else {
res.sendStatus(404);
}
});
messageRouter.post("/allReaded", (req, res) => {
messageManager.markAllReaded();
res.json(messageManager.get());
});
export default messageRouter;