From 77b682c8a8c87492379e015631d6daa3d956e92e Mon Sep 17 00:00:00 2001 From: hailin Date: Tue, 13 Jan 2026 23:22:17 -0800 Subject: [PATCH] feat(mining-wallet): make initialize endpoints public for internal network calls Changed system-accounts/initialize and pool-accounts/initialize endpoints from @AdminOnly to @Public to allow deploy scripts to call them without authentication. These endpoints are only accessible from internal network. Co-Authored-By: Claude Opus 4.5 --- .../src/api/controllers/pool-account.controller.ts | 6 +++--- .../src/api/controllers/system-account.controller.ts | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/backend/services/mining-wallet-service/src/api/controllers/pool-account.controller.ts b/backend/services/mining-wallet-service/src/api/controllers/pool-account.controller.ts index 1b9d5775..0d85005b 100644 --- a/backend/services/mining-wallet-service/src/api/controllers/pool-account.controller.ts +++ b/backend/services/mining-wallet-service/src/api/controllers/pool-account.controller.ts @@ -1,7 +1,7 @@ import { Controller, Get, Post, Body, Param, Query } from '@nestjs/common'; import { ApiTags, ApiOperation, ApiResponse, ApiBearerAuth, ApiQuery } from '@nestjs/swagger'; import { PoolAccountService } from '../../application/services/pool-account.service'; -import { AdminOnly } from '../../shared/guards/jwt-auth.guard'; +import { AdminOnly, Public } from '../../shared/guards/jwt-auth.guard'; import { PoolAccountType, TransactionType } from '@prisma/client'; import Decimal from 'decimal.js'; @@ -73,8 +73,8 @@ export class PoolAccountController { } @Post('initialize') - @AdminOnly() - @ApiOperation({ summary: '初始化池账户' }) + @Public() + @ApiOperation({ summary: '初始化池账户(仅限内网调用)' }) @ApiResponse({ status: 201, description: '池账户初始化成功' }) async initialize(@Body() dto: InitializePoolsDto) { return this.poolAccountService.initializePools({ diff --git a/backend/services/mining-wallet-service/src/api/controllers/system-account.controller.ts b/backend/services/mining-wallet-service/src/api/controllers/system-account.controller.ts index fa368221..0c4cbffe 100644 --- a/backend/services/mining-wallet-service/src/api/controllers/system-account.controller.ts +++ b/backend/services/mining-wallet-service/src/api/controllers/system-account.controller.ts @@ -1,7 +1,7 @@ import { Controller, Get, Post, Body, Param, Query } from '@nestjs/common'; import { ApiTags, ApiOperation, ApiResponse, ApiBearerAuth } from '@nestjs/swagger'; import { SystemAccountService } from '../../application/services/system-account.service'; -import { AdminOnly } from '../../shared/guards/jwt-auth.guard'; +import { AdminOnly, Public } from '../../shared/guards/jwt-auth.guard'; import { SystemAccountType } from '@prisma/client'; class InitializeSystemAccountsDto { @@ -47,8 +47,8 @@ export class SystemAccountController { } @Post('initialize') - @AdminOnly() - @ApiOperation({ summary: '初始化核心系统账户' }) + @Public() + @ApiOperation({ summary: '初始化核心系统账户(仅限内网调用)' }) @ApiResponse({ status: 201, description: '系统账户初始化成功' }) async initialize(@Body() dto: InitializeSystemAccountsDto) { return this.systemAccountService.initializeCoreAccounts(dto);