Skip to content

Commit

Permalink
Fix types
Browse files Browse the repository at this point in the history
  • Loading branch information
joel-jeremy committed Jan 23, 2025
1 parent 941adf3 commit 260bdbe
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 29 deletions.
2 changes: 2 additions & 0 deletions packages/loot-core/src/server/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -461,12 +461,14 @@ handlers['api/transactions-export'] = async function ({
transactions,
categoryGroups,
payees,
accounts,
}) {
checkFileOpen();
return handlers['transactions-export']({
transactions,
categoryGroups,
payees,
accounts,
});
};

Expand Down
2 changes: 2 additions & 0 deletions packages/loot-core/src/server/main.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// @ts-strict-ignore
import { getClock, deserializeClock } from '@actual-app/crdt';
import { v4 as uuidv4 } from 'uuid';

import { expectSnapshotWithDiffer } from '../mocks/util';
import * as connection from '../platform/server/connection';
Expand Down Expand Up @@ -175,6 +176,7 @@ describe('Budget', () => {
// budgets for the earlier months
await db.runQuery("INSERT INTO accounts (id, name) VALUES ('one', 'boa')");
await runHandler(handlers['transaction-add'], {
id: uuidv4(),
date: '2016-05-06',
amount: 50,
account: 'one',
Expand Down
2 changes: 1 addition & 1 deletion packages/loot-core/src/server/transactions/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ async function updateTransaction(transaction: TransactionEntity) {
return {};
}

async function deleteTransaction(transaction: TransactionEntity) {
async function deleteTransaction(transaction: Pick<TransactionEntity, 'id'>) {
await handleBatchUpdateTransactions({ deleted: [transaction] });
return {};
}
Expand Down
1 change: 1 addition & 0 deletions packages/loot-core/src/types/api-handlers.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ export interface ApiHandlers {
transactions;
categoryGroups;
payees;
accounts;
}) => Promise<unknown>;

'api/transactions-import': (arg: {
Expand Down
28 changes: 0 additions & 28 deletions packages/loot-core/src/types/server-handlers.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@ import { Backup } from '../server/backups';
import { RemoteFile } from '../server/cloud-storage';
import { Node as SpreadsheetNode } from '../server/spreadsheet/spreadsheet';
import { Message } from '../server/sync';
import { batchUpdateTransactions } from '../server/transactions';
import { ParseFileResult } from '../server/transactions/import/parse-file';
import { QueryState } from '../shared/query';

import { Budget } from './budget';
import {
Expand All @@ -26,34 +23,9 @@ import { Query } from './query';
import { EmptyObject } from './util';

export interface ServerHandlers {
'transaction-update': (transaction: { id: string }) => Promise<EmptyObject>;

undo: () => Promise<void>;

redo: () => Promise<void>;

'transactions-batch-update': (
...arg: Parameters<typeof batchUpdateTransactions>
) => ReturnType<typeof batchUpdateTransactions>;

'transaction-add': (transaction) => Promise<EmptyObject>;

'transaction-delete': (transaction) => Promise<EmptyObject>;

'transactions-parse-file': (arg: {
filepath: string;
options;
}) => Promise<ParseFileResult>;

'transactions-export': (arg: {
transactions;
accounts?;
categoryGroups;
payees;
}) => Promise<unknown>;

'transactions-export-query': (arg: { query: QueryState }) => Promise<string>;

'get-categories': () => Promise<{
grouped: Array<CategoryGroupEntity>;
list: Array<CategoryEntity>;
Expand Down

0 comments on commit 260bdbe

Please sign in to comment.