changed ticket creation and list to typescript

This commit is contained in:
canove
2020-09-19 21:00:49 -03:00
parent 5dda3aabaf
commit 1d0bbda00d
16 changed files with 473 additions and 81 deletions

View File

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