Requested changes

This commit is contained in:
Daniel Hougaard
2024-06-24 19:11:58 +02:00
parent c735beea32
commit 7ab5c02000
3 changed files with 8 additions and 26 deletions
@@ -26,11 +26,9 @@ export const superAdminDALFactory = (db: TDbClient) => {
};
const updateById = async (id: string, data: TSuperAdminUpdate, tx?: Knex) => {
const updatedConfig = await superAdminOrm.transaction(async (trx) => {
await superAdminOrm.updateById(id, data, tx || trx);
const config = await findById(id, tx || trx);
return config;
const updatedConfig = await (superAdminOrm || tx).transaction(async (trx: Knex) => {
await superAdminOrm.updateById(id, data, trx);
return findById(id, trx);
});
return updatedConfig;