Added better-sqlite3 dep and created default db
Signed-off-by: Martin Berg Alstad <git@martials.no>
This commit is contained in:
@ -9,9 +9,11 @@ import { bankTransactionIntoActualTransaction } from "@/mappings.ts"
|
||||
import { ACTUAL_ACCOUNT_IDS, BANK_ACCOUNT_IDS } from "../config.ts"
|
||||
import logger from "@/logger.ts"
|
||||
import type { UUID } from "node:crypto"
|
||||
import Database from "better-sqlite3"
|
||||
|
||||
// TODO Transports api for pino https://github.com/pinojs/pino/blob/HEAD/docs/transports.md
|
||||
// TODO create .cache if missing
|
||||
// TODO store oauth tokens in a SQLite db, use same dep as actual
|
||||
|
||||
export async function daily(actual: Actual, bank: Bank): Promise<void> {
|
||||
// Fetch transactions from the bank
|
||||
@ -48,6 +50,10 @@ async function fetchTransactionsFromPastDay(
|
||||
async function main(): Promise<void> {
|
||||
logger.info("Starting application")
|
||||
const actual = await ActualImpl.init()
|
||||
const databaseFileName = "default.sqlite"
|
||||
const db = new Database(databaseFileName)
|
||||
logger.info(`Started SQLlite database with filename="${databaseFileName}"`)
|
||||
|
||||
logger.info("Waiting for CRON job to start")
|
||||
|
||||
cronJobDaily(async () => {
|
||||
@ -58,6 +64,7 @@ async function main(): Promise<void> {
|
||||
|
||||
// logger.info("Shutting down")
|
||||
// await actual.shutdown()
|
||||
// db.close()
|
||||
}
|
||||
|
||||
void main()
|
||||
|
Reference in New Issue
Block a user