0
0
Fork 0

Add the default unlurk message to the channel create endpoint

This commit is contained in:
Oliver Akins 2022-07-26 18:43:30 -06:00
parent fa63dffede
commit fc8c62f3ea
No known key found for this signature in database
GPG key ID: 3C2014AF9457AF99

View file

@ -9,17 +9,20 @@ const data: ServerRoute = {
validate: { validate: {
payload: Joi.object({ payload: Joi.object({
channel: Joi.string().alphanum(), channel: Joi.string().alphanum(),
default_unlurk: Joi.string().min(1),
}), }),
}, },
}, },
async handler(request, h) { async handler(request, h) {
const { channel } = request.params; const { channel, default_unlurk } = request.payload as post_channel_payload;
if (!db[channel]) { if (!db[channel]) {
throw boom.notFound(`Invalid channel`); throw boom.notFound(`Invalid channel`);
}; };
db[channel].lurkers = {}; db[channel].lurkers = {};
db[channel].unlurk_default = default_unlurk;
db[channel].messages = {};
return h.response().code(200); return h.response().code(200);
}, },