hassio-nextcloud-backup/nextcloud_backup/backend/src/routes/messages.ts

24 lines
556 B
TypeScript
Raw Normal View History

import express from "express";
import messageManager from "../tools/messageManager.js";
const messageRouter = express.Router();
2024-02-19 10:52:37 +01:00
messageRouter.get("/", (req, res) => {
res.json(messageManager.get());
2022-10-26 14:09:10 +02:00
});
2024-02-19 10:52:37 +01:00
messageRouter.patch("/:messageId/readed", (req, res) => {
if (messageManager.markReaded(req.params.messageId)) {
2022-10-26 14:09:10 +02:00
res.json(messageManager.get());
2024-02-19 10:52:37 +01:00
} else {
2024-07-22 11:20:10 +02:00
res.sendStatus(404);
2022-10-26 14:09:10 +02:00
}
});
2024-02-19 10:52:37 +01:00
messageRouter.post("/allReaded", (req, res) => {
messageManager.markAllReaded();
res.json(messageManager.get());
});
export default messageRouter;