add business owner assignment
This commit is contained in:
@@ -17,6 +17,7 @@ import { Roles } from '../auth/decorators/roles.decorator';
|
||||
import { JwtAuthGuard } from '../auth/guards/jwt-auth.guard';
|
||||
import { RolesGuard } from '../auth/guards/roles.guard';
|
||||
import { BusinessesService } from './businesses.service';
|
||||
import { AssignBusinessOwnerDto } from './dto/assign-business-owner.dto';
|
||||
import { CreateBusinessDto } from './dto/create-business.dto';
|
||||
import { UpdateBusinessDto } from './dto/update-business.dto';
|
||||
|
||||
@@ -50,6 +51,16 @@ export class BusinessesController {
|
||||
return this.service.create(payload);
|
||||
}
|
||||
|
||||
@Post(':id/assign-owner')
|
||||
@UseGuards(JwtAuthGuard, RolesGuard)
|
||||
@Roles(UserRole.ADMIN)
|
||||
assignOwner(
|
||||
@Param('id') id: string,
|
||||
@Body() payload: AssignBusinessOwnerDto,
|
||||
): Promise<BusinessEntity> {
|
||||
return this.service.assignOwner(id, payload);
|
||||
}
|
||||
|
||||
@Patch(':id')
|
||||
@UseGuards(JwtAuthGuard, RolesGuard)
|
||||
@Roles(UserRole.ADMIN, UserRole.BUSINESS_OWNER)
|
||||
|
||||
Reference in New Issue
Block a user