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