reseller
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { Controller, Get, Post, Body, Delete } from '@nestjs/common';
|
||||
import { Controller, Get, Post, Body, Delete, Param, Query } from '@nestjs/common';
|
||||
import { ResellerService } from './reseller.service';
|
||||
import { ApiOperation } from '@nestjs/swagger';
|
||||
import { PermissionsDec } from '../../common/decorators/permission.decorator';
|
||||
@@ -9,6 +9,9 @@ import { AdminRoute } from '../../common/decorators/admin.decorator';
|
||||
import { ResellerRoute } from '../../common/decorators/reseller.decorator';
|
||||
import { UserDec } from '../../common/decorators/user.decorator';
|
||||
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';
|
||||
|
||||
@Controller('reseller')
|
||||
@AuthGuards()
|
||||
@@ -34,6 +37,16 @@ export class ResellerController {
|
||||
return this.resellerService.findAll()
|
||||
}
|
||||
|
||||
//=========== Reward Requests =========
|
||||
|
||||
@ApiOperation({ summary: "get reseller reward requests ==> admin route" })
|
||||
@AdminRoute()
|
||||
@PermissionsDec(PermissionEnum.RESELLER)
|
||||
@Get('reward/request')
|
||||
getRewardRequests() {
|
||||
return this.resellerService.findAll()
|
||||
}
|
||||
|
||||
// =========== Reseller-->Agent =============
|
||||
|
||||
@ApiOperation({ summary: "get Reseller agents ==> reseller route" })
|
||||
@@ -47,14 +60,38 @@ export class ResellerController {
|
||||
@ResellerRoute()
|
||||
@Post('agents')
|
||||
createResellerAgent(@UserDec("id") userId: string, @Body() dto: CreateResellerAgentDto) {
|
||||
return this.resellerService.createResellerAgent(userId, dto.userId)
|
||||
return this.resellerService.createResellerAgent(userId, dto.phone)
|
||||
}
|
||||
|
||||
@ApiOperation({ summary: "Remove Reseller agent ==> reseller route" })
|
||||
@ResellerRoute()
|
||||
@Delete('agents')
|
||||
deleteResellerAgent(@UserDec("id") userId: string, @Body() dto: CreateResellerAgentDto) {
|
||||
return this.resellerService.removeResellerAgent(userId, dto.userId)
|
||||
@Delete('agents/:agentId')
|
||||
deleteResellerAgent(@UserDec("id") userId: string, @Param('agentId') agentId: string) {
|
||||
return this.resellerService.removeResellerAgent(userId, agentId)
|
||||
}
|
||||
|
||||
// ============ Customers =============
|
||||
@ApiOperation({ summary: "get Reseller Customers ==> reseller route" })
|
||||
@ResellerRoute()
|
||||
@Get('customers')
|
||||
getCustomers(@UserDec("id") userId: string, @Query() dto: SearchCustomersDto) {
|
||||
return this.resellerService.findResellerCustomers(userId, dto)
|
||||
}
|
||||
|
||||
// ============ Invoice =============
|
||||
@ApiOperation({ summary: "get Reseller Customers Invoices==> reseller route" })
|
||||
@ResellerRoute()
|
||||
@Get('invoices')
|
||||
getCustomerInvoices(@UserDec("id") userId: string, @Query() query: SearchResellerInvoicesQueryDto) {
|
||||
return this.resellerService.findResellerCustomersInvoices(userId, query)
|
||||
}
|
||||
|
||||
// ============ Rewards =============
|
||||
@ApiOperation({ summary: "get Reseller Agents Rewards==> reseller route" })
|
||||
@ResellerRoute()
|
||||
@Get('rewards')
|
||||
getResellerAgentsRewards(@UserDec("id") userId: string, @Query() query: SearchRewardsRequestQueryDto) {
|
||||
return this.resellerService.findResellerAgentsRewards(userId, query)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user