clean foldering
This commit is contained in:
@@ -1,24 +0,0 @@
|
|||||||
import { Controller, Get, UseGuards } from '@nestjs/common';
|
|
||||||
import { ApiTags, ApiOperation, ApiOkResponse, ApiBearerAuth } from '@nestjs/swagger';
|
|
||||||
import { RestaurantShipmentMethodService } from '../providers/restaurant-shipment-method.service';
|
|
||||||
import { RestaurantShipmentMethod } from '../entities/restaurant-shipment-method.entity';
|
|
||||||
import { RestId } from 'src/common/decorators/rest-id.decorator';
|
|
||||||
import { AuthGuard } from 'src/modules/auth/guards/auth.guard';
|
|
||||||
|
|
||||||
@UseGuards(AuthGuard)
|
|
||||||
@ApiBearerAuth()
|
|
||||||
@ApiTags('restaurant-shipment-methods')
|
|
||||||
@Controller('restaurant-shipment-methods')
|
|
||||||
export class PublicRestaurantShipmentMethodController {
|
|
||||||
constructor(private readonly restaurantShipmentMethodService: RestaurantShipmentMethodService) {}
|
|
||||||
|
|
||||||
@Get()
|
|
||||||
@ApiOperation({ summary: 'Get restaurant shipment methods ' })
|
|
||||||
@ApiOkResponse({
|
|
||||||
description: 'List of restaurant shipment methods',
|
|
||||||
type: [RestaurantShipmentMethod],
|
|
||||||
})
|
|
||||||
findAll(@RestId() restId: string) {
|
|
||||||
return this.restaurantShipmentMethodService.findAllForRestaurantId(restId);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -3,8 +3,8 @@ import { RestaurantsService } from '../providers/restaurants.service';
|
|||||||
import { RestaurantSpecificationDto } from '../dto/restaurant-specification.dto';
|
import { RestaurantSpecificationDto } from '../dto/restaurant-specification.dto';
|
||||||
import { ApiTags, ApiOperation, ApiOkResponse, ApiParam, ApiNotFoundResponse } from '@nestjs/swagger';
|
import { ApiTags, ApiOperation, ApiOkResponse, ApiParam, ApiNotFoundResponse } from '@nestjs/swagger';
|
||||||
|
|
||||||
@ApiTags('restaurants')
|
@ApiTags('public/restaurants')
|
||||||
@Controller('restaurants')
|
@Controller('public/restaurants')
|
||||||
export class PublicRestaurantController {
|
export class PublicRestaurantController {
|
||||||
constructor(private readonly restaurantsService: RestaurantsService) {}
|
constructor(private readonly restaurantsService: RestaurantsService) {}
|
||||||
|
|
||||||
|
|||||||
@@ -3,8 +3,8 @@ import { ScheduleService } from '../providers/schedule.service';
|
|||||||
import { Schedule } from '../entities/schedule.entity';
|
import { Schedule } from '../entities/schedule.entity';
|
||||||
import { ApiTags, ApiOperation, ApiOkResponse, ApiParam } from '@nestjs/swagger';
|
import { ApiTags, ApiOperation, ApiOkResponse, ApiParam } from '@nestjs/swagger';
|
||||||
|
|
||||||
@ApiTags('schedules')
|
@ApiTags('public/schedules')
|
||||||
@Controller('schedules')
|
@Controller('public/schedules')
|
||||||
export class PublicScheduleController {
|
export class PublicScheduleController {
|
||||||
constructor(private readonly scheduleService: ScheduleService) {}
|
constructor(private readonly scheduleService: ScheduleService) {}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { Collection, Entity, ManyToMany, Property } from '@mikro-orm/core';
|
import { Collection, Entity, ManyToMany, Property } from '@mikro-orm/core';
|
||||||
import { BaseEntity } from '../../../common/entities/base.entity';
|
import { BaseEntity } from '../../../common/entities/base.entity';
|
||||||
import { ShipmentMethod } from '../../shipments/entities/shipment-method.entity';
|
import { ShipmentMethod } from '../../shipments/entities/shipment-method.entity';
|
||||||
import { RestaurantShipmentMethod } from './restaurant-shipment-method.entity';
|
import { RestaurantShipmentMethod } from '../../shipments/entities/restaurant-shipment-method.entity';
|
||||||
|
|
||||||
@Entity({ tableName: 'restaurants' })
|
@Entity({ tableName: 'restaurants' })
|
||||||
export class Restaurant extends BaseEntity {
|
export class Restaurant extends BaseEntity {
|
||||||
|
|||||||
@@ -7,40 +7,16 @@ import { Restaurant } from './entities/restaurant.entity';
|
|||||||
import { RestRepository } from './repositories/rest.repository';
|
import { RestRepository } from './repositories/rest.repository';
|
||||||
import { ScheduleRepository } from './repositories/schedule.repository';
|
import { ScheduleRepository } from './repositories/schedule.repository';
|
||||||
import { Schedule } from './entities/schedule.entity';
|
import { Schedule } from './entities/schedule.entity';
|
||||||
import { ShipmentMethod } from '../shipments/entities/shipment-method.entity';
|
|
||||||
import { RestaurantShipmentMethod } from './entities/restaurant-shipment-method.entity';
|
|
||||||
import { ScheduleService } from './providers/schedule.service';
|
import { ScheduleService } from './providers/schedule.service';
|
||||||
import { ScheduleController } from './controllers/schedule.controller';
|
import { ScheduleController } from './controllers/schedule.controller';
|
||||||
import { PublicScheduleController } from './controllers/public-schedule.controller';
|
import { PublicScheduleController } from './controllers/public-schedule.controller';
|
||||||
import { RestaurantShipmentMethodController } from './controllers/restaurant-shipment-method.controller';
|
|
||||||
import { RestaurantShipmentMethodService } from './providers/restaurant-shipment-method.service';
|
|
||||||
import { RestaurantShipmentMethodRepository } from './repositories/restaurant-shipment-method.repository';
|
|
||||||
import { JwtModule } from '@nestjs/jwt';
|
import { JwtModule } from '@nestjs/jwt';
|
||||||
import { AuthModule } from '../auth/auth.module';
|
import { AuthModule } from '../auth/auth.module';
|
||||||
import { PublicRestaurantShipmentMethodController } from './controllers/public-restaurant-shipment-method.controller';
|
|
||||||
|
|
||||||
@Module({
|
@Module({
|
||||||
controllers: [
|
controllers: [RestaurantsController, PublicRestaurantController, ScheduleController, PublicScheduleController],
|
||||||
RestaurantsController,
|
providers: [RestaurantsService, RestRepository, ScheduleRepository, ScheduleService],
|
||||||
PublicRestaurantController,
|
imports: [MikroOrmModule.forFeature([Restaurant, Schedule]), JwtModule, forwardRef(() => AuthModule)],
|
||||||
ScheduleController,
|
|
||||||
PublicScheduleController,
|
|
||||||
RestaurantShipmentMethodController,
|
|
||||||
PublicRestaurantShipmentMethodController,
|
|
||||||
],
|
|
||||||
providers: [
|
|
||||||
RestaurantsService,
|
|
||||||
RestRepository,
|
|
||||||
ScheduleRepository,
|
|
||||||
ScheduleService,
|
|
||||||
RestaurantShipmentMethodService,
|
|
||||||
RestaurantShipmentMethodRepository,
|
|
||||||
],
|
|
||||||
imports: [
|
|
||||||
MikroOrmModule.forFeature([Restaurant, Schedule, ShipmentMethod, RestaurantShipmentMethod]),
|
|
||||||
JwtModule,
|
|
||||||
forwardRef(() => AuthModule),
|
|
||||||
],
|
|
||||||
exports: [RestRepository, ScheduleRepository, ScheduleService],
|
exports: [RestRepository, ScheduleRepository, ScheduleService],
|
||||||
})
|
})
|
||||||
export class RestaurantsModule {}
|
export class RestaurantsModule {}
|
||||||
|
|||||||
@@ -1,35 +0,0 @@
|
|||||||
import { Controller, Get, Param, UseGuards } from '@nestjs/common';
|
|
||||||
import { ApiTags, ApiOperation, ApiOkResponse, ApiNotFoundResponse, ApiParam, ApiBearerAuth } from '@nestjs/swagger';
|
|
||||||
import { AdminAuthGuard } from 'src/modules/auth/guards/adminAuth.guard';
|
|
||||||
import { ShipmentMethod } from '../../shipments/entities/shipment-method.entity';
|
|
||||||
import { ShipmentMethodsService } from '../providers/shipment-methods.service';
|
|
||||||
|
|
||||||
@UseGuards(AdminAuthGuard)
|
|
||||||
@ApiBearerAuth()
|
|
||||||
@ApiTags('admin/shipment-methods')
|
|
||||||
@Controller('admin/shipment-methods')
|
|
||||||
export class ShipmentMethodController {
|
|
||||||
constructor(private readonly shipmentMethodsService: ShipmentMethodsService) {}
|
|
||||||
|
|
||||||
@Get()
|
|
||||||
@ApiOperation({ summary: 'Get all shipment methods' })
|
|
||||||
@ApiOkResponse({
|
|
||||||
description: 'List of shipment methods',
|
|
||||||
type: [ShipmentMethod],
|
|
||||||
})
|
|
||||||
findAll() {
|
|
||||||
return this.shipmentMethodsService.findAll();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Get(':shipmentMethodId')
|
|
||||||
@ApiOperation({ summary: 'Get a shipment method by shipment method ID' })
|
|
||||||
@ApiParam({ name: 'shipmentMethodId', description: 'Shipment method ID' })
|
|
||||||
@ApiOkResponse({
|
|
||||||
description: 'shipment method details',
|
|
||||||
type: ShipmentMethod,
|
|
||||||
})
|
|
||||||
@ApiNotFoundResponse({ description: 'Shipment method not found' })
|
|
||||||
findOne(@Param('shipmentMethodId') shipmentMethodId: string) {
|
|
||||||
return this.shipmentMethodsService.findOne(shipmentMethodId);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
+51
-18
@@ -13,18 +13,43 @@ import { RestaurantShipmentMethodService } from '../providers/restaurant-shipmen
|
|||||||
import { CreateRestaurantShipmentMethodDto } from '../dto/create-restaurant-shipment-method.dto';
|
import { CreateRestaurantShipmentMethodDto } from '../dto/create-restaurant-shipment-method.dto';
|
||||||
import { UpdateRestaurantShipmentMethodDto } from '../dto/update-restaurant-shipment-method.dto';
|
import { UpdateRestaurantShipmentMethodDto } from '../dto/update-restaurant-shipment-method.dto';
|
||||||
import { RestaurantShipmentMethod } from '../entities/restaurant-shipment-method.entity';
|
import { RestaurantShipmentMethod } from '../entities/restaurant-shipment-method.entity';
|
||||||
import { AdminAuthGuard } from 'src/modules/auth/guards/adminAuth.guard';
|
|
||||||
import { RestId } from 'src/common/decorators/rest-id.decorator';
|
import { RestId } from 'src/common/decorators/rest-id.decorator';
|
||||||
|
import { AuthGuard } from 'src/modules/auth/guards/auth.guard';
|
||||||
|
import { AdminAuthGuard } from 'src/modules/auth/guards/adminAuth.guard';
|
||||||
|
import { ShipmentMethodsService } from '../providers/shipment-methods.service';
|
||||||
|
|
||||||
@UseGuards(AdminAuthGuard)
|
@ApiTags('Shipment')
|
||||||
@ApiBearerAuth()
|
@Controller()
|
||||||
@ApiTags('admin/restaurant-shipment-methods')
|
export class ShipmentController {
|
||||||
@Controller('admin/restaurant-shipment-methods')
|
constructor(
|
||||||
export class RestaurantShipmentMethodController {
|
private readonly restaurantShipmentMethodService: RestaurantShipmentMethodService,
|
||||||
constructor(private readonly restaurantShipmentMethodService: RestaurantShipmentMethodService) {}
|
private readonly shipmentMethodsService: ShipmentMethodsService,
|
||||||
|
) {}
|
||||||
|
@UseGuards(AuthGuard)
|
||||||
|
@ApiBearerAuth()
|
||||||
|
@Get('public/shipment-methods/restaurant')
|
||||||
|
@ApiOperation({ summary: 'Get restaurant shipment methods ' })
|
||||||
|
@ApiOkResponse({
|
||||||
|
description: 'List of restaurant shipment methods',
|
||||||
|
type: [RestaurantShipmentMethod],
|
||||||
|
})
|
||||||
|
findAllShipmentMethods(@RestId() restId: string) {
|
||||||
|
return this.restaurantShipmentMethodService.findAllForRestaurantId(restId);
|
||||||
|
}
|
||||||
|
|
||||||
@Post()
|
@Get('admin/shipment-methods')
|
||||||
@ApiOperation({ summary: 'Create a new restaurant shipment method' })
|
@ApiOperation({ summary: 'Get all shipment methods' })
|
||||||
|
@ApiOkResponse({
|
||||||
|
description: 'List of shipment methods',
|
||||||
|
})
|
||||||
|
findAll() {
|
||||||
|
return this.shipmentMethodsService.findAll();
|
||||||
|
}
|
||||||
|
|
||||||
|
@UseGuards(AdminAuthGuard)
|
||||||
|
@ApiBearerAuth()
|
||||||
|
@Post('admin/shipment-methods/restaurant')
|
||||||
|
@ApiOperation({ summary: 'Assign a shipment method to a restaurant' })
|
||||||
@ApiBody({ type: CreateRestaurantShipmentMethodDto })
|
@ApiBody({ type: CreateRestaurantShipmentMethodDto })
|
||||||
@ApiCreatedResponse({
|
@ApiCreatedResponse({
|
||||||
description: 'Restaurant shipment method created successfully',
|
description: 'Restaurant shipment method created successfully',
|
||||||
@@ -34,21 +59,25 @@ export class RestaurantShipmentMethodController {
|
|||||||
return this.restaurantShipmentMethodService.create(restId, createDto);
|
return this.restaurantShipmentMethodService.create(restId, createDto);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Get()
|
@UseGuards(AdminAuthGuard)
|
||||||
|
@ApiBearerAuth()
|
||||||
|
@Get('admin/shipment-methods/restaurant')
|
||||||
@ApiOperation({ summary: 'Get the restaurant shipment methods' })
|
@ApiOperation({ summary: 'Get the restaurant shipment methods' })
|
||||||
@ApiOkResponse({
|
@ApiOkResponse({
|
||||||
description: 'List of restaurant shipment methods',
|
description: 'List of restaurant shipment methods',
|
||||||
type: [RestaurantShipmentMethod],
|
type: [RestaurantShipmentMethod],
|
||||||
})
|
})
|
||||||
findAll(@RestId() restId: string) {
|
findRestaurantShipmentMethods(@RestId() restId: string) {
|
||||||
return this.restaurantShipmentMethodService.findAllForRestaurantId(restId);
|
return this.restaurantShipmentMethodService.findAllForRestaurantId(restId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Get(':RestaurantShipmentMethodId')
|
@UseGuards(AdminAuthGuard)
|
||||||
@ApiOperation({ summary: 'Get a restaurant shipment method by shipment method ID' })
|
@ApiBearerAuth()
|
||||||
@ApiParam({ name: 'RestaurantShipmentMethodId', description: 'RestaurantRestaurantShipmentMethodId method ID' })
|
@Get('admin/shipment-methods/restaurant/:RestaurantShipmentMethodId')
|
||||||
|
@ApiOperation({ summary: 'Get a restaurant shipment method by restaurant shipment method ID' })
|
||||||
|
@ApiParam({ name: 'RestaurantShipmentMethodId', description: 'Restaurant Shipment method ID' })
|
||||||
@ApiOkResponse({
|
@ApiOkResponse({
|
||||||
description: 'Restaurant shipment method details',
|
description: 'Restaurant Shipment method details',
|
||||||
type: RestaurantShipmentMethod,
|
type: RestaurantShipmentMethod,
|
||||||
})
|
})
|
||||||
@ApiNotFoundResponse({ description: 'Restaurant shipment method not found' })
|
@ApiNotFoundResponse({ description: 'Restaurant shipment method not found' })
|
||||||
@@ -56,9 +85,11 @@ export class RestaurantShipmentMethodController {
|
|||||||
return this.restaurantShipmentMethodService.findOne(restId, RestaurantShipmentMethodId);
|
return this.restaurantShipmentMethodService.findOne(restId, RestaurantShipmentMethodId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Patch(':RestaurantShipmentMethodId')
|
@UseGuards(AdminAuthGuard)
|
||||||
|
@ApiBearerAuth()
|
||||||
|
@Patch('admin/shipment-methods/restaurant/:RestaurantShipmentMethodId')
|
||||||
@ApiOperation({ summary: 'Update a restaurant shipment method' })
|
@ApiOperation({ summary: 'Update a restaurant shipment method' })
|
||||||
@ApiParam({ name: 'RestaurantShipmentMethodId', description: 'Shipment method ID' })
|
@ApiParam({ name: 'RestaurantShipmentMethodId', description: 'Restaurant Shipment method ID' })
|
||||||
@ApiBody({ type: UpdateRestaurantShipmentMethodDto })
|
@ApiBody({ type: UpdateRestaurantShipmentMethodDto })
|
||||||
@ApiOkResponse({
|
@ApiOkResponse({
|
||||||
description: 'Restaurant shipment method updated successfully',
|
description: 'Restaurant shipment method updated successfully',
|
||||||
@@ -73,7 +104,9 @@ export class RestaurantShipmentMethodController {
|
|||||||
return this.restaurantShipmentMethodService.update(restId, RestaurantShipmentMethodId, updateDto);
|
return this.restaurantShipmentMethodService.update(restId, RestaurantShipmentMethodId, updateDto);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Delete(':RestaurantShipmentMethodId')
|
@UseGuards(AdminAuthGuard)
|
||||||
|
@ApiBearerAuth()
|
||||||
|
@Delete('admin/shipment-methods/restaurant/:RestaurantShipmentMethodId')
|
||||||
@ApiOperation({ summary: 'Delete a restaurant shipment method' })
|
@ApiOperation({ summary: 'Delete a restaurant shipment method' })
|
||||||
@ApiParam({ name: 'RestaurantShipmentMethodId', description: 'Shipment method ID' })
|
@ApiParam({ name: 'RestaurantShipmentMethodId', description: 'Shipment method ID' })
|
||||||
@ApiOkResponse({ description: 'Restaurant shipment method deleted successfully' })
|
@ApiOkResponse({ description: 'Restaurant shipment method deleted successfully' })
|
||||||
+2
-2
@@ -1,6 +1,6 @@
|
|||||||
import { Entity, ManyToOne, Property, Unique } from '@mikro-orm/core';
|
import { Entity, ManyToOne, Property, Unique } from '@mikro-orm/core';
|
||||||
import { Restaurant } from './restaurant.entity';
|
import { Restaurant } from '../../restaurants/entities/restaurant.entity';
|
||||||
import { ShipmentMethod } from '../../shipments/entities/shipment-method.entity';
|
import { ShipmentMethod } from './shipment-method.entity';
|
||||||
import { BaseEntity } from 'src/common/entities/base.entity';
|
import { BaseEntity } from 'src/common/entities/base.entity';
|
||||||
|
|
||||||
@Entity({ tableName: 'restaurant_shipment_methods' })
|
@Entity({ tableName: 'restaurant_shipment_methods' })
|
||||||
+2
-2
@@ -4,8 +4,8 @@ import { RestaurantShipmentMethod } from '../entities/restaurant-shipment-method
|
|||||||
import { RestaurantShipmentMethodRepository } from '../repositories/restaurant-shipment-method.repository';
|
import { RestaurantShipmentMethodRepository } from '../repositories/restaurant-shipment-method.repository';
|
||||||
import { CreateRestaurantShipmentMethodDto } from '../dto/create-restaurant-shipment-method.dto';
|
import { CreateRestaurantShipmentMethodDto } from '../dto/create-restaurant-shipment-method.dto';
|
||||||
import { UpdateRestaurantShipmentMethodDto } from '../dto/update-restaurant-shipment-method.dto';
|
import { UpdateRestaurantShipmentMethodDto } from '../dto/update-restaurant-shipment-method.dto';
|
||||||
import { RestRepository } from '../repositories/rest.repository';
|
import { RestRepository } from '../../restaurants/repositories/rest.repository';
|
||||||
import { ShipmentMethod } from '../../shipments/entities/shipment-method.entity';
|
import { ShipmentMethod } from '../entities/shipment-method.entity';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class RestaurantShipmentMethodService {
|
export class RestaurantShipmentMethodService {
|
||||||
@@ -1,15 +1,23 @@
|
|||||||
import { Module } from '@nestjs/common';
|
import { Module } from '@nestjs/common';
|
||||||
import { ShipmentMethodController } from './controllers/shipment-method.controller';
|
|
||||||
import { ShipmentMethodsService } from './providers/shipment-methods.service';
|
import { ShipmentMethodsService } from './providers/shipment-methods.service';
|
||||||
import { ShipmentMethodRepository } from './repositories/shipment-method.repository';
|
import { ShipmentMethodRepository } from './repositories/shipment-method.repository';
|
||||||
import { ShipmentMethod } from './entities/shipment-method.entity';
|
import { ShipmentMethod } from './entities/shipment-method.entity';
|
||||||
import { MikroOrmModule } from '@mikro-orm/nestjs';
|
import { MikroOrmModule } from '@mikro-orm/nestjs';
|
||||||
import { JwtModule } from '@nestjs/jwt';
|
import { JwtModule } from '@nestjs/jwt';
|
||||||
|
import { ShipmentController } from './controllers/shipment.controller';
|
||||||
|
import { RestaurantShipmentMethodService } from './providers/restaurant-shipment-method.service';
|
||||||
|
import { RestaurantsModule } from '../restaurants/restaurants.module';
|
||||||
|
import { RestaurantShipmentMethodRepository } from './repositories/restaurant-shipment-method.repository';
|
||||||
|
|
||||||
@Module({
|
@Module({
|
||||||
controllers: [ShipmentMethodController],
|
controllers: [ShipmentController],
|
||||||
providers: [ShipmentMethodsService, ShipmentMethodRepository],
|
providers: [
|
||||||
exports: [ShipmentMethodsService, ShipmentMethodRepository],
|
ShipmentMethodsService,
|
||||||
imports: [MikroOrmModule.forFeature([ShipmentMethod]), JwtModule],
|
ShipmentMethodRepository,
|
||||||
|
RestaurantShipmentMethodRepository,
|
||||||
|
RestaurantShipmentMethodService,
|
||||||
|
],
|
||||||
|
exports: [ShipmentMethodsService, ShipmentMethodRepository, RestaurantShipmentMethodService],
|
||||||
|
imports: [MikroOrmModule.forFeature([ShipmentMethod]), JwtModule, RestaurantsModule],
|
||||||
})
|
})
|
||||||
export class ShipmentsModule {}
|
export class ShipmentsModule {}
|
||||||
|
|||||||
Reference in New Issue
Block a user