Skip to content

Commit

Permalink
Merge pull request #11 from meysamhadeli/feat/update-all-packages
Browse files Browse the repository at this point in the history
feat: update all packages
  • Loading branch information
meysamhadeli authored Dec 27, 2024
2 parents 9c7b995 + 7b5916a commit 631bfdf
Show file tree
Hide file tree
Showing 224 changed files with 4,161 additions and 3,456 deletions.
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: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -108,3 +108,5 @@ fabric.properties

# Android studio 3.1+ serialized cache file
.idea/caches/build_file_checksums.ser

*.tsbuildinfo
2 changes: 0 additions & 2 deletions src/booking/.eslintignore

This file was deleted.

15 changes: 0 additions & 15 deletions src/booking/.eslintrc

This file was deleted.

3 changes: 0 additions & 3 deletions src/booking/.lintstagedrc

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/
17 changes: 17 additions & 0 deletions src/booking/eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import globals from "globals";
import tseslint from "typescript-eslint";

/** @type {import('eslint').Linter.Config[]} */
export default [
{ files: ["**/*.{js,mjs,cjs,ts}"] },
{ files: ["**/*.js"], languageOptions: { sourceType: "commonjs" } },
{ languageOptions: { globals: globals.browser } },
...tseslint.configs.recommended,
{
rules: {
"@typescript-eslint/no-unsafe-function-type": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-require-imports": "off"
},
},
];
102 changes: 51 additions & 51 deletions src/booking/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,10 @@
"author": "Meysam Hadeli",
"license": "MIT",
"scripts": {
"dev": "tsc -p tsconfig.json && nodemon src/app.ts --watch",
"build": "tsc -p tsconfig.json",
"lint": "eslint .",
"lint:fix": "eslint . --fix",
"prettier": "prettier --check **/*.ts",
"prettier:fix": "prettier --write **/*.ts",
"dev": "tsc && nodemon src/app.ts --watch",
"build": "tsc",
"format": "prettier --write \"**/*.{ts,js}\"",
"lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
"generate:swagger": "tsoa routes && tsoa spec",
"typeorm": "npm run build && npx typeorm -d ./dist/booking/src/data/data-source.js",
"migration:generate": "npm run typeorm -- migration:generate",
Expand All @@ -20,62 +18,64 @@
"test": "jest"
},
"devDependencies": {
"@faker-js/faker": "^8.1.0",
"@types/compression": "^1.7.2",
"@types/cors": "^2.8.13",
"@types/express": "^4.17.17",
"@types/jest": "^29.5.5",
"@types/morgan": "^1.9.3",
"@types/node": "^20.6.3",
"@types/passport": "^1.0.11",
"@types/passport-jwt": "^3.0.7",
"@types/supertest": "^2.0.12",
"@types/swagger-ui-express": "^4.1.3",
"@typescript-eslint/eslint-plugin": "^5.46.1",
"@typescript-eslint/parser": "^5.46.1",
"eslint": "^8.29.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-prettier": "^4.2.1",
"@eslint/js": "^9.17.0",
"@faker-js/faker": "^9.3.0",
"@types/compression": "^1.7.5",
"@types/cors": "^2.8.17",
"@types/express": "^5.0.0",
"@types/jest": "^29.5.14",
"@types/morgan": "^1.9.9",
"@types/node": "^22.10.2",
"@types/passport": "^1.0.17",
"@types/passport-jwt": "^4.0.1",
"@types/supertest": "^6.0.2",
"@types/swagger-ui-express": "^4.1.7",
"@typescript-eslint/eslint-plugin": "^8.18.2",
"@typescript-eslint/parser": "^8.18.2",
"eslint": "^9.17.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.2.1",
"globals": "^15.14.0",
"jest": "^29.7.0",
"lint-staged": "^13.1.0",
"prettier": "^2.8.1",
"supertest": "^6.3.3",
"swagger-ui-express": "^4.6.3",
"ts-jest": "^29.1.1",
"ts-node": "^10.9.1",
"typescript": "^5.2.2"
"lint-staged": "^15.2.11",
"prettier": "^3.4.2",
"supertest": "^7.0.0",
"swagger-ui-express": "^5.0.1",
"ts-jest": "^29.2.5",
"ts-node": "^10.9.2",
"typescript": "^5.7.2",
"typescript-eslint": "^8.18.2"
},
"dependencies": {
"@opentelemetry/sdk-trace-node": "^1.17.0",
"@types/pg": "^8.10.2",
"amqplib": "^0.10.3",
"@opentelemetry/sdk-trace-node": "^1.30.0",
"@types/pg": "^8.11.10",
"amqplib": "^0.10.5",
"async-retry": "^1.3.3",
"axios": "^1.5.1",
"axios": "^1.7.9",
"building-blocks": "file:../building-blocks",
"compression": "^1.7.4",
"compression": "^1.7.5",
"cors": "^2.8.5",
"dotenv": "^16.0.3",
"express": "^4.18.2",
"express-rate-limit": "^6.7.0",
"helmet": "^6.0.1",
"dotenv": "^16.4.7",
"express": "^4.21.2",
"express-rate-limit": "^7.5.0",
"helmet": "^8.0.0",
"http-problem-details": "^0.1.5",
"http-status": "^1.5.3",
"http-status-codes": "^2.3.0",
"jest-serial-runner": "^1.2.1",
"joi": "^17.7.0",
"moment": "^2.29.4",
"joi": "^17.13.3",
"moment": "^2.30.1",
"morgan": "^1.10.0",
"nodemon": "^3.0.2",
"passport": "^0.6.0",
"passport-jwt": "^4.0.0",
"pg": "^8.11.3",
"prom-client": "^14.2.0",
"reflect-metadata": "^0.1.13",
"testcontainers": "^10.2.1",
"nodemon": "^3.1.9",
"passport": "^0.7.0",
"passport-jwt": "^4.0.1",
"pg": "^8.13.1",
"prom-client": "^15.1.3",
"reflect-metadata": "^0.2.2",
"testcontainers": "^10.16.0",
"ts-mapper": "^1.2.4",
"tsoa": "^5.1.1",
"tsoa": "^6.6.0",
"tsyringe": "^4.8.0",
"typemoq": "^2.1.0",
"typeorm": "^0.3.17",
"winston": "^3.8.2"
"winston": "^3.17.0"
}
}
2 changes: 1 addition & 1 deletion src/booking/src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { registerMediatrHandlers } from './extensions/mediatr.extensions';
import { httpContextMiddleware } from 'building-blocks/context/context';
import { postgresOptions } from './data/data-source';
import { Logger } from 'building-blocks/logging/logger';
import {errorHandler} from "building-blocks/error-handler/error-handler";
import { errorHandler } from 'building-blocks/error-handler/error-handler';

const startupApp = async () => {
collectDefaultMetrics();
Expand Down
2 changes: 1 addition & 1 deletion src/booking/src/booking/entities/booking.entity.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Column, Entity, PrimaryGeneratedColumn } from 'typeorm';
import { Column, Entity, PrimaryGeneratedColumn } from 'building-blocks/typeorm';

@Entity()
export class Booking {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { Body, Controller, Post, Route, Security, SuccessResponse } from 'tsoa';
import httpStatus from 'http-status';
import Joi from 'joi';
import { inject, injectable } from 'tsyringe';
import notFoundException from 'building-blocks/types/exception/not-found.exception';
Expand All @@ -12,6 +11,7 @@ import { IPassengerClient } from '../../../http-client/services/passenger/passen
import { IPublisher } from 'building-blocks/rabbitmq/rabbitmq-publisher';
import mapper from '../../../mappings';
import { IRequest, IRequestHandler, mediatrJs } from 'building-blocks/mediatr-js/mediatr-js';
import { StatusCodes } from 'http-status-codes';

export class CreateBooking implements IRequest<BookingDto> {
passengerId: number;
Expand Down Expand Up @@ -53,7 +53,7 @@ export class CreateBookingController extends Controller {
})
);

this.setStatus(httpStatus.CREATED);
this.setStatus(StatusCodes.CREATED);
return result;
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
import axios from 'axios';
import {FlightDto, ReserveSeatRequestDto, SeatDto} from "building-blocks/contracts/flight.contract";
import {HttpContext} from "building-blocks/context/context";
import * as https from "https";
import {AxiosInstance} from "axios/index";
import {injectable} from "tsyringe";
import {
FlightDto,
ReserveSeatRequestDto,
SeatDto
} from 'building-blocks/contracts/flight.contract';
import { HttpContext } from 'building-blocks/context/context';
import * as https from 'https';
import { AxiosInstance } from 'axios/index';
import { injectable } from 'tsyringe';

export interface IFlightClient {
getFlightById(id: number): Promise<FlightDto>;
Expand All @@ -15,45 +19,44 @@ export interface IFlightClient {

@injectable()
export class FlightClient implements IFlightClient {

private readonly client: AxiosInstance;
constructor() {
this.client = axios.create({
baseURL: 'http://localhost:3344',
timeout: 60000,
maxContentLength: 500 * 1000 * 1000,
httpsAgent: new https.Agent({keepAlive: true}),
httpsAgent: new https.Agent({ keepAlive: true })
});
}

async getFlightById(id: number): Promise<FlightDto> {
const result = await this.client
.get<FlightDto>(`/api/v1/flight/get-by-id?id=${id}`, {
headers: {
Authorization: HttpContext.headers.authorization.toString()
}
});
const result = await this.client.get<FlightDto>(`/api/v1/flight/get-by-id?id=${id}`, {
headers: {
Authorization: HttpContext.headers.authorization.toString()
}
});

return result?.data;
}

async getAvalibaleSeats(flightId: number): Promise<SeatDto[]> {
const result = await this.client
.get<SeatDto[]>(`/api/v1/seat/get-available-seats?flightId=${flightId}`, {
const result = await this.client.get<SeatDto[]>(
`/api/v1/seat/get-available-seats?flightId=${flightId}`,
{
headers: {
Authorization: HttpContext.headers.authorization.toString()
}
});
}
);

return result?.data;
}

async reserveSeat(request: ReserveSeatRequestDto): Promise<void> {
await this.client
.post(`/api/v1/seat/reserve`, request, {
headers: {
Authorization: HttpContext.headers.authorization.toString()
}
});
await this.client.post(`/api/v1/seat/reserve`, request, {
headers: {
Authorization: HttpContext.headers.authorization.toString()
}
});
}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import axios, {AxiosInstance} from 'axios';
import {PassengerDto} from "building-blocks/contracts/passenger.contract";
import {HttpContext} from "building-blocks/context/context";
import https from "https";
import {injectable} from "tsyringe";
import axios, { AxiosInstance } from 'axios';
import { PassengerDto } from 'building-blocks/contracts/passenger.contract';
import { HttpContext } from 'building-blocks/context/context';
import https from 'https';
import { injectable } from 'tsyringe';

export interface IPassengerClient {
getPassengerById(id: number): Promise<PassengerDto>;
Expand All @@ -17,18 +17,16 @@ export class PassengerClient implements IPassengerClient {
baseURL: 'http://localhost:3355',
timeout: 60000,
maxContentLength: 500 * 1000 * 1000,
httpsAgent: new https.Agent({ keepAlive: true }),
httpsAgent: new https.Agent({ keepAlive: true })
});
}

async getPassengerById(id: number): Promise<PassengerDto> {

const result = await this.client
.get<PassengerDto>(`/api/v1/passenger/get-by-id?id=${id}`, {
headers: {
Authorization: HttpContext.headers.authorization.toString()
}
});
const result = await this.client.get<PassengerDto>(`/api/v1/passenger/get-by-id?id=${id}`, {
headers: {
Authorization: HttpContext.headers.authorization.toString()
}
});

return result?.data;
}
Expand Down
4 changes: 2 additions & 2 deletions src/booking/src/data/data-source.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import config from 'building-blocks/config/config';
import {DataSource, DataSourceOptions} from 'typeorm';
import { DataSource, DataSourceOptions } from 'building-blocks/typeorm';

// use this file for running migration
export const postgresOptions: DataSourceOptions = {
Expand All @@ -13,7 +13,7 @@ export const postgresOptions: DataSourceOptions = {
entities: [__dirname + config.postgres.entities],
migrations: [__dirname + config.postgres.migrations],
logging: config.postgres.logging
};
} as DataSourceOptions;

const dataSource = new DataSource(postgresOptions);

Expand Down
2 changes: 1 addition & 1 deletion src/booking/src/data/db.context.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { container } from 'tsyringe';
import { DataSource, DataSourceOptions } from 'typeorm';
import { DataSource, DataSourceOptions } from 'building-blocks/typeorm';
import { registerRepositories } from '../extensions/repository.extensions';
import { DbContext, IDbContext } from 'building-blocks/typeorm/db-context';

Expand Down
Loading

0 comments on commit 631bfdf

Please sign in to comment.