shipment methods
This commit is contained in:
@@ -19,6 +19,7 @@ import { FoodModule } from './modules/foods/food.module';
|
|||||||
import { CartModule } from './modules/cart/cart.module';
|
import { CartModule } from './modules/cart/cart.module';
|
||||||
import { RolesModule } from './modules/roles/roles.module';
|
import { RolesModule } from './modules/roles/roles.module';
|
||||||
import { PaymentsModule } from './modules/payments/payments.module';
|
import { PaymentsModule } from './modules/payments/payments.module';
|
||||||
|
import { ShipmentsModule } from './modules/shipments/shipments.module';
|
||||||
|
|
||||||
@Module({
|
@Module({
|
||||||
imports: [
|
imports: [
|
||||||
@@ -51,6 +52,7 @@ import { PaymentsModule } from './modules/payments/payments.module';
|
|||||||
CartModule,
|
CartModule,
|
||||||
RolesModule,
|
RolesModule,
|
||||||
PaymentsModule,
|
PaymentsModule,
|
||||||
|
ShipmentsModule,
|
||||||
],
|
],
|
||||||
controllers: [],
|
controllers: [],
|
||||||
providers: [],
|
providers: [],
|
||||||
|
|||||||
+1
-10
@@ -1,14 +1,5 @@
|
|||||||
import { Controller, Get, UseGuards } from '@nestjs/common';
|
import { Controller, Get, UseGuards } from '@nestjs/common';
|
||||||
import {
|
import { ApiTags, ApiOperation, ApiOkResponse, ApiBearerAuth } from '@nestjs/swagger';
|
||||||
ApiTags,
|
|
||||||
ApiOperation,
|
|
||||||
ApiCreatedResponse,
|
|
||||||
ApiOkResponse,
|
|
||||||
ApiNotFoundResponse,
|
|
||||||
ApiParam,
|
|
||||||
ApiBody,
|
|
||||||
ApiBearerAuth,
|
|
||||||
} from '@nestjs/swagger';
|
|
||||||
import { RestaurantShipmentMethodService } from '../providers/restaurant-shipment-method.service';
|
import { RestaurantShipmentMethodService } from '../providers/restaurant-shipment-method.service';
|
||||||
import { RestaurantShipmentMethod } from '../entities/restaurant-shipment-method.entity';
|
import { RestaurantShipmentMethod } from '../entities/restaurant-shipment-method.entity';
|
||||||
import { RestId } from 'src/common/decorators/rest-id.decorator';
|
import { RestId } from 'src/common/decorators/rest-id.decorator';
|
||||||
|
|||||||
@@ -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 './restaurant.entity';
|
||||||
import { ShipmentMethod } from './shipment-method.entity';
|
import { ShipmentMethod } from '../../shipments/entities/shipment-method.entity';
|
||||||
|
|
||||||
@Entity({ tableName: 'restaurant_shipment_methods' })
|
@Entity({ tableName: 'restaurant_shipment_methods' })
|
||||||
@Unique({ properties: ['restaurant', 'shipmentMethod'] })
|
@Unique({ properties: ['restaurant', 'shipmentMethod'] })
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
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 './shipment-method.entity';
|
import { ShipmentMethod } from '../../shipments/entities/shipment-method.entity';
|
||||||
import { RestaurantShipmentMethod } from './restaurant-shipment-method.entity';
|
import { RestaurantShipmentMethod } from './restaurant-shipment-method.entity';
|
||||||
|
|
||||||
@Entity({ tableName: 'restaurants' })
|
@Entity({ tableName: 'restaurants' })
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import { RestaurantShipmentMethodRepository } from '../repositories/restaurant-s
|
|||||||
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 '../repositories/rest.repository';
|
||||||
import { ShipmentMethod } from '../entities/shipment-method.entity';
|
import { ShipmentMethod } from '../../shipments/entities/shipment-method.entity';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class RestaurantShipmentMethodService {
|
export class RestaurantShipmentMethodService {
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ 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 './entities/shipment-method.entity';
|
import { ShipmentMethod } from '../shipments/entities/shipment-method.entity';
|
||||||
import { RestaurantShipmentMethod } from './entities/restaurant-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';
|
||||||
@@ -18,9 +18,7 @@ import { RestaurantShipmentMethodRepository } from './repositories/restaurant-sh
|
|||||||
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';
|
import { PublicRestaurantShipmentMethodController } from './controllers/public-restaurant-shipment-method.controller';
|
||||||
import { ShipmentMethodController } from './controllers/shipment-method.controller';
|
|
||||||
import { ShipmentMethodsService } from './providers/shipment-methods.service';
|
|
||||||
import { ShipmentMethodRepository } from './repositories/shipment-method.repository';
|
|
||||||
@Module({
|
@Module({
|
||||||
controllers: [
|
controllers: [
|
||||||
RestaurantsController,
|
RestaurantsController,
|
||||||
@@ -29,7 +27,6 @@ import { ShipmentMethodRepository } from './repositories/shipment-method.reposit
|
|||||||
PublicScheduleController,
|
PublicScheduleController,
|
||||||
RestaurantShipmentMethodController,
|
RestaurantShipmentMethodController,
|
||||||
PublicRestaurantShipmentMethodController,
|
PublicRestaurantShipmentMethodController,
|
||||||
ShipmentMethodController,
|
|
||||||
],
|
],
|
||||||
providers: [
|
providers: [
|
||||||
RestaurantsService,
|
RestaurantsService,
|
||||||
@@ -38,14 +35,12 @@ import { ShipmentMethodRepository } from './repositories/shipment-method.reposit
|
|||||||
ScheduleService,
|
ScheduleService,
|
||||||
RestaurantShipmentMethodService,
|
RestaurantShipmentMethodService,
|
||||||
RestaurantShipmentMethodRepository,
|
RestaurantShipmentMethodRepository,
|
||||||
ShipmentMethodsService,
|
|
||||||
ShipmentMethodRepository,
|
|
||||||
],
|
],
|
||||||
imports: [
|
imports: [
|
||||||
MikroOrmModule.forFeature([Restaurant, Schedule, ShipmentMethod, RestaurantShipmentMethod]),
|
MikroOrmModule.forFeature([Restaurant, Schedule, ShipmentMethod, RestaurantShipmentMethod]),
|
||||||
JwtModule,
|
JwtModule,
|
||||||
forwardRef(() => AuthModule),
|
forwardRef(() => AuthModule),
|
||||||
],
|
],
|
||||||
exports: [RestRepository, ScheduleRepository, ScheduleService, ShipmentMethodsService],
|
exports: [RestRepository, ScheduleRepository, ScheduleService],
|
||||||
})
|
})
|
||||||
export class RestaurantsModule {}
|
export class RestaurantsModule {}
|
||||||
|
|||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
import { Controller, Get, Param, UseGuards } from '@nestjs/common';
|
import { Controller, Get, Param, UseGuards } from '@nestjs/common';
|
||||||
import { ApiTags, ApiOperation, ApiOkResponse, ApiNotFoundResponse, ApiParam, ApiBearerAuth } from '@nestjs/swagger';
|
import { ApiTags, ApiOperation, ApiOkResponse, ApiNotFoundResponse, ApiParam, ApiBearerAuth } from '@nestjs/swagger';
|
||||||
import { AdminAuthGuard } from 'src/modules/auth/guards/adminAuth.guard';
|
import { AdminAuthGuard } from 'src/modules/auth/guards/adminAuth.guard';
|
||||||
import { ShipmentMethod } from '../entities/shipment-method.entity';
|
import { ShipmentMethod } from '../../shipments/entities/shipment-method.entity';
|
||||||
import { ShipmentMethodsService } from '../providers/shipment-methods.service';
|
import { ShipmentMethodsService } from '../providers/shipment-methods.service';
|
||||||
|
|
||||||
@UseGuards(AdminAuthGuard)
|
@UseGuards(AdminAuthGuard)
|
||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
import { Entity, Property, Unique, ManyToMany, Collection } from '@mikro-orm/core';
|
import { Entity, Property, Unique, ManyToMany, Collection } from '@mikro-orm/core';
|
||||||
import { BaseEntity } from '../../../common/entities/base.entity';
|
import { BaseEntity } from '../../../common/entities/base.entity';
|
||||||
import { Restaurant } from './restaurant.entity';
|
import { Restaurant } from '../../restaurants/entities/restaurant.entity';
|
||||||
|
|
||||||
@Entity({ tableName: 'shipment_methods' })
|
@Entity({ tableName: 'shipment_methods' })
|
||||||
export class ShipmentMethod extends BaseEntity {
|
export class ShipmentMethod extends BaseEntity {
|
||||||
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
import { EntityManager, EntityRepository } from '@mikro-orm/postgresql';
|
import { EntityManager, EntityRepository } from '@mikro-orm/postgresql';
|
||||||
import { Injectable } from '@nestjs/common';
|
import { Injectable } from '@nestjs/common';
|
||||||
import { ShipmentMethod } from '../entities/shipment-method.entity';
|
import { ShipmentMethod } from '../entities/shipment-method.entity';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
import { Module } from '@nestjs/common';
|
||||||
|
import { ShipmentMethodController } from './controllers/shipment-method.controller';
|
||||||
|
import { ShipmentMethodsService } from './providers/shipment-methods.service';
|
||||||
|
import { ShipmentMethodRepository } from './repositories/shipment-method.repository';
|
||||||
|
import { ShipmentMethod } from './entities/shipment-method.entity';
|
||||||
|
import { MikroOrmModule } from '@mikro-orm/nestjs';
|
||||||
|
import { JwtModule } from '@nestjs/jwt';
|
||||||
|
|
||||||
|
@Module({
|
||||||
|
controllers: [ShipmentMethodController],
|
||||||
|
providers: [ShipmentMethodsService, ShipmentMethodRepository],
|
||||||
|
exports: [ShipmentMethodsService, ShipmentMethodRepository],
|
||||||
|
imports: [MikroOrmModule.forFeature([ShipmentMethod]), JwtModule],
|
||||||
|
})
|
||||||
|
export class ShipmentsModule {}
|
||||||
@@ -11,7 +11,7 @@ import { User } from '../modules/users/entities/user.entity';
|
|||||||
import { Permission, PermissionTitles } from '../common/enums/permission.enum';
|
import { Permission, PermissionTitles } from '../common/enums/permission.enum';
|
||||||
import { PaymentMethod } from '../modules/payments/entities/payment-method.entity';
|
import { PaymentMethod } from '../modules/payments/entities/payment-method.entity';
|
||||||
import { RestaurantPaymentMethod } from '../modules/payments/entities/restaurant-payment-method.entity';
|
import { RestaurantPaymentMethod } from '../modules/payments/entities/restaurant-payment-method.entity';
|
||||||
import { ShipmentMethod } from '../modules/restaurants/entities/shipment-method.entity';
|
import { ShipmentMethod } from '../modules/shipments/entities/shipment-method.entity';
|
||||||
|
|
||||||
export class DatabaseSeeder extends Seeder {
|
export class DatabaseSeeder extends Seeder {
|
||||||
async run(em: EntityManager) {
|
async run(em: EntityManager) {
|
||||||
|
|||||||
Reference in New Issue
Block a user