// eslint-disable-next-line
async function handleCreateAccount(data: any, accountRepo: AccountRepo) {
try {
const account = toAccount(data);
console.log(`Creating account: ` + JSON.stringify(account));
await accountRepo.create(account);
console.log(`Created account: ` + JSON.stringify(account));
} catch (error) {
console.log(`Error: ` + JSON.stringify(error));
}
}
...
(in AccountRepo)
async create(account: Account): Promise<void> {
await this.db.prepare(this.CREATE).bind(...).run();
}
// eslint-disable-next-line
async function handleCreateAccount(data: any, accountRepo: AccountRepo) {
try {
const account = toAccount(data);
console.log(`Creating account: ` + JSON.stringify(account));
await accountRepo.create(account);
console.log(`Created account: ` + JSON.stringify(account));
} catch (error) {
console.log(`Error: ` + JSON.stringify(error));
}
}
...
(in AccountRepo)
async create(account: Account): Promise<void> {
await this.db.prepare(this.CREATE).bind(...).run();
}