added notification broadcast endpoint

This commit is contained in:
SrGooglo 2025-01-25 19:47:11 +00:00
parent 31fe2c1e71
commit 7448c187c2
3 changed files with 18 additions and 14 deletions

View File

@ -0,0 +1,18 @@
export default {
middlewares: [
"withAuthentication",
"onlyAdmin"
],
fn: async (req, res) => {
const payload = req.body ?? {}
global.websocket.io.of("/").emit("notification.broadcast", {
type: payload.type ?? "info",
title: payload.title,
message: payload.message,
image: payload.image,
})
return res.json({ ok: true })
}
}

View File

@ -1,5 +0,0 @@
export default () =>{
return {
hi: "hola xd"
}
}

View File

@ -1,9 +0,0 @@
export default async () => {
global.websocket.io.of("/").emit("new", {
hi: "hola xd"
})
return {
hi: "hola xd"
}
}