0
0
Fork 0
This commit is contained in:
Oliver Akins 2022-07-22 00:22:49 -06:00
parent 6a5f642fb4
commit 48dffc112a
No known key found for this signature in database
GPG key ID: 3C2014AF9457AF99
21 changed files with 1327 additions and 0 deletions

View file

@ -0,0 +1,27 @@
import { ServerRoute } from "@hapi/hapi";
import boom from "@hapi/boom";
import { db } from "@/main";
const data: ServerRoute = {
method: `GET`, path: `/manage/{channel}`,
async handler(request, h) {
const { channel } = request.params;
if (!db[channel]) {
throw boom.notFound(`Invalid channel`);
};
let messages = [];
for (const messageId in db[channel].messages) {
let message = db[channel].messages[messageId];
messages.push({
id: messageId,
lurk: message.lurk,
unlurk: message.unlurk,
});
};
return h.response(messages).code(200);
},
};
export default data;