@@ -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