Skip to content

Commit

Permalink
fix: fix mapping problem with incorrect import
Browse files Browse the repository at this point in the history
  • Loading branch information
meysamhadeli committed Dec 19, 2023
1 parent b5e9e60 commit fcf8b82
Show file tree
Hide file tree
Showing 22 changed files with 25 additions and 30 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import Joi from 'joi';
import {IAircraftRepository} from '../../../../data/repositories/aircraftRepository';
import mapper from '../../../mappings';
import {ApiBearerAuth, ApiProperty, ApiResponse, ApiTags} from "@nestjs/swagger";
import {Body, ConflictException, Controller, HttpStatus, Inject, Post, Res, UseGuards} from "@nestjs/common";
import {AircraftDto} from "../../../dtos/aircraft.dto";
Expand All @@ -10,6 +9,7 @@ import {Aircraft} from "../../../entities/aircraft.entity";
import {JwtGuard} from "building-blocks/passport/jwt.guard";
import {IRabbitmqPublisher} from "building-blocks/rabbitmq/rabbitmq-publisher";
import {AircraftCreated} from "building-blocks/contracts/flight.contract";
import mapper from "../../../mappings";

export class CreateAircraft {
model: string;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import Joi from 'joi';
import {IAirportRepository} from '../../../../data/repositories/airportRepository';
import mapper from '../../../../aircraft/mappings';
import {ApiBearerAuth, ApiProperty, ApiResponse, ApiTags} from "@nestjs/swagger";
import {Body, ConflictException, Controller, HttpStatus, Inject, Post, Res, UseGuards} from "@nestjs/common";
import {CommandBus, CommandHandler, ICommandHandler} from "@nestjs/cqrs";
Expand All @@ -10,6 +9,7 @@ import {Airport} from "../../../entities/airport.entity";
import {JwtGuard} from "building-blocks/passport/jwt.guard";
import {IRabbitmqPublisher} from "building-blocks/rabbitmq/rabbitmq-publisher";
import {AirportCreated} from "building-blocks/contracts/flight.contract";
import mapper from "../../../mappings";

export class CreateAirport {
code: string;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import Joi from 'joi';
import mapper from '../../../../aircraft/mappings';
import {FlightDto} from '../../../dtos/flight.dto';
import {IFlightRepository} from '../../../../data/repositories/flightRepository';
import {ApiBearerAuth, ApiProperty, ApiResponse, ApiTags} from "@nestjs/swagger";
Expand All @@ -11,6 +10,7 @@ import {Flight} from "../../../entities/flight.entity";
import {JwtGuard} from "building-blocks/passport/jwt.guard";
import {IRabbitmqPublisher} from "building-blocks/rabbitmq/rabbitmq-publisher";
import {FlightCreated} from "building-blocks/contracts/flight.contract";
import mapper from "../../../mappings";

export class CreateFlight {
flightNumber: string;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import Joi from 'joi';
import {FlightDto} from '../../../dtos/flight.dto';
import {IFlightRepository} from '../../../../data/repositories/flightRepository';
import mapper from '../../../mappings';
import {ApiBearerAuth, ApiResponse, ApiTags} from "@nestjs/swagger";
import {Controller, Get, Inject, NotFoundException, Query, UseGuards} from "@nestjs/common";
import {IQueryHandler, QueryBus, QueryHandler} from "@nestjs/cqrs";
import {Flight} from "../../../entities/flight.entity";
import {JwtGuard} from "building-blocks/passport/jwt.guard";
import {IRabbitmqPublisher} from "building-blocks/rabbitmq/rabbitmq-publisher";
import mapper from "../../../mappings";

export class GetFlightById {
id: number;
Expand Down
2 changes: 1 addition & 1 deletion src/flight/src/seat/features/v1/create-seat/create-seat.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import Joi from 'joi';
import mapper from '../../../../aircraft/mappings';
import {ISeatRepository} from '../../../../data/repositories/seatRepository';
import {IFlightRepository} from '../../../../data/repositories/flightRepository';
import {ApiBearerAuth, ApiProperty, ApiResponse, ApiTags} from "@nestjs/swagger";
Expand All @@ -13,6 +12,7 @@ import {Seat} from "../../../entities/seat.entity";
import {JwtGuard} from "building-blocks/passport/jwt.guard";
import {IRabbitmqPublisher} from "building-blocks/rabbitmq/rabbitmq-publisher";
import {SeatCreated} from "building-blocks/contracts/flight.contract";
import mapper from "../../../mappings";

export class CreateSeat {
seatNumber: string;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import Joi from 'joi';
import mapper from '../../../mappings';
import { ISeatRepository } from '../../../../data/repositories/seatRepository';
import {ApiBearerAuth, ApiResponse, ApiTags} from "@nestjs/swagger";
import {Controller, Get, Inject, Post, Query, UseGuards} from "@nestjs/common";
Expand All @@ -8,6 +7,7 @@ import {SeatDto} from "../../../dtos/seat.dto";
import {Seat} from "../../../entities/seat.entity";
import {JwtGuard} from "building-blocks/passport/jwt.guard";
import {IRabbitmqPublisher} from "building-blocks/rabbitmq/rabbitmq-publisher";
import mapper from "../../../mappings";

export class GetAvailableSeats {
flightId: number;
Expand Down
2 changes: 0 additions & 2 deletions src/flight/src/seat/features/v1/reserve-seat/reserve-seat.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
import Joi from 'joi';
import mapper from '../../../../aircraft/mappings';
import {ISeatRepository} from '../../../../data/repositories/seatRepository';
import {IFlightRepository} from '../../../../data/repositories/flightRepository';
import {ApiBearerAuth, ApiProperty, ApiResponse, ApiTags} from "@nestjs/swagger";
import {Body, Controller, HttpStatus, Inject, NotFoundException, Post, Res, UseGuards} from "@nestjs/common";
import {Response} from "express";
import {CommandBus, CommandHandler, ICommandHandler} from "@nestjs/cqrs";
import {SeatDto} from "../../../dtos/seat.dto";
import {Seat} from "../../../entities/seat.entity";
import {JwtGuard} from "building-blocks/passport/jwt.guard";
import {IRabbitmqPublisher} from "building-blocks/rabbitmq/rabbitmq-publisher";
Expand Down
6 changes: 3 additions & 3 deletions src/identity/src/auth/auth.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import {Token} from "../auth/entities/token.entity";
import {AuthRepository} from "../data/repositories/auth.repository";
import {LoginController, LoginHandler} from "./features/v1/login/login";
import {LogoutController, LogoutHandler} from "./features/v1/logout/logout";
import {RefreshTokenController, RefreshTokenHandler} from "./features/v1/refreshToken/refresh-token";
import {GenerateTokenHandler} from "./features/v1/generateToken/generate-token";
import {ValidateTokenHandler} from "./features/v1/validateToken/validate-token";
import {RefreshTokenController, RefreshTokenHandler} from "./features/v1/refresh-token/refresh-token";
import {GenerateTokenHandler} from "./features/v1/generate-token/generate-token";
import {ValidateTokenHandler} from "./features/v1/validate-token/validate-token";
import {User} from "../user/entities/user.entity";
import {UserRepository} from "../data/repositories/user.repository";
import {RabbitmqModule} from "building-blocks/rabbitmq/rabbitmq.module";
Expand Down
2 changes: 1 addition & 1 deletion src/identity/src/auth/features/v1/login/login.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Joi from 'joi';
import {GenerateToken} from '../generateToken/generate-token';
import {GenerateToken} from '../generate-token/generate-token';
import {ApiBearerAuth, ApiProperty, ApiResponse, ApiTags} from "@nestjs/swagger";
import {Body, Controller, Get, HttpStatus, Inject, Post, UseGuards} from "@nestjs/common";
import {AuthDto} from "../../../dtos/auth.dto";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import Joi from 'joi';
import {GenerateToken} from '../generateToken/generate-token';
import {GenerateToken} from '../generate-token/generate-token';
import {ApiBearerAuth, ApiResponse, ApiTags} from "@nestjs/swagger";
import {Body, Controller, Inject, Post, Query, UnauthorizedException} from "@nestjs/common";
import {CommandBus, CommandHandler, ICommandHandler} from "@nestjs/cqrs";
import {AuthDto} from "../../../dtos/auth.dto";
import {IAuthRepository} from "../../../../data/repositories/auth.repository";
import {IUserRepository} from "../../../../data/repositories/user.repository";
import {TokenType} from "../../../enums/token-type.enum";
import {ValidateToken} from "../validateToken/validate-token";
import {ValidateToken} from "../validate-token/validate-token";

export class RefreshToken {
refreshToken: string;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import {UserDto} from '../../../dtos/user.dto';
import mapper from '../../../mapping';
import {Role} from "../../../enums/role.enum";
import {ApiBearerAuth, ApiProperty, ApiResponse, ApiTags} from "@nestjs/swagger";
import {Body, ConflictException, Controller, HttpStatus, Inject, Post, Res, UseGuards} from "@nestjs/common";
Expand All @@ -13,6 +12,7 @@ import {IRabbitmqPublisher} from "building-blocks/rabbitmq/rabbitmq-publisher";
import {password} from "building-blocks/utils/validation";
import {UserCreated} from "building-blocks/contracts/identity.contract";
import {encryptPassword} from "building-blocks/utils/encryption";
import mapper from "../../../mapping";

export class CreateUser {
email: string;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import {UserDto} from '../../../dtos/user.dto';
import Joi from 'joi';
import mapper from '../../../mapping';
import {ApiBearerAuth, ApiResponse, ApiTags} from "@nestjs/swagger";
import {CommandBus, CommandHandler, ICommandHandler} from "@nestjs/cqrs";
import {Controller, Delete, HttpStatus, Inject, NotFoundException, Query, Res, UseGuards} from "@nestjs/common";
Expand All @@ -10,6 +9,7 @@ import {User} from "../../../entities/user.entity";
import {JwtGuard} from "building-blocks/passport/jwt.guard";
import {IRabbitmqPublisher} from "building-blocks/rabbitmq/rabbitmq-publisher";
import {UserDeleted} from "building-blocks/contracts/identity.contract";
import mapper from "../../../mapping";

export class DeleteUserById {
id: number;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import {UserDto} from '../../../dtos/user.dto';
import Joi from 'joi';
import mapper from '../../../mapping';
import {ApiBearerAuth, ApiResponse, ApiTags} from "@nestjs/swagger";
import {Controller, Get, Inject, NotFoundException, Param, Query, UseGuards} from "@nestjs/common";
import {IQueryHandler, QueryBus, QueryHandler} from "@nestjs/cqrs";
import {IUserRepository} from "../../../../data/repositories/user.repository";
import {User} from "../../../entities/user.entity";
import {JwtGuard} from "../../../../../../building-blocks/passport/jwt.guard";
import mapper from "../../../mapping";

export class GetUserById {
id: number;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import {UserDto} from '../../../dtos/user.dto';
import Joi from 'joi';
import mapper from '../../../mapping';
import {ApiBearerAuth, ApiQuery, ApiResponse, ApiTags} from "@nestjs/swagger";
import {Controller, Get, Inject, ParseBoolPipe, Query, UseGuards} from "@nestjs/common";
import {IQueryHandler, QueryBus, QueryHandler} from "@nestjs/cqrs";
import {IUserRepository} from "../../../../data/repositories/user.repository";
import {User} from "../../../entities/user.entity";
import {JwtGuard} from "../../../../../../building-blocks/passport/jwt.guard";
import {PagedResult} from "building-blocks/types/pagination/paged-result";
import mapper from "../../../mapping";

export class GetUsers {
page = 1;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import {UserDto} from '../../../dtos/user.dto';
import mapper from '../../../mapping';
import Joi from 'joi';
import {Role} from "../../../enums/role.enum";
import {ApiBearerAuth, ApiProperty, ApiResponse, ApiTags} from "@nestjs/swagger";
Expand All @@ -11,7 +9,6 @@ import {
NotFoundException,
Param,
Put,
Query,
Res,
UseGuards
} from "@nestjs/common";
Expand Down
10 changes: 5 additions & 5 deletions src/identity/src/user/user.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ import {Module} from '@nestjs/common';
import {CqrsModule} from '@nestjs/cqrs';
import {TypeOrmModule} from '@nestjs/typeorm';
import {User} from "../user/entities/user.entity";
import {CreateUserController, CreateUserHandler} from "./features/v1/createUser/create-user";
import {CreateUserController, CreateUserHandler} from "./features/v1/create-user/create-user";
import {UserRepository} from "../data/repositories/user.repository";
import {
DeleteUserByIdController,
DeleteUserByIdHandler
} from "./features/v1/deleteUserById/delete-user-by-id";
import {UpdateUserController, UpdateUserHandler} from "./features/v1/updateUser/update-user";
import {GetUsersController, GetUsersHandler} from "./features/v1/getUsers/get-users";
import {GetUserByIdController, GetUserByIdHandler} from "./features/v1/getUserById/get-user-by-id";
} from "./features/v1/delete-user-by-id/delete-user-by-id";
import {UpdateUserController, UpdateUserHandler} from "./features/v1/update-user/update-user";
import {GetUsersController, GetUsersHandler} from "./features/v1/get-users/get-users";
import {GetUserByIdController, GetUserByIdHandler} from "./features/v1/get-user-by-id/get-user-by-id";
import {Token} from "../auth/entities/token.entity";
import {AuthRepository} from "../data/repositories/auth.repository";
import {RabbitmqModule} from "building-blocks/rabbitmq/rabbitmq.module";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { faker } from '@faker-js/faker';
import {Role} from "../../../../src/user/enums/role.enum";
import {CreateUserRequestDto} from "../../../../src/user/features/v1/createUser/create-user";
import {CreateUserRequestDto} from "../../../../src/user/features/v1/create-user/create-user";

export class FakeCreateUserRequestDto {
static generate(): CreateUserRequestDto {
Expand Down
2 changes: 1 addition & 1 deletion src/identity/test/shared/fakes/user/fake-create-user.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { faker } from '@faker-js/faker';
import {User} from "../../../../src/user/entities/user.entity";
import {Role} from "../../../../src/user/enums/role.enum";
import {CreateUser} from "../../../../src/user/features/v1/createUser/create-user";
import {CreateUser} from "../../../../src/user/features/v1/create-user/create-user";

export class FakeCreateUser {
static generate(user?: User): CreateUser {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {IUserRepository} from "../../../../src/data/repositories/user.repository
import {UserDto} from "../../../../src/user/dtos/user.dto";
import {FakeCreateUser} from "../../../shared/fakes/user/fake-create-user";
import {IRabbitmqPublisher} from "building-blocks/rabbitmq/rabbitmq-publisher";
import {CreateUserHandler} from "../../../../src/user/features/v1/createUser/create-user";
import {CreateUserHandler} from "../../../../src/user/features/v1/create-user/create-user";

describe('unit test for create user', () => {
let createUserHandler: CreateUserHandler;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import {JwtGuard} from "building-blocks/passport/jwt.guard";
import {PassengerDto} from "../../../dtos/passenger.dto";
import {IPassengerRepository} from "../../../../data/repositories/passenger.repository";
import {PagedResult} from "building-blocks/types/pagination/paged-result";
import mapper from "../../../mappings";
import {Passenger} from "../../../entities/passenger.entity";
import mapper from "../../../mappings";

export class GetPassengers {
page = 1;
Expand Down

0 comments on commit fcf8b82

Please sign in to comment.