Merge branch '56-edit-expense' into 'main'
Resolve "edit Expense" Closes #56 See merge request thschleicher/interaktive-systeme!43
This commit is contained in:
commit
bf939fb807
11 changed files with 273 additions and 41 deletions
|
|
@ -42,6 +42,21 @@ export const addCategory = async (name: string, color: string, type: string, all
|
|||
}
|
||||
}
|
||||
|
||||
export const updateExpense = async (guid: string, name: string, category_guid: string, datetime: string, amount: number) => {
|
||||
|
||||
//needs user input validation for type and color (should be validated by this function)
|
||||
|
||||
try {
|
||||
await db.transactionAsync(async (tx) => {
|
||||
await tx.executeSqlAsync("UPDATE expense SET name = ?, category_guid = ?, datetime = ?, amount = ? WHERE guid = ?", [name, category_guid, datetime, amount, guid]
|
||||
);
|
||||
});
|
||||
} catch (error) {
|
||||
console.log("Error updating expense: ", error);
|
||||
throw error;
|
||||
}
|
||||
};
|
||||
|
||||
export const addExpense = async (name: string, category_guid: string, datetime: string, amount: number) => {
|
||||
|
||||
//needs user input validation for type and color (should be validated by this function)
|
||||
|
|
|
|||
Reference in a new issue