mirror of
https://github.com/actualbudget/actual.git
synced 2026-03-11 20:44:32 -05:00
Update types
This commit is contained in:
@@ -110,8 +110,8 @@ async function execTransactionsGrouped(
|
||||
return execQuery(queryState, state, s, params, outputTypes);
|
||||
}
|
||||
|
||||
let rows;
|
||||
let matched = null;
|
||||
let rows: Array<{ group_id: db.DbTransaction['id']; matched: string }>;
|
||||
let matched: Set<db.DbTransaction['id']> = null;
|
||||
|
||||
if (isHappyPathQuery(queryState)) {
|
||||
// This is just an optimization - we can just filter out children
|
||||
|
||||
@@ -264,7 +264,7 @@ export async function delete_(table, id) {
|
||||
}
|
||||
|
||||
export async function deleteAll(table: string) {
|
||||
const rows: Array<{ id: string }> = await all(`
|
||||
const rows = await all<{ id: string }>(`
|
||||
SELECT id FROM ${table} WHERE tombstone = 0
|
||||
`);
|
||||
await Promise.all(rows.map(({ id }) => delete_(table, id)));
|
||||
@@ -560,7 +560,7 @@ export async function mergePayees(
|
||||
ids: Array<DbPayee['id']>,
|
||||
) {
|
||||
// Load in payees so we can check some stuff
|
||||
const dbPayees: DbPayee[] = await all('SELECT * FROM payees');
|
||||
const dbPayees = await all<DbPayee>('SELECT * FROM payees');
|
||||
const payees = groupById(dbPayees);
|
||||
|
||||
// Filter out any transfer payees
|
||||
@@ -713,7 +713,7 @@ export async function moveAccount(
|
||||
'SELECT * FROM accounts WHERE id = ?',
|
||||
[id],
|
||||
);
|
||||
let accounts;
|
||||
let accounts: Pick<DbAccount, 'id' | 'sort_order'>[];
|
||||
if (account.closed) {
|
||||
accounts = await all(
|
||||
`SELECT id, sort_order FROM accounts WHERE closed = 1 ORDER BY sort_order, name`,
|
||||
|
||||
@@ -5,7 +5,12 @@ import { captureBreadcrumb } from '../platform/exceptions';
|
||||
import * as sqlite from '../platform/server/sqlite';
|
||||
import { sheetForMonth } from '../shared/months';
|
||||
|
||||
import { DbPreference } from './db';
|
||||
import {
|
||||
DbPreference,
|
||||
DbReflectBudget,
|
||||
DbZeroBudget,
|
||||
DbZeroBudgetMonth,
|
||||
} from './db';
|
||||
import * as Platform from './platform';
|
||||
import { Spreadsheet } from './spreadsheet/spreadsheet';
|
||||
import { resolveName } from './spreadsheet/util';
|
||||
@@ -205,7 +210,7 @@ export async function loadUserBudgets(
|
||||
)) ?? {};
|
||||
|
||||
const table = budgetType === 'report' ? 'reflect_budgets' : 'zero_budgets';
|
||||
const budgets = await db.all(`
|
||||
const budgets = await db.all<DbReflectBudget | DbZeroBudget>(`
|
||||
SELECT * FROM ${table} b
|
||||
LEFT JOIN categories c ON c.id = b.category
|
||||
WHERE c.tombstone = 0
|
||||
@@ -229,7 +234,9 @@ export async function loadUserBudgets(
|
||||
|
||||
// For zero-based budgets, load the buffered amounts
|
||||
if (budgetType !== 'report') {
|
||||
const budgetMonths = await db.all('SELECT * FROM zero_budget_months');
|
||||
const budgetMonths = await db.all<DbZeroBudgetMonth>(
|
||||
'SELECT * FROM zero_budget_months',
|
||||
);
|
||||
for (const budgetMonth of budgetMonths) {
|
||||
const sheetName = sheetForMonth(budgetMonth.id);
|
||||
sheet.set(`${sheetName}!buffered`, budgetMonth.buffered);
|
||||
|
||||
Reference in New Issue
Block a user