diff --git a/src/modules/admin/controllers/admin.controller.ts b/src/modules/admin/controllers/admin.controller.ts index 1f6e273..f00bd1e 100644 --- a/src/modules/admin/controllers/admin.controller.ts +++ b/src/modules/admin/controllers/admin.controller.ts @@ -31,30 +31,24 @@ export class AdminController { return admin; } - // @Post() - // @HttpCode(HttpStatus.CREATED) - // @ApiOperation({ summary: 'Create a new admin' }) - // @ApiBody({ type: CreateAdminDto }) - // @ApiResponse({ status: 201, description: 'Admin created' }) - // async create(@Body() dto: CreateAdminDto, @RestId() restId: string) { - // const admin = await this.adminService.createRestaurantBySuperAdmin({ - // phone: dto.phone, - // firstName: dto.firstName, - // lastName: dto.lastName, - // roleId: dto.roleId, - // restId, - // }); - // return admin; - // } + @Post() + @HttpCode(HttpStatus.CREATED) + @ApiOperation({ summary: 'Create a new admin' }) + @ApiBody({ type: CreateAdminDto }) + @ApiResponse({ status: 201, description: 'Admin created' }) + async create(@Body() dto: CreateAdminDto, @RestId() restId: string) { + const admin = await this.adminService.createAdminForMyRestaurant(restId, dto); + return admin; + } - @Patch(':id') + @Patch(':adminId') @ApiOperation({ summary: 'Update an admin' }) - @ApiParam({ name: 'id', description: 'Admin ID' }) + @ApiParam({ name: 'adminId', description: 'Admin ID' }) @ApiBody({ type: UpdateAdminDto }) @ApiResponse({ status: 200, description: 'Admin updated successfully' }) @ApiResponse({ status: 404, description: 'Admin not found' }) - update(@Param('id') id: string, @Body() dto: UpdateAdminDto, @RestId() restId: string): Promise { - return this.adminService.update(id, restId, dto); + update(@Param('adminId') adminId: string, @Body() dto: UpdateAdminDto, @RestId() restId: string): Promise { + return this.adminService.update(adminId, restId, dto); } @Get(':adminId') @ApiOperation({ summary: 'Get an admin by ID' })