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

24 lines
559 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.status(404).send();
}
});
messageRouter.post("/allReaded", (req, res) => {
messageManager.markAllReaded();
res.json(messageManager.get());
});
export default messageRouter;