Add the default unlurk message to the channel create endpoint
This commit is contained in:
parent
fa63dffede
commit
fc8c62f3ea
1 changed files with 4 additions and 1 deletions
|
|
@ -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);
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue