Skip to content

Commit

Permalink
Merge pull request #240 from sotatek-dev/feat/add-token
Browse files Browse the repository at this point in the history
feat: api redeploy
  • Loading branch information
Sotatek-TanHoang authored Jan 7, 2025
2 parents 58f0705 + ba328aa commit 4c49fd3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
9 changes: 9 additions & 0 deletions src/modules/users/admin.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { Body, Controller, Get, Param, Post, Put, Query, UseGuards } from '@nest
import { AuthGuard } from '@nestjs/passport';
import { ApiOkResponse, ApiTags } from '@nestjs/swagger';

import { GuardPublic } from '../../guards/guard.decorator.js';
import { AuthAdminGuard } from '../../shared/decorators/http.decorator.js';
import { AdminService } from './admin.service.js';
import { CreateTokenReqDto } from './dto/admin-request.dto.js';
Expand Down Expand Up @@ -55,6 +56,14 @@ export class AdminController {
return this.userService.updateTokenVisibility(id, updateConfig);
}

@Post('token/re-deploy/:id')
// @AuthAdminGuard()
@GuardPublic()
// @UseGuards(AuthGuard('jwt'))
redeployToken(@Param('id') id: number) {
return this.adminService.redeployToken(id);
}

@Post('new-token')
@AuthAdminGuard()
@UseGuards(AuthGuard('jwt'))
Expand Down
5 changes: 3 additions & 2 deletions src/modules/users/admin.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ export class AdminService {
if (tokenInfo.status !== ETokenPairStatus.DEPLOY_FAILED) {
return httpBadRequest(EError.ACTION_CANNOT_PROCESSED);
}

await this.tokenDeployerService.deployTokenMina(tokenInfo.id);
await this.tokenDeployerService.addJobDeployTokenMina(tokenInfo.id);
tokenInfo.status = ETokenPairStatus.DEPLOYING;
return tokenInfo.save();
}
}

0 comments on commit 4c49fd3

Please sign in to comment.