mirror of
https://github.com/cheveguerra/whaticket-community.git
synced 2026-04-19 20:29:17 +00:00
17 lines
409 B
TypeScript
17 lines
409 B
TypeScript
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;
|