diff --git a/src/core/storage/ISessionConfigRepository.ts b/src/core/storage/ISessionConfigRepository.ts index f9546dbd..bb5e47fe 100644 --- a/src/core/storage/ISessionConfigRepository.ts +++ b/src/core/storage/ISessionConfigRepository.ts @@ -3,7 +3,7 @@ import { SessionConfig } from '../../structures/sessions.dto'; export abstract class ISessionConfigRepository { abstract saveConfig( sessionName: string, - config: SessionConfig | null, + config: SessionConfig, ): Promise; abstract getConfig(sessionName: string): Promise; diff --git a/src/core/storage/LocalSessionConfigRepository.ts b/src/core/storage/LocalSessionConfigRepository.ts index a418e6cb..b17df7d6 100644 --- a/src/core/storage/LocalSessionConfigRepository.ts +++ b/src/core/storage/LocalSessionConfigRepository.ts @@ -48,13 +48,13 @@ export class LocalSessionConfigRepository extends ISessionConfigRepository { return JSON.parse(content); } - async saveConfig(sessionName: string, config: SessionConfig | null) { - // Create folder if not exist + async saveConfig(sessionName: string, config: SessionConfig) { + // Create a folder if not exist const folder = this.store.getSessionDirectory(sessionName); await fs.mkdir(folder, { recursive: true }); // Save config const filepath = this.getFilePath(sessionName); - const content = JSON.stringify(config || null); + const content = JSON.stringify(config || {}); await writeFileAtomic(filepath, content); } diff --git a/src/structures/sessions.dto.ts b/src/structures/sessions.dto.ts index a96d89d2..a8b7e6c8 100644 --- a/src/structures/sessions.dto.ts +++ b/src/structures/sessions.dto.ts @@ -122,7 +122,7 @@ export class SessionConfig { }) @IsBoolean() @IsOptional() - debug: boolean; + debug?: boolean; @ApiProperty({ example: {