* fixes and cleanups
* db transactions * add default space to workspace
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
import { DataSource, EntityManager } from 'typeorm';
|
||||
|
||||
export async function transactionWrapper(
|
||||
operation: (...args) => any,
|
||||
datasource: DataSource,
|
||||
entityManager: EntityManager,
|
||||
) {
|
||||
if (entityManager) {
|
||||
return await operation(entityManager);
|
||||
} else {
|
||||
return await datasource.manager.transaction(
|
||||
async (manager: EntityManager) => {
|
||||
return await operation(manager);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user