last changes

This commit is contained in:
Jakob Stornig 2024-01-25 20:35:09 +01:00
parent 7a5ace403e
commit 899b50ded4
16 changed files with 53 additions and 89 deletions

View file

@ -2,6 +2,7 @@ import React from 'react';
import { View, Button, Alert } from 'react-native';
import { addCategory, addExpense, deleteExpenses, deleteCategories, DEV_populateDatabase, deleteDatabase } from './database';
import uuid from 'react-native-uuid';
import { CategoryType } from '../types/dbItems';
const randomColors = ["red", "blue", "green", "purple", "yellow"];
@ -46,7 +47,7 @@ const DebugMenu = () => {
const allocated_amount = getRandomNumber();
const type = "expense";
addCategory(name, color, type, allocated_amount)
addCategory(name, color, CategoryType.EXPENSE, allocated_amount)
.then(() => Alert.alert("Category Added", `Name: ${name}, Color: ${color}`))
.catch((error: any) => console.error("Error adding category: ", error));
};

View file

@ -4,13 +4,11 @@ import uuid from "react-native-uuid";
import { Query } from "expo-sqlite";
import { SimpleDate } from "../util/SimpleDate";
import { CategoryType } from "../types/dbItems";
let db: SQLite.SQLiteDatabase;
export enum CategoryType {
SAVING = "saving",
EXPENSE = "expense",
}
export const initDatabase = async () => {
db = SQLite.openDatabase("interactive_systeme.db");