mirror of
https://github.com/cheveguerra/whaticket-community.git
synced 2026-04-20 04:39:20 +00:00
fix: sonarcloud warning and code cleanup
This commit is contained in:
@@ -32,13 +32,11 @@ const CreateWhatsAppService = async ({
|
||||
"Check-name",
|
||||
"This whatsapp name is already used.",
|
||||
async value => {
|
||||
if (value) {
|
||||
const whatsappFound = await Whatsapp.findOne({
|
||||
where: { name: value }
|
||||
});
|
||||
return !whatsappFound;
|
||||
}
|
||||
return true;
|
||||
if (!value) return false;
|
||||
const nameExists = await Whatsapp.findOne({
|
||||
where: { name: value }
|
||||
});
|
||||
return !nameExists;
|
||||
}
|
||||
),
|
||||
isDefault: Yup.boolean().required()
|
||||
@@ -52,9 +50,7 @@ const CreateWhatsAppService = async ({
|
||||
|
||||
const whatsappFound = await Whatsapp.findOne();
|
||||
|
||||
if (!whatsappFound) {
|
||||
isDefault = !whatsappFound;
|
||||
}
|
||||
isDefault = !whatsappFound;
|
||||
|
||||
let oldDefaultWhatsapp: Whatsapp | null = null;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user