mirror of
https://github.com/Sebclem/hassio-nextcloud-backup.git
synced 2024-11-22 17:22:58 +01:00
24 lines
556 B
TypeScript
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;
|