File tree Expand file tree Collapse file tree 4 files changed +10
-11
lines changed Expand file tree Collapse file tree 4 files changed +10
-11
lines changed Original file line number Diff line number Diff line change 1
1
import { Container } from 'typedi' ;
2
2
import { ConnectionManager } from 'typeorm' ;
3
3
4
- /**
4
+ /**
5
5
* We need to set imported TypeORM classes before requesting them, otherwise we
6
6
* would receive a "ServiceNotFoundError" above TypeDI 0.9.1.
7
7
*/
Original file line number Diff line number Diff line change 1
1
import { ok , deepStrictEqual } from 'assert' ;
2
2
import { Container } from 'typedi' ;
3
- import { createConnection , } from 'typeorm' ;
3
+ import { createConnection } from 'typeorm' ;
4
4
import { UserRepository } from './user.respository' ;
5
5
import { User } from './user.entity' ;
6
6
7
7
export async function startApp ( ) {
8
- const connection = await createConnection ( {
8
+ const connection = await createConnection ( {
9
9
/** we use in memoty SQL JS to test the lib. */
10
- type : 'sqljs' ,
10
+ type : 'sqljs' ,
11
11
logger : 'advanced-console' ,
12
12
logging : true ,
13
13
/** We don't want to mess with the creation of table now, so we auto-create it. */
14
14
synchronize : true ,
15
15
/** Entities must be registered in TypeORM before you can use them. */
16
- entities : [ User ] ,
16
+ entities : [ User ] ,
17
17
} ) ;
18
18
19
19
const userOne = new User ( ) ;
@@ -43,4 +43,4 @@ export async function startApp() {
43
43
44
44
/** Close the connection so the app can exit. */
45
45
await connection . close ( ) ;
46
- }
46
+ }
Original file line number Diff line number Diff line change 1
1
import 'reflect-metadata' ;
2
2
import { Container } from 'typedi' ;
3
3
import { useContainer } from 'typeorm' ;
4
- import { startApp } from './app'
4
+ import { startApp } from './app' ;
5
5
6
6
useContainer ( Container ) ;
7
7
@@ -12,4 +12,4 @@ startApp()
12
12
console . error ( error ) ;
13
13
/** We exit with error code so tests will fail. */
14
14
process . exit ( - 1 ) ;
15
- } ) ;
15
+ } ) ;
Original file line number Diff line number Diff line change @@ -2,15 +2,14 @@ import { EntityManager, Repository } from 'typeorm';
2
2
import { Service } from 'typedi' ;
3
3
4
4
/**
5
- * It's important that we import these from the index.ts file, because the
6
- * entry point file runs some setup logic for the default container.
5
+ * It's important that we import these from the index.ts file, because the
6
+ * entry point file runs some setup logic for the default container.
7
7
*/
8
8
import { InjectRepository , InjectManager } from '../../src' ;
9
9
import { User } from './user.entity' ;
10
10
11
11
@Service ( )
12
12
export class UserRepository {
13
-
14
13
@InjectManager ( )
15
14
private entityManager ! : EntityManager ;
16
15
You can’t perform that action at this time.
0 commit comments