File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import { Injectable , UnprocessableEntityException } from '@nestjs/common' ;
22import { IAppsService } from '@waha/apps/app_sdk/services/IAppsService' ;
3+ import { DataStore } from '@waha/core/abc/DataStore' ;
34import { SessionManager } from '@waha/core/abc/manager.abc' ;
45import { WhatsappSession } from '@waha/core/abc/session.abc' ;
56import { Knex } from 'knex' ;
@@ -36,7 +37,7 @@ export class AppsDisabledService implements IAppsService {
3637 return ;
3738 }
3839
39- async beforeSessionStart ( session : WhatsappSession , knex ) {
40+ async beforeSessionStart ( session : WhatsappSession , store : DataStore ) {
4041 return ;
4142 }
4243}
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ import { migrate } from '@waha/apps/app_sdk/migrations';
33import { IAppService } from '@waha/apps/app_sdk/services/IAppService' ;
44import { IAppsService } from '@waha/apps/app_sdk/services/IAppsService' ;
55import { ChatWootAppService } from '@waha/apps/chatwoot/services/ChatWootAppService' ;
6+ import { DataStore } from '@waha/core/abc/DataStore' ;
67import { SessionManager } from '@waha/core/abc/manager.abc' ;
78import { WhatsappSession } from '@waha/core/abc/session.abc' ;
89import { generatePrefixedId } from '@waha/utils/ids' ;
@@ -106,7 +107,8 @@ export class AppsEnabledService implements IAppsService {
106107 return ;
107108 }
108109
109- async beforeSessionStart ( session : WhatsappSession , knex ) {
110+ async beforeSessionStart ( session : WhatsappSession , store : DataStore ) {
111+ const knex = store . getWAHADatabase ( ) ;
110112 const repo = new AppRepository ( knex ) ;
111113 const apps = await repo . getAllBySession ( session . name ) ;
112114 for ( const app of apps ) {
Original file line number Diff line number Diff line change 11import { App } from '@waha/apps/app_sdk/dto/app.dto' ;
2+ import { DataStore } from '@waha/core/abc/DataStore' ;
23import { SessionManager } from '@waha/core/abc/manager.abc' ;
34import { WhatsappSession } from '@waha/core/abc/session.abc' ;
45import { Knex } from 'knex' ;
@@ -12,7 +13,7 @@ export interface IAppsService {
1213
1314 delete ( manager : SessionManager , appId : string ) : Promise < void > ;
1415
15- beforeSessionStart ( session : WhatsappSession , knex : Knex ) : Promise < void > ;
16+ beforeSessionStart ( session : WhatsappSession , store : DataStore ) : Promise < void > ;
1617
1718 migrate ( knex : Knex ) : Promise < void > ;
1819}
Original file line number Diff line number Diff line change @@ -103,10 +103,7 @@ export abstract class SessionManager
103103 }
104104
105105 async configureApps ( session : WhatsappSession ) {
106- await this . appsService . beforeSessionStart (
107- session ,
108- this . store . getWAHADatabase ( ) ,
109- ) ;
106+ await this . appsService . beforeSessionStart ( session , this . store ) ;
110107 }
111108
112109 //
You can’t perform that action at this time.
0 commit comments