Migrate changes from other Metamigo repo

This commit is contained in:
Darren Clarke 2023-03-13 15:53:21 +00:00
parent 8669b09224
commit 27810142b3
11 changed files with 615 additions and 235 deletions

View file

@ -141,6 +141,27 @@ export const RegisterBotRoute = Helpers.withDefaults({
},
});
export const UnverifyBotRoute = Helpers.withDefaults({
method: "post",
path: "/api/whatsapp/bots/{id}/unverify",
options: {
description: "Unverify bot",
async handler: (request: Hapi.Request, _h: Hapi.ResponseToolkit) {
const { id } = request.params;
const { whatsappService } = request.services();
const bot = await whatsappService.findById(id);
if (bot) {
return whatsappService.unverify(bot);
}
throw Boom.notFound("Bot not found");
},
},
});
export const RefreshBotRoute = Helpers.withDefaults({
method: "get",
path: "/api/whatsapp/bots/{id}/refresh",