From 2de7884949d7db91ba2f749a2d1575dd5ffc2f90 Mon Sep 17 00:00:00 2001 From: morteza-mortezai Date: Sat, 16 May 2026 12:31:51 +0330 Subject: [PATCH] me business --- src/modules/business/business.controller.ts | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/src/modules/business/business.controller.ts b/src/modules/business/business.controller.ts index ea5b019..3276589 100644 --- a/src/modules/business/business.controller.ts +++ b/src/modules/business/business.controller.ts @@ -1,37 +1,53 @@ -import { Controller, Get, Post, Body, Patch, Param, Delete, UseGuards, Query } from '@nestjs/common'; +import { + Controller, Get, Post, Body, Patch, Param, + Delete, UseGuards, Query +} from '@nestjs/common'; import { BusinessService } from './business.service'; import { SetupBusinessDto } from './dto/setup-business.dto'; import { SuperAdminAuthGuard } from '../auth/guards/superAdminAuth.guard'; import { FindBusinessesDto } from './dto/find-businesses.dto'; import { UpdateBusinessDto } from './dto/update-business.dto'; +import { AdminAuthGuard } from '../auth/guards/adminAuth.guard'; +import { BusinessId } from 'src/common/decorators'; @Controller('super-admin/business') -@UseGuards(SuperAdminAuthGuard) export class BusinessController { constructor(private readonly businessService: BusinessService) { } @Get('list') + @UseGuards(SuperAdminAuthGuard) findAll(@Query() dto: FindBusinessesDto) { return this.businessService.findAll(dto); } @Get(':id') + @UseGuards(SuperAdminAuthGuard) findOne(@Param('id') id: string) { return this.businessService.findByIdOrFail(id); } @Patch(':id') + @UseGuards(SuperAdminAuthGuard) update(@Param('id') id: string, @Body() updateBusinessDto: UpdateBusinessDto) { return this.businessService.update(id, updateBusinessDto); } @Post('setup') + @UseGuards(SuperAdminAuthGuard) create(@Body() dto: SetupBusinessDto) { return this.businessService.setupAccount(dto); } @Delete(':id') + @UseGuards(SuperAdminAuthGuard) remove(@Param('id') id: string) { return this.businessService.hardDelete(id); } + + @Get('me') + @UseGuards(AdminAuthGuard) + me(@BusinessId() businessId: string) { + return this.businessService.findByIdOrFail(businessId) + } + }