@@ -12,9 +12,8 @@ import {
12
12
OrganizationSettings ,
13
13
User ,
14
14
} from "@gitpod/gitpod-protocol" ;
15
- import { inject , injectable } from "inversify" ;
16
- import { TypeORM } from "./typeorm" ;
17
- import { Repository } from "typeorm" ;
15
+ import { inject , injectable , optional } from "inversify" ;
16
+ import { EntityManager , Repository } from "typeorm" ;
18
17
import { v4 as uuidv4 } from "uuid" ;
19
18
import { randomBytes } from "crypto" ;
20
19
import { TeamDB } from "../team-db" ;
@@ -26,13 +25,16 @@ import { ResponseError } from "vscode-jsonrpc";
26
25
import { ErrorCodes } from "@gitpod/gitpod-protocol/lib/messaging/error" ;
27
26
import slugify from "slugify" ;
28
27
import { DBOrgSettings } from "./entity/db-team-settings" ;
28
+ import { TransactionalDBImpl , UndefinedEntityManager } from "./transactional-db-impl" ;
29
29
30
30
@injectable ( )
31
- export class TeamDBImpl implements TeamDB {
32
- @inject ( TypeORM ) typeORM : TypeORM ;
31
+ export class TeamDBImpl extends TransactionalDBImpl < TeamDB > implements TeamDB {
32
+ constructor ( @inject ( UndefinedEntityManager ) @optional ( ) transactionalEM : EntityManager | undefined ) {
33
+ super ( transactionalEM ) ;
34
+ }
33
35
34
- protected async getEntityManager ( ) {
35
- return ( await this . typeORM . getConnection ( ) ) . manager ;
36
+ protected createTransactionalDB ( transactionalEM : EntityManager ) : TeamDB {
37
+ return new TeamDBImpl ( transactionalEM ) ;
36
38
}
37
39
38
40
protected async getTeamRepo ( ) : Promise < Repository < DBTeam > > {
0 commit comments