correct display of budget used

This commit is contained in:
thschleicher 2024-01-02 11:55:49 +01:00 committed by Jakob Stornig
parent 6ee1c01d6a
commit 87640420ec
6 changed files with 14 additions and 24 deletions

View file

@ -24,7 +24,7 @@ export const initDatabase = async () => {
}
};
export const addCategory = async (name: string, color: string, type: string) => {
export const addCategory = async (name: string, color: string, type: string, allocated_amount: number) => {
//needs user input validation for type and color (should be validated by this function)
@ -32,8 +32,8 @@ export const addCategory = async (name: string, color: string, type: string) =>
try {
await db.transactionAsync(async (tx) => {
await tx.executeSqlAsync("INSERT INTO category (guid, name, color, type) VALUES (?, ?, ?, ?);",
[UUID.toString(), name, color, type]
await tx.executeSqlAsync("INSERT INTO category (guid, name, color, type, allocated_amount) VALUES (?, ?, ?, ?, ?);",
[UUID.toString(), name, color, type, allocated_amount]
);
});
} catch (error) {
@ -42,7 +42,7 @@ export const addCategory = async (name: string, color: string, type: string) =>
}
}
export const addExpense = async (name: string, category_guid: string,datetime: string, amount: number) => {
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)