mirror of
https://github.com/cheveguerra/whaticket-community.git
synced 2026-04-19 20:29:17 +00:00
changed find to show services
This commit is contained in:
16
backend/src/helpers/GetDefaultWhatsApp.ts
Normal file
16
backend/src/helpers/GetDefaultWhatsApp.ts
Normal 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;
|
||||
Reference in New Issue
Block a user