Merge commit 'f8bb37e12f96c86bb44a53ac28d06cc522cf7ab9' as 'backend'

This commit is contained in:
2026-04-27 22:44:05 +02:00
44 changed files with 7444 additions and 0 deletions
+39
View File
@@ -0,0 +1,39 @@
import { Router } from "express";
import Notification from "@schemas/Notification";
import { islogged } from "@/utility";
import { authRouter } from "./auth/index";
import mongoose from "mongoose";
import { apiRouter } from "./api";
import sync from "@/helpers/sync";
import usettings, { Features } from "@/helpers/usettings";
const router = Router();
router.use('/', apiRouter)
router.use('/auth', authRouter)
router.get("/healthcheck", async (req, res) => {
res.status(200).send({
uptime: process.uptime(),
date: new Date(),
db: mongoose.connection.readyState
})
})
router.post("/notif", islogged, usettings.mw(Features.Notif), async (req, res) => {
var obj = { user: req.user._id, ...req.body }
await Notification.findOneAndUpdate(obj, obj, { upsert: true })
res.send({ "status": 200 })
})
router.get("/sync", islogged, async (req, res) => {
const sub = sync.subscribe(req.user._id, v => {
res.send(v)
})
req.once('close', () => {
sub.unsubscribe()
})
})
export default router;