🎉 Working prototype
- Added missing field payee_name to TransactionEntity type - Date function to convert DayJs to DateString - Temp disabled cronjob for testing - Fixed mapping to ActualModel - fetchToken db function returns DayJs object for date - Fixed fetching tokens from db - Logging - Fixed fetch previous day transactions - Fixed token refresh - Fixed stub based on model changes
This commit is contained in:
@ -12,12 +12,16 @@ import logger from "@/logger.ts"
|
||||
export interface Actual {
|
||||
importTransactions: (
|
||||
accountId: UUID,
|
||||
transactions: ReadonlyArray<TransactionEntity>,
|
||||
transactions: ReadonlyArray<ActualTransaction>,
|
||||
) => Promise<ImportTransactionsResponse>
|
||||
|
||||
shutdown: () => Promise<void>
|
||||
}
|
||||
|
||||
export interface ActualTransaction extends TransactionEntity {
|
||||
payee_name?: string
|
||||
}
|
||||
|
||||
export interface Message {
|
||||
message: string
|
||||
}
|
||||
@ -41,19 +45,23 @@ export class ActualImpl implements Actual {
|
||||
password: ACTUAL_PASSWORD,
|
||||
})
|
||||
logger.info(`Initialized ActualBudget API for ${ACTUAL_SERVER_URL}`)
|
||||
await actual.downloadBudget(ACTUAL_SYNC_ID)
|
||||
logger.info(`Downloaded budget`)
|
||||
await this.downloadBudget()
|
||||
return new ActualImpl()
|
||||
}
|
||||
|
||||
async importTransactions(
|
||||
accountId: UUID,
|
||||
transactions: ReadonlyArray<TransactionEntity>,
|
||||
transactions: ReadonlyArray<ActualTransaction>,
|
||||
): Promise<ImportTransactionsResponse> {
|
||||
return await actual.importTransactions(accountId, transactions)
|
||||
return actual.importTransactions(accountId, transactions)
|
||||
}
|
||||
|
||||
async shutdown() {
|
||||
return await actual.shutdown()
|
||||
async shutdown(): Promise<void> {
|
||||
return actual.shutdown()
|
||||
}
|
||||
|
||||
private static async downloadBudget(): Promise<void> {
|
||||
await actual.downloadBudget(ACTUAL_SYNC_ID)
|
||||
logger.info(`Downloaded budget`)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user