diff --git a/src/api/server.controller.ts b/src/api/server.controller.ts index 7e51c2cf..76db7a57 100644 --- a/src/api/server.controller.ts +++ b/src/api/server.controller.ts @@ -23,6 +23,7 @@ import { EnvironmentQuery, ServerStatusResponse, StopRequest, + StopResponse, } from '@waha/structures/server.dto'; import { VERSION } from '@waha/version'; import * as lodash from 'lodash'; @@ -89,7 +90,7 @@ export class ServerController { 'so you can use this endpoint to restart the server', }) @UsePipes(new WAHAValidationPipe()) - async stop(@Body() request: StopRequest) { + async stop(@Body() request: StopRequest): Promise { const timeout = 1_000; if (request.force) { this.logger.log(`Force stopping the server in ${timeout}ms`); @@ -109,6 +110,7 @@ export class ServerController { process.exit(0); }, timeout); } + return { stopping: true }; } } diff --git a/src/structures/server.dto.ts b/src/structures/server.dto.ts index a923554d..46daade2 100644 --- a/src/structures/server.dto.ts +++ b/src/structures/server.dto.ts @@ -28,6 +28,14 @@ export class StopRequest { force: boolean = false; } +export class StopResponse { + @ApiProperty({ + example: true, + description: "Always 'true' if the server is stopping.", + }) + stopping: boolean = true; +} + export class ServerStatusResponse { @ApiProperty({ example: 1723788847247,