From 16ab3e668daa3d6e5ef0314f79e7ee82119ee395 Mon Sep 17 00:00:00 2001 From: morteza-mortezai Date: Mon, 5 Jan 2026 19:46:19 +0330 Subject: [PATCH] remove unused --- .../controllers/restaurants.controller.ts | 14 -------------- .../restaurants/dto/update-subscription.dto.ts | 14 -------------- .../providers/restaurants.service.ts | 17 +---------------- 3 files changed, 1 insertion(+), 44 deletions(-) delete mode 100644 src/modules/restaurants/dto/update-subscription.dto.ts diff --git a/src/modules/restaurants/controllers/restaurants.controller.ts b/src/modules/restaurants/controllers/restaurants.controller.ts index 89f1b20..f2c7979 100644 --- a/src/modules/restaurants/controllers/restaurants.controller.ts +++ b/src/modules/restaurants/controllers/restaurants.controller.ts @@ -3,7 +3,6 @@ import { RestaurantsService } from '../providers/restaurants.service'; import { CreateRestaurantDto } from '../dto/create-restaurant.dto'; import { UpdateRestaurantDto } from '../dto/update-restaurant.dto'; import { UpgradeSubscriptionDto } from '../dto/upgrade-subscription.dto'; -import { UpdateSubscriptionDto } from '../dto/update-subscription.dto'; import { FindRestaurantsDto } from '../dto/find-restaurants.dto'; import { AdminAuthGuard } from 'src/modules/auth/guards/adminAuth.guard'; import { @@ -123,17 +122,4 @@ export class RestaurantsController { return this.restaurantsService.upgradeSubscription(subscriptionId, upgradeSubscriptionDto); } - @UseGuards(SuperAdminAuthGuard) - @ApiBearerAuth() - @ApiOperation({ summary: 'Update subscription for a restaurant' }) - @ApiParam({ name: 'restaurantId', required: true, description: 'Restaurant ID' }) - @ApiBody({ type: UpdateSubscriptionDto }) - @Patch('super-admin/restaurants/:restaurantId/subscription') - updateSubscription( - @Param('restaurantId') restaurantId: string, - @Body() updateSubscriptionDto: UpdateSubscriptionDto - ) { - return this.restaurantsService.updateSubscription(restaurantId, updateSubscriptionDto); - } - } diff --git a/src/modules/restaurants/dto/update-subscription.dto.ts b/src/modules/restaurants/dto/update-subscription.dto.ts deleted file mode 100644 index 8bb80d5..0000000 --- a/src/modules/restaurants/dto/update-subscription.dto.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { ApiProperty } from '@nestjs/swagger'; -import { IsString, IsDate } from 'class-validator'; -import { Type } from 'class-transformer'; - -export class UpdateSubscriptionDto { - @ApiProperty({ example: 'sub_1234567890', description: 'Subscription ID' }) - @IsString() - subscriptionId!: string; - - @ApiProperty({ example: '2025-12-31', description: 'New subscription end date' }) - @Type(() => Date) - @IsDate() - subscriptionEndDate!: Date; -} diff --git a/src/modules/restaurants/providers/restaurants.service.ts b/src/modules/restaurants/providers/restaurants.service.ts index 663a9f0..6214866 100644 --- a/src/modules/restaurants/providers/restaurants.service.ts +++ b/src/modules/restaurants/providers/restaurants.service.ts @@ -2,8 +2,7 @@ import { BadRequestException, Injectable, NotFoundException } from '@nestjs/comm import { CreateRestaurantDto } from '../dto/create-restaurant.dto'; import { UpdateRestaurantDto } from '../dto/update-restaurant.dto'; import { UpgradeSubscriptionDto } from '../dto/upgrade-subscription.dto'; -import { UpdateSubscriptionDto } from '../dto/update-subscription.dto'; -import { Restaurant } from '../entities/restaurant.entity'; + import { Restaurant } from '../entities/restaurant.entity'; import { EntityManager } from '@mikro-orm/postgresql'; import { RestRepository } from '../repositories/rest.repository'; import { RestMessage } from 'src/common/enums/message.enum'; @@ -179,18 +178,4 @@ export class RestaurantsService { return restaurant; } - async updateSubscription(restaurantId: string, dto: UpdateSubscriptionDto): Promise { - const restaurant = await this.restRepository.findOne({ id: restaurantId }); - - if (!restaurant) { - throw new NotFoundException(RestMessage.NOT_FOUND); - } - - restaurant.subscriptionId = dto.subscriptionId; - restaurant.subscriptionEndDate = dto.subscriptionEndDate; - - await this.em.persistAndFlush(restaurant); - - return restaurant; - } }