mirror of
https://github.com/actualbudget/actual.git
synced 2026-04-28 01:58:40 -05:00
Fix types
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { ScheduleEntity } from '../../types/models';
|
||||
import * as db from '../db';
|
||||
import { Schedule } from '../db/types';
|
||||
|
||||
import { GOAL_PREFIX, TEMPLATE_PREFIX } from './template-notes';
|
||||
|
||||
@@ -41,7 +41,7 @@ export async function getCategoriesWithTemplateNotes(): Promise<
|
||||
);
|
||||
}
|
||||
|
||||
export async function getActiveSchedules(): Promise<Schedule[]> {
|
||||
export async function getActiveSchedules(): Promise<ScheduleEntity[]> {
|
||||
return await db.all(
|
||||
'SELECT id, rule, active, completed, posts_transaction, tombstone, name from schedules WHERE name NOT NULL AND tombstone = 0',
|
||||
);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { ScheduleEntity } from '../../types/models';
|
||||
import * as db from '../db';
|
||||
import { Schedule } from '../db/types';
|
||||
|
||||
import {
|
||||
CategoryWithTemplateNote,
|
||||
@@ -20,7 +20,7 @@ function mockGetTemplateNotesForCategories(
|
||||
);
|
||||
}
|
||||
|
||||
function mockGetActiveSchedules(schedules: Schedule[]) {
|
||||
function mockGetActiveSchedules(schedules: Partial<ScheduleEntity>[]) {
|
||||
(getActiveSchedules as jest.Mock).mockResolvedValue(schedules);
|
||||
}
|
||||
|
||||
@@ -245,7 +245,7 @@ describe('checkTemplates', () => {
|
||||
);
|
||||
});
|
||||
|
||||
function mockSchedules(): Schedule[] {
|
||||
function mockSchedules(): Partial<ScheduleEntity>[] {
|
||||
return [
|
||||
{
|
||||
id: 'mock-schedule-1',
|
||||
|
||||
@@ -176,7 +176,7 @@ async function importDashboard({ filepath }: { filepath: string }) {
|
||||
|
||||
exportModel.validate(parsedContent);
|
||||
|
||||
const customReportIds: CustomReportEntity[] = await db.all(
|
||||
const customReportIds: Pick<CustomReportEntity, 'id'>[] = await db.all(
|
||||
'SELECT id from custom_reports',
|
||||
);
|
||||
const customReportIdSet = new Set(customReportIds.map(({ id }) => id));
|
||||
|
||||
9
packages/loot-core/src/server/db/types.d.ts
vendored
9
packages/loot-core/src/server/db/types.d.ts
vendored
@@ -1,9 +0,0 @@
|
||||
export type Schedule = {
|
||||
id: string;
|
||||
rule: string;
|
||||
active: number;
|
||||
completed: number;
|
||||
posts_transaction: number;
|
||||
tombstone: number;
|
||||
name: string | null;
|
||||
};
|
||||
@@ -118,10 +118,9 @@ describe('sync migrations', () => {
|
||||
await sendMessages(msgs);
|
||||
await tracer.expect('applied');
|
||||
|
||||
const transactions = await db.all<TransactionEntity>(
|
||||
'SELECT * FROM transactions',
|
||||
[],
|
||||
);
|
||||
const transactions = await db.all<
|
||||
TransactionEntity & { isChild: number }
|
||||
>('SELECT * FROM transactions', []);
|
||||
for (const trans of transactions) {
|
||||
const transMsgs = msgs
|
||||
.filter(msg => msg.row === trans.id)
|
||||
@@ -138,7 +137,7 @@ describe('sync migrations', () => {
|
||||
const msg = transMsgs.find(m => m.column === 'parent_id');
|
||||
|
||||
if (
|
||||
!!trans.is_child &&
|
||||
trans.isChild === 1 &&
|
||||
trans.id.includes('/') &&
|
||||
(msg == null || msg.value == null)
|
||||
) {
|
||||
|
||||
@@ -23,6 +23,7 @@ export interface ScheduleEntity {
|
||||
id: string;
|
||||
name?: string;
|
||||
rule: RuleEntity['id'];
|
||||
active: boolean | 1 | 0;
|
||||
next_date: string;
|
||||
completed: boolean | 1 | 0;
|
||||
posts_transaction: boolean | 1 | 0;
|
||||
|
||||
Reference in New Issue
Block a user