Skip to content

Commit

Permalink
fix(typeorm): resolve problem with mongodb
Browse files Browse the repository at this point in the history
  • Loading branch information
rudemex committed Mar 30, 2023
1 parent 247d49a commit de99560
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 25 deletions.
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
]
},
"dependencies": {
"@nestjs/axios": "^1.0.1",
"@nestjs/axios": "^2.0.0",
"@nestjs/class-validator": "^0.13.3",
"@nestjs/common": "^9.2.1",
"@nestjs/config": "^2.2.0",
Expand All @@ -71,7 +71,7 @@
"pg": "^8.5.1",
"pino": "^8.8.0",
"pino-multi-stream": "^6.0.0",
"pino-pretty": "^9.1.1",
"pino-pretty": "^10.0.0",
"redis": "^4.1.0",
"reflect-metadata": "^0.1.13",
"rxjs": "^7.5.5",
Expand Down Expand Up @@ -107,7 +107,7 @@
"@types/inline-css": "^3.0.1",
"@types/jest": "^29.2.6",
"@types/mocha": "^10.0.1",
"@types/node": "^18.15.5",
"@types/node": "^18.15.10",
"@types/nodemailer": "^6.4.4",
"@types/pug": "^2.0.6",
"@types/supertest": "^2.0.11",
Expand All @@ -125,7 +125,7 @@
"lerna": "^4.0.0",
"lint-staged": "^13.1.0",
"mocha": "^10.2.0",
"nodemailer-mock": "^1.5.12",
"nodemailer-mock": "^2.0.1",
"plop": "^3.0.5",
"prettier": "^2.8.3",
"rimraf": "^4.1.2",
Expand All @@ -136,6 +136,6 @@
"ts-node": "^10.4.0",
"tsconfig-paths": "^4.1.2",
"turbo": "^1.8.5",
"typescript": "^4.5.5"
"typescript": "^4.9.5"
}
}
4 changes: 2 additions & 2 deletions packages/camunda/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,13 @@
"@nestjs/core": "^9.2.1",
"@nestjs/microservices": "^9.2.1",
"@nestjs/platform-express": "^9.2.1",
"camunda-external-task-client-js": "^2.2.0",
"camunda-external-task-client-js": "^2.3.1",
"reflect-metadata": "^0.1.13",
"rxjs": "^7.5.5"
},
"dependencies": {
"@nestjs/microservices": "^9.2.1",
"camunda-external-task-client-js": "^2.2.0"
"camunda-external-task-client-js": "^2.3.1"
},
"devDependencies": {
"@tresdoce-nestjs-toolkit/config": "^0.2.3",
Expand Down
4 changes: 2 additions & 2 deletions packages/health/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"directory": "../../dist/health"
},
"peerDependencies": {
"@nestjs/axios": "^1.0.1",
"@nestjs/axios": "^2.0.0",
"@nestjs/common": "^9.2.1",
"@nestjs/core": "^9.2.1",
"@nestjs/microservices": "^9.2.1",
Expand All @@ -50,7 +50,7 @@
"typeorm": "^0.3.6"
},
"dependencies": {
"@nestjs/axios": "^1.0.1",
"@nestjs/axios": "^2.0.0",
"@nestjs/microservices": "^9.2.1",
"@nestjs/swagger": "^6.1.4",
"@nestjs/terminus": "^9.1.4",
Expand Down
12 changes: 6 additions & 6 deletions packages/mailer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,22 +40,22 @@
"@nestjs/core": "^9.2.1",
"@nestjs/platform-express": "^9.2.1",
"ejs": "^3.1.2",
"glob": "8.1.0",
"glob": "9.3.2",
"handlebars": "^4.7.6",
"inline-css": "4.0.1",
"inline-css": "4.0.2",
"mjml": "^4.12.0",
"nodemailer": "6.9.0",
"nodemailer": "6.9.1",
"pug": "^3.0.1",
"reflect-metadata": "^0.1.13",
"rxjs": "^7.5.5"
},
"dependencies": {
"ejs": "^3.1.2",
"glob": "8.1.0",
"glob": "9.3.2",
"handlebars": "^4.7.6",
"inline-css": "4.0.1",
"inline-css": "4.0.2",
"mjml": "^4.12.0",
"nodemailer": "6.9.0",
"nodemailer": "6.9.1",
"pug": "^3.0.1"
},
"devDependencies": {
Expand Down
4 changes: 2 additions & 2 deletions packages/typeorm/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"@nestjs/core": "^9.2.1",
"@nestjs/platform-express": "^9.2.1",
"@nestjs/typeorm": "^9.0.1",
"mongodb": "^5.1.0",
"mongodb": "^4.13.0",
"mysql": "^2.18.1",
"mysql2": "^3.0.1",
"pg": "^8.5.1",
Expand All @@ -50,7 +50,7 @@
},
"dependencies": {
"@nestjs/typeorm": "^9.0.1",
"mongodb": "^5.1.0",
"mongodb": "^4.13.0",
"mysql": "^2.18.1",
"mysql2": "^3.0.1",
"pg": "^8.5.1",
Expand Down
5 changes: 3 additions & 2 deletions packages/typeorm/src/__test__/typeorm.module.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ describe('TypeOrm - Postgres', () => {
});
});

jest.setTimeout(70000);
describe('TypeOrm - MySql', () => {
let app: INestApplication;
let container: testContainers;
Expand Down Expand Up @@ -117,6 +118,7 @@ describe('TypeOrm - MySql', () => {
});
});

jest.setTimeout(70000);
describe('TypeOrm - Mongo', () => {
let app: INestApplication;
let container: testContainers;
Expand Down Expand Up @@ -155,14 +157,13 @@ describe('TypeOrm - Mongo', () => {
});

it('should be defined', async () => {
console.log(app);
await expect(app).toBeDefined();
}, 50000);

it('should be return an array of user', async () => {
await repository.save(fixtureUserArrayResponse);

const query = await repository.find();
const query: User[] = await repository.find();
expect(query).toEqual(expect.any(Array));
});
});
3 changes: 2 additions & 1 deletion packages/typeorm/src/__test__/utils/configuration-mongo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@ export default registerAs('config', (): Typings.AppConfig => {
password: encodeURIComponent('123456'),
database: encodeURIComponent('test_db'),
authSource: encodeURIComponent('admin'),
entities: [__dirname + '/**/user.entity{.ts,.js}'],
synchronize: true,
autoLoadEntities: true,
entities: [__dirname + '/**/user.entity{.ts,.js}'],
useNewUrlParser: true,
useUnifiedTopology: true,
},
},
Expand Down
7 changes: 2 additions & 5 deletions packages/typeorm/src/typeorm/typeorm.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,8 @@ import { TYPE_ORM_MODULE_OPTIONS } from './constants/typerom.constants';
providers: [
{
provide: TYPE_ORM_MODULE_OPTIONS,
useFactory: async (configService: ConfigService) => {
const typeOrmModuleOptions: TypeOrmModuleOptions =
configService.get('config.database.typeorm');
return typeOrmModuleOptions;
},
useFactory: async (configService: ConfigService) =>
configService.get<TypeOrmModuleOptions>('config.database.typeorm'),
inject: [ConfigService],
},
],
Expand Down

0 comments on commit de99560

Please sign in to comment.