feat: add queue and assoc with whatsapps

This commit is contained in:
canove
2021-01-08 17:41:08 -03:00
parent a12c9db731
commit 9f99245dc4
14 changed files with 217 additions and 7 deletions

View File

@@ -5,6 +5,7 @@ import Whatsapp from "../../models/Whatsapp";
interface Request {
name: string;
queueIds: number[];
status?: string;
isDefault?: boolean;
}
@@ -17,6 +18,7 @@ interface Response {
const CreateWhatsAppService = async ({
name,
status = "OPENING",
queueIds,
isDefault = false
}: Request): Promise<Response> => {
const schema = Yup.object().shape({
@@ -68,6 +70,8 @@ const CreateWhatsAppService = async ({
isDefault
});
await whatsapp.$set("queues", queueIds);
return { whatsapp, oldDefaultWhatsapp };
};