Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: update all packages #10

Merged
merged 3 commits into from
Dec 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ jobs:
ci:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: '20.x'
node-version: '22.x'

- name: build building-blocks
run: |
Expand Down
2 changes: 1 addition & 1 deletion deployments/docker-compose/infrastructure.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ services:
# Rabbitmq
#######################################################
rabbitmq:
image: rabbitmq:3-management
image: rabbitmq:management
container_name: rabbitmq
restart: unless-stopped
ports:
Expand Down
25 changes: 0 additions & 25 deletions src/booking/.eslintrc.js

This file was deleted.

3 changes: 3 additions & 0 deletions src/booking/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules/
dist/
build/
10 changes: 6 additions & 4 deletions src/booking/.prettierrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{
"singleQuote": true,
"trailingComma": "all",
"tabWidth": 4
}
"semi": true,
"tabWidth": 2,
"printWidth": 100,
"singleQuote": true,
"trailingComma": "none"
}
12 changes: 12 additions & 0 deletions src/booking/eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// https://denar90.github.io/eslint.github.io/docs/rules/
export default [
{
rules: {
semi: 'error',
'prefer-const': 'warn',
'no-unused-vars': 'warn',
'no-debugger': 'warn',
'no-console': 'warn'
}
}
];
5 changes: 3 additions & 2 deletions src/booking/nest-cli.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"collection": "@nestjs/schematics",
"sourceRoot": "src",
"sourceRoot": "booking/src",
"entryFile": "main",
"compilerOptions": {
"plugins": ["@nestjs/swagger/plugin"]
}
}
}
64 changes: 33 additions & 31 deletions src/booking/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,54 +3,56 @@
"description": "booking service",
"version": "1.0.0",
"main": "src/main.ts",
"author": "Meysam Hadeli",
"author": "Meysam",
"license": "MIT",
"scripts": {
"build": "nest build",
"dev": "tsc -p tsconfig.json && nodemon src/main.ts --watch",
"format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
"lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
"dev": "nest start --watch",
"format": "prettier --write \"**/*.{ts,js}\"",
"lint": "eslint . --fix",
"typeorm": "npm run build && npx typeorm -d ./dist/data/data-source.js",
"migration:generate": "npm run typeorm -- migration:generate",
"migration:run": "npm run typeorm -- migration:run",
"migration:revert": "npm run typeorm -- migration:revert",
"test": "jest"
},
"dependencies": {
"@nestjs/cli": "10.2.1",
"@nestjs/config": "^3.1.1",
"@nestjs/core": "10.2.10",
"@nestjs/cqrs": "^10.2.6",
"@nestjs/cli": "10.4.9",
"@nestjs/config": "^3.3.0",
"@nestjs/core": "10.4.15",
"@nestjs/cqrs": "^10.2.8",
"@nestjs/jwt": "^10.2.0",
"@nestjs/mapped-types": "2.0.4",
"@nestjs/microservices": "^10.2.10",
"@nestjs/passport": "^10.0.2",
"@nestjs/platform-express": "^10.2.10",
"@nestjs/schematics": "10.0.3",
"@nestjs/swagger": "^7.1.16",
"@nestjs/terminus": "^10.1.1",
"@nestjs/testing": "10.2.10",
"@nestjs/typeorm": "^10.0.1",
"axios": "^1.6.2",
"@nestjs/mapped-types": "2.0.6",
"@nestjs/microservices": "^10.4.15",
"@nestjs/passport": "^10.0.3",
"@nestjs/platform-express": "^10.4.15",
"@nestjs/schematics": "10.2.3",
"@nestjs/swagger": "^8.1.0",
"@nestjs/terminus": "^10.2.3",
"@nestjs/testing": "10.4.15",
"@nestjs/typeorm": "^10.0.2",
"axios": "^1.7.9",
"building-blocks": "file:../building-blocks",
"class-transformer": "^0.5.1",
"class-validator": "^0.14.0",
"joi": "^17.10.1",
"moment": "^2.29.4",
"nodemon": "^3.0.2",
"pg": "^8.11.3",
"testcontainers": "^10.3.2",
"class-validator": "^0.14.1",
"joi": "^17.13.3",
"moment": "^2.30.1",
"nodemon": "^3.1.9",
"pg": "^8.13.1",
"testcontainers": "^10.16.0",
"ts-mapper": "^1.2.4"
},
"devDependencies": {
"@faker-js/faker": "^8.3.1",
"@types/express": "^4.17.21",
"@types/jest": "29.5.10",
"@types/supertest": "2.0.16",
"@faker-js/faker": "^9.3.0",
"@types/express": "^5.0.0",
"@types/jest": "29.5.14",
"@types/supertest": "6.0.2",
"jest": "29.7.0",
"jest-serial-runner": "^1.2.1",
"supertest": "6.3.3",
"ts-jest": "29.1.1",
"typemoq": "^2.1.0"
"supertest": "7.0.0",
"ts-jest": "29.2.5",
"typemoq": "^2.1.0",
"prettier": "3.4.2",
"eslint": "9.17.0"
}
}
64 changes: 31 additions & 33 deletions src/booking/src/app.module.ts
Original file line number Diff line number Diff line change
@@ -1,38 +1,36 @@
import {RouterModule} from '@nestjs/core';
import {TypeOrmModule} from '@nestjs/typeorm';
import {postgresOptions} from './data/data-source';
import {PassportModule} from "@nestjs/passport";
import {JwtModule} from "@nestjs/jwt";
import {OpenTelemetryModule} from "building-blocks/openTelemetry/open-telemetry.module";
import {JwtStrategy} from "building-blocks/passport/jwt.strategy";
import {BookingModule} from "./booking/booking.module";
import configs from "building-blocks/configs/configs";
import {MiddlewareConsumer, Module, NestModule} from "@nestjs/common";
import {HttpContextMiddleware} from "building-blocks/context/context";
import { RouterModule } from '@nestjs/core';
import { TypeOrmModule } from '@nestjs/typeorm';
import { postgresOptions } from './data/data-source';
import { PassportModule } from '@nestjs/passport';
import { JwtModule } from '@nestjs/jwt';
import { OpenTelemetryModule } from 'building-blocks/openTelemetry/open-telemetry.module';
import { JwtStrategy } from 'building-blocks/passport/jwt.strategy';
import { BookingModule } from './booking/booking.module';
import configs from 'building-blocks/configs/configs';
import { MiddlewareConsumer, Module, NestModule } from '@nestjs/common';
import { HttpContextMiddleware } from 'building-blocks/context/context';

@Module({
imports: [
PassportModule,
JwtModule.register({
secret: configs.jwt.secret,
signOptions: {expiresIn: configs.jwt.refreshExpirationDays},
}),
OpenTelemetryModule.forRoot(),
TypeOrmModule.forRoot(postgresOptions),
BookingModule,
RouterModule.register([
{
path: '/',
module: BookingModule,
}
]),
],
providers: [JwtStrategy],
imports: [
PassportModule,
JwtModule.register({
secret: configs.jwt.secret,
signOptions: { expiresIn: configs.jwt.refreshExpirationDays }
}),
OpenTelemetryModule.forRoot(),
TypeOrmModule.forRoot(postgresOptions),
BookingModule,
RouterModule.register([
{
path: '/',
module: BookingModule
}
])
],
providers: [JwtStrategy]
})
export class AppModule implements NestModule {
configure(consumer: MiddlewareConsumer) {
consumer
.apply(HttpContextMiddleware)
.forRoutes('*');
}
configure(consumer: MiddlewareConsumer) {
consumer.apply(HttpContextMiddleware).forRoutes('*');
}
}
58 changes: 30 additions & 28 deletions src/booking/src/booking/booking.module.ts
Original file line number Diff line number Diff line change
@@ -1,32 +1,34 @@
import {Module} from '@nestjs/common';
import {CqrsModule} from '@nestjs/cqrs';
import {TypeOrmModule} from '@nestjs/typeorm';
import {RabbitmqModule} from "building-blocks/rabbitmq/rabbitmq.module";
import {Booking} from "./entities/booking.entity";
import {BookingRepository} from "../data/repositories/booking.repository";
import {PassengerClient} from "./http-client/services/passenger/passenger-client";
import {FlightClient} from "./http-client/services/flight/flight.client";
import {CreateBookingController, CreateBookingHandler} from "./features/v1/create-booking/create-booking";


import { Module } from '@nestjs/common';
import { CqrsModule } from '@nestjs/cqrs';
import { TypeOrmModule } from '@nestjs/typeorm';
import { RabbitmqModule } from 'building-blocks/rabbitmq/rabbitmq.module';
import { Booking } from './entities/booking.entity';
import { BookingRepository } from '../data/repositories/booking.repository';
import { PassengerClient } from './http-client/services/passenger/passenger-client';
import { FlightClient } from './http-client/services/flight/flight.client';
import {
CreateBookingController,
CreateBookingHandler
} from './features/v1/create-booking/create-booking';

@Module({
imports: [CqrsModule, RabbitmqModule.forRoot(), TypeOrmModule.forFeature([Booking])],
controllers: [CreateBookingController],
providers: [ CreateBookingHandler,
{
provide: 'IBookingRepository',
useClass: BookingRepository,
},
{
provide: 'IPassengerClient',
useClass: PassengerClient,
},
{
provide: 'IFlightClient',
useClass: FlightClient,
}
],
exports: [],
imports: [CqrsModule, RabbitmqModule.forRoot(), TypeOrmModule.forFeature([Booking])],
controllers: [CreateBookingController],
providers: [
CreateBookingHandler,
{
provide: 'IBookingRepository',
useClass: BookingRepository
},
{
provide: 'IPassengerClient',
useClass: PassengerClient
},
{
provide: 'IFlightClient',
useClass: FlightClient
}
],
exports: []
})
export class BookingModule {}
24 changes: 12 additions & 12 deletions src/booking/src/booking/dtos/booking.dto.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
export class BookingDto {
id: number;
flightNumber: string;
aircraftId: number;
departureAirportId: number;
arriveAirportId: number;
flightDate: Date;
price: number;
description: string;
seatNumber: string;
passengerName: string;
createdAt: Date;
updatedAt?: Date | null;
id: number;
flightNumber: string;
aircraftId: number;
departureAirportId: number;
arriveAirportId: number;
flightDate: Date;
price: number;
description: string;
seatNumber: string;
passengerName: string;
createdAt: Date;
updatedAt?: Date | null;
}
Loading
Loading