Skip to content

Commit 6f41efa

Browse files
committed
condition removal
The condition that checks authentication for instance removal has been removed.
1 parent a5d5015 commit 6f41efa

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

src/whatsapp/services/instance.service.ts

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -202,26 +202,23 @@ export class InstanceService {
202202

203203
public async deleteInstance(instance: InstanceDto, force = false) {
204204
try {
205-
const c1 = await this.repository.auth.count({
205+
const c1 = await this.repository.webhook.count({
206206
where: { Instance: { name: instance.instanceName } },
207207
});
208-
const c2 = await this.repository.webhook.count({
208+
const c2 = await this.repository.message.count({
209209
where: { Instance: { name: instance.instanceName } },
210210
});
211-
const c3 = await this.repository.message.count({
211+
const c3 = await this.repository.chat.count({
212212
where: { Instance: { name: instance.instanceName } },
213213
});
214-
const c4 = await this.repository.chat.count({
214+
const c4 = await this.repository.contact.count({
215215
where: { Instance: { name: instance.instanceName } },
216216
});
217-
const c5 = await this.repository.contact.count({
218-
where: { Instance: { name: instance.instanceName } },
219-
});
220-
const c6 = await this.repository.activityLogs.count({
217+
const c5 = await this.repository.activityLogs.count({
221218
where: { Instance: { name: instance.instanceName } },
222219
});
223220

224-
if (!force && (c1 || c2 || c3 || c4 || c5 || c6)) {
221+
if (!force && (c1 || c2 || c3 || c4 || c5)) {
225222
throw [
226223
new Error('This instance has dependencies and cannot be deleted'),
227224
new Error('"force" parameter to delete all dependencies'),

0 commit comments

Comments
 (0)