Skip to content

Commit

Permalink
upsert target user in transaction
Browse files Browse the repository at this point in the history
  • Loading branch information
Adrastopoulos committed Jul 5, 2023
1 parent bab7a13 commit 00f44f6
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion apps/bot/src/lib/transaction.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { TransactionString } from '@economica/common';
import { datasource, Guild, Member, Transaction } from '@economica/db';
import { datasource, Guild, Member, Transaction, User } from '@economica/db';
import { EmbedBuilder } from 'discord.js';
import { client } from '..';
import { parseNumber } from './economy';
Expand All @@ -12,6 +12,9 @@ export const recordTransaction = async (
wallet: number,
treasury: number
) => {
await datasource
.getRepository(User)
.upsert({ id: targetId }, { conflictPaths: ['id'] });
const target = await datasource
.getRepository(Member)
.findOneByOrFail({ userId: targetId, guildId });
Expand Down

0 comments on commit 00f44f6

Please sign in to comment.