add:wallet

This commit is contained in:
2026-04-15 09:14:24 +03:30
parent eca144a6c6
commit 6f1217f063
6 changed files with 92 additions and 6 deletions
@@ -12,12 +12,16 @@ import { CreateResellerAgentDto } from './dto/create-reseller-agent.dto';
import { SearchRewardsRequestQueryDto } from './dto/search-reward-requests.dto';
import { SearchCustomersDto } from '../users/DTO/search-customers.dto';
import { SearchResellerInvoicesQueryDto } from './dto/search-reseller-invoices.dto';
import { PaginationDto } from '../../common/DTO/pagination.dto';
import { WalletsService } from '../wallets/providers/wallets.service';
import { CreateWithdrawRequestDto } from './dto/create-withdraw-request.dto';
@Controller('reseller')
@AuthGuards()
export class ResellerController {
constructor(
private readonly resellerService: ResellerService,
private readonly walletsService: WalletsService,
) { }
@@ -94,4 +98,37 @@ export class ResellerController {
return this.resellerService.findResellerAgentsRewards(userId, query)
}
// ============ Wallet Transactions =============
@ApiOperation({ summary: "get Reseller/Agent Wallet Transactions ==> reseller route" })
@ResellerRoute()
@Get('wallet/transaction')
getWalletTransactionss(@UserDec("id") userId: string, @Query() query: PaginationDto) {
return this.walletsService.getTransaction(userId, query);
}
// ============ Wallet Balance =============
@ApiOperation({ summary: "get Reseller/Agent Wallet Balance ==> reseller route" })
@ResellerRoute()
@Get('wallet/balance')
getWalletBalance(@UserDec("id") userId: string) {
return this.walletsService.getBalance(userId)
}
// ============ WithDraw Request =============
@ApiOperation({ summary: "Create Reseller/Agent withdraw request ==> reseller route" })
@ResellerRoute()
@Post('wallet/withdraw')
withdrawRequest(@UserDec("id") userId: string, @Body() dto: CreateWithdrawRequestDto) {
return this.resellerService.createWithdrawRequest(userId, dto.amount)
}
// ============ Remove WithDraw Request =============
@ApiOperation({ summary: "remove Reseller/Agent withdraw request ==> reseller route" })
@ResellerRoute()
@Delete('wallet/withdraw/:id')
removeWithdrawRequest(@UserDec("id") userId: string) {
return this.walletsService.getBalance(userId)
}
}