Skip to content

Commit

Permalink
Added extra logs
Browse files Browse the repository at this point in the history
Try catch on inserting or update user balances
  • Loading branch information
aminlatifi committed Jul 20, 2023
1 parent 414213b commit d1c1e7d
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions src/repositories/instantBoostingRepository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,21 @@ import { ProjectUserInstantPowerView } from '../views/projectUserInstantPowerVie
export const saveOrUpdateInstantPowerBalances = async (
instances: Partial<InstantPowerBalance>[],
): Promise<void> => {
await InstantPowerBalance.createQueryBuilder<InstantPowerBalance>()
.insert()
.into(InstantPowerBalance)
.values(instances)
.orUpdate(['balance', 'chainUpdatedAt'], ['userId'])
.execute();
try {
logger.debug(
'saveOrUpdateInstantPowerBalances ',
JSON.stringify({ instances }, null, 2),
);
await InstantPowerBalance.createQueryBuilder<InstantPowerBalance>()
.insert()
.into(InstantPowerBalance)
.values(instances)
.orUpdate(['balance', 'chainUpdatedAt'], ['userId'])
.execute();
} catch (e) {
logger.error('saveOrUpdateInstantPowerBalances error', e);
throw e;
}
};

export const getUsersBoostedWithoutInstanceBalance = async (
Expand Down

0 comments on commit d1c1e7d

Please sign in to comment.