In user registration add standard whatsapp field

This commit is contained in:
Ricardo Paes
2022-02-25 08:18:57 -03:00
parent 61df7c8bc0
commit 84bbe3afaa
11 changed files with 62 additions and 21 deletions

View File

@@ -10,6 +10,7 @@ interface Request {
name: string;
queueIds?: number[];
profile?: string;
whatsappId?: number;
}
interface Response {
@@ -24,7 +25,8 @@ const CreateUserService = async ({
password,
name,
queueIds = [],
profile = "admin"
profile = "admin",
whatsappId
}: Request): Promise<Response> => {
const schema = Yup.object().shape({
name: Yup.string().required().min(2),
@@ -56,9 +58,10 @@ const CreateUserService = async ({
email,
password,
name,
profile
profile,
whatsappId: whatsappId ? whatsappId : null
},
{ include: ["queues"] }
{ include: ["queues", "whatsapp"] }
);
await user.$set("queues", queueIds);