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:
parent
29dd1affe1
commit
e99b5347da
|
|
@ -23,6 +23,20 @@ export class ConfigController {
|
||||||
return this.configService.getConfigs(category);
|
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')
|
@Get(':category/:key')
|
||||||
@ApiOperation({ summary: '获取单个配置' })
|
@ApiOperation({ summary: '获取单个配置' })
|
||||||
@ApiParam({ name: 'category' })
|
@ApiParam({ name: 'category' })
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue