changed find to show services

This commit is contained in:
canove
2020-09-20 11:27:58 -03:00
parent 4fda0b18c6
commit 02d90af657
13 changed files with 40 additions and 59 deletions

View File

@@ -0,0 +1,16 @@
import AppError from "../errors/AppError";
import Whatsapp from "../models/Whatsapp";
const GetDefaultWhatsApp = async (): Promise<Whatsapp> => {
const defaultWhatsapp = await Whatsapp.findOne({
where: { isDefault: true }
});
if (!defaultWhatsapp) {
throw new AppError("No default WhatsApp found. Check Connection page.");
}
return defaultWhatsapp;
};
export default GetDefaultWhatsApp;