feat(mining-admin-service): add transfer-enabled API endpoints

Add GET and POST /configs/transfer-enabled endpoints to control
the transfer switch. Routes are placed before :category/:key to
avoid being matched as path parameters.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
hailin 2026-01-14 04:22:11 -08:00
parent 29dd1affe1
commit e99b5347da
1 changed files with 14 additions and 0 deletions

View File

@ -23,6 +23,20 @@ export class ConfigController {
return this.configService.getConfigs(category);
}
@Get('transfer-enabled')
@ApiOperation({ summary: '获取划转开关状态' })
async getTransferEnabled() {
const config = await this.configService.getConfig('system', 'transfer_enabled');
return { enabled: config?.configValue === 'true' };
}
@Post('transfer-enabled')
@ApiOperation({ summary: '设置划转开关状态' })
async setTransferEnabled(@Body() body: { enabled: boolean }, @Req() req: any) {
await this.configService.setConfig(req.admin.id, 'system', 'transfer_enabled', String(body.enabled), '划转开关');
return { success: true };
}
@Get(':category/:key')
@ApiOperation({ summary: '获取单个配置' })
@ApiParam({ name: 'category' })