Skip to content

Commit

Permalink
Save amount along with address
Browse files Browse the repository at this point in the history
  • Loading branch information
saboonikhil committed May 10, 2024
1 parent 2152254 commit 7328fc4
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/db.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ export default class Db {
return await this.store.findOne({ userId });
}

async saveOrUpdateCode(code: string, address: string): Promise<boolean> {
async saveOrUpdateCode(code: string, address: string, amount: string): Promise<boolean> {
const doc = await this.store.findOne({ code });
if (!doc) {
return !!(await this.store.insert({ code, address }));
return !!(await this.store.insert({ code, address, amount }));
} else {
return !!(await this.store.update({ code }, { $set: { address } }));
return !!(await this.store.update({ code }, { $set: { address, amount } }));
}
}

Expand Down

0 comments on commit 7328fc4

Please sign in to comment.