This commit is contained in:
cupcakearmy 2020-09-14 15:21:19 +02:00
parent b35309370b
commit 5a0c42e1f0
No known key found for this signature in database
GPG Key ID: D28129AE5654D9D9
2 changed files with 12 additions and 1 deletions

8
.prettierrc Normal file
View File

@ -0,0 +1,8 @@
{
"tabWidth": 2,
"useTabs": false,
"printWidth": 250,
"singleQuote": true,
"semi": false,
"trailingComma": "es5"
}

View File

@ -53,6 +53,9 @@ export abstract class BaseEntity {
static persist<T extends BaseEntity>(this: ObjectType<T>, ...args: Parameters<EntityRepository<T>['persist']>): ReturnType<EntityRepository<T>['persist']> {
return (this as any).getRepo().persist(...args)
}
static persistAndFlush<T extends BaseEntity>(this: ObjectType<T>, ...args: Parameters<EntityRepository<T>['persistAndFlush']>): ReturnType<EntityRepository<T>['persistAndFlush']> {
return (this as any).getRepo().persist(...args)
}
static populate<T extends BaseEntity>(this: ObjectType<T>, ...args: Parameters<EntityRepository<T>['populate']>): ReturnType<EntityRepository<T>['populate']> {
return (this as any).getRepo().populate(...args)
}
@ -61,4 +64,4 @@ export abstract class BaseEntity {
}
}
export const register = <D extends IDatabaseDriver = IDatabaseDriver>(db: MikroORM<D>) => (orm = db)
export const register = <D extends IDatabaseDriver = IDatabaseDriver<Connection>>(db: MikroORM<D>) => (orm = db)