[core] Add Old prefix for old methods
This commit is contained in:
1 parent
d4164fe0ba
commit
a2d0dfd8b2
3 files changed
+13
-13
No files matched your search
@@ -36,7 +36,7 @@ class SessionsController {
|
||||
@Post('/start/')
|
||||
@UsePipes(new WAHAValidationPipe())
|
||||
async start(@Body() request: SessionStartRequest): Promise<SessionDTO> {
|
||||
const result = await this.manager.start(request);
|
||||
const result = await this.manager.startOld(request);
|
||||
await this.manager.sessionConfigRepository.save(
|
||||
request.name,
|
||||
request.config || null,
|
||||
@@ -49,9 +49,9 @@ class SessionsController {
|
||||
@ApiOperation({ summary: 'Stop session' })
|
||||
async stop(@Body() request: SessionStopRequest): Promise<void> {
|
||||
if (request.logout) {
|
||||
await this.manager.logout(request);
|
||||
await this.manager.logoutOld(request);
|
||||
} else {
|
||||
await this.manager.stop(request);
|
||||
await this.manager.stopOld(request);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -60,7 +60,7 @@ class SessionsController {
|
||||
@UsePipes(new WAHAValidationPipe())
|
||||
@ApiOperation({ summary: 'Logout from session.' })
|
||||
clean(@Body() request: SessionLogoutRequest): Promise<void> {
|
||||
return this.manager.logout(request);
|
||||
return this.manager.logoutOld(request);
|
||||
}
|
||||
|
||||
@Get('/')
|
||||
|
||||
@@ -37,11 +37,11 @@ export abstract class SessionManager implements BeforeApplicationShutdown {
|
||||
//
|
||||
// API Methods
|
||||
//
|
||||
abstract start(request: SessionStartRequest): Promise<SessionDTO>;
|
||||
abstract startOld(request: SessionStartRequest): Promise<SessionDTO>;
|
||||
|
||||
abstract stop(request: SessionStopRequest): Promise<void>;
|
||||
abstract stopOld(request: SessionStopRequest): Promise<void>;
|
||||
|
||||
abstract logout(request: SessionLogoutRequest): Promise<void>;
|
||||
abstract logoutOld(request: SessionLogoutRequest): Promise<void>;
|
||||
|
||||
abstract getSession(name: string): WhatsappSession;
|
||||
|
||||
|
||||
@@ -76,7 +76,7 @@ export class SessionManagerCore extends SessionManager {
|
||||
protected startPredefinedSessions() {
|
||||
const startSessions = this.config.startSessions;
|
||||
startSessions.forEach((sessionName) => {
|
||||
this.start({ name: sessionName });
|
||||
this.startOld({ name: sessionName });
|
||||
});
|
||||
}
|
||||
|
||||
@@ -102,13 +102,13 @@ export class SessionManagerCore extends SessionManager {
|
||||
if (!this.session) {
|
||||
return;
|
||||
}
|
||||
await this.stop({ name: this.DEFAULT, logout: false });
|
||||
await this.stopOld({ name: this.DEFAULT, logout: false });
|
||||
}
|
||||
|
||||
//
|
||||
// API Methods
|
||||
//
|
||||
async start(request: SessionStartRequest): Promise<SessionDTO> {
|
||||
async startOld(request: SessionStartRequest): Promise<SessionDTO> {
|
||||
this.onlyDefault(request.name);
|
||||
if (this.session) {
|
||||
throw new UnprocessableEntityException(
|
||||
@@ -192,7 +192,7 @@ export class SessionManagerCore extends SessionManager {
|
||||
return getProxyConfig(this.config, sessions, request.name);
|
||||
}
|
||||
|
||||
async stop(request: SessionStopRequest): Promise<void> {
|
||||
async stopOld(request: SessionStopRequest): Promise<void> {
|
||||
this.onlyDefault(request.name);
|
||||
|
||||
const name = request.name;
|
||||
@@ -203,10 +203,10 @@ export class SessionManagerCore extends SessionManager {
|
||||
this.session = undefined;
|
||||
}
|
||||
|
||||
async logout(request: SessionLogoutRequest) {
|
||||
async logoutOld(request: SessionLogoutRequest) {
|
||||
const name = request.name;
|
||||
this.onlyDefault(request.name);
|
||||
this.stop({ name: name, logout: false })
|
||||
this.stopOld({ name: name, logout: false })
|
||||
.then(() => {
|
||||
this.log.info(`Session '${name}' has been stopped.`);
|
||||
})
|
||||
|
||||
Reference in new issue
Block a user