Skip to content

Commit

Permalink
PR feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
jfdoming committed Jan 18, 2025
1 parent 9da5774 commit 5cdbd82
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 20 deletions.
4 changes: 2 additions & 2 deletions packages/desktop-client/src/components/accounts/Account.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -718,7 +718,7 @@ class AccountInternal extends PureComponent<
}

const { data } = await runQuery(
this.paged?.query
this.paged.query
.options({ splits: 'none' })
.select([{ balance: { $sumOver: '$amount' } }]),
);
Expand Down Expand Up @@ -936,7 +936,7 @@ class AccountInternal extends PureComponent<
}

const { data: amount } = await runQuery(
this.paged?.query.calculate({ $sum: '$amount' }),
this.paged.query.calculate({ $sum: '$amount' }),
);
return amount;
};
Expand Down
8 changes: 4 additions & 4 deletions packages/desktop-client/src/components/modals/EditUser.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,14 +83,14 @@ function useSaveUser() {
user: User,
setError: (error: string) => void,
): Promise<boolean> {
const res = (await send(method, user)) || {};
if (!res['error']) {
const newId = res['id'];
const res = await send(method, user);
if (!('error' in res)) {
const newId = res.id;
if (newId) {
user.id = newId;
}
} else {
const error = res['error'];
const error = res.error;
setError(getUserDirectoryErrors(error));
if (error === 'token-expired') {
dispatch(
Expand Down
3 changes: 2 additions & 1 deletion packages/loot-core/src/platform/client/fetch/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ export type Unlisten = typeof unlisten;
/** Mock functions */
export function initServer(handlers: {
query: (query: { table: string; selectExpressions: unknown }) => Promise<{
data: unknown;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
data: any;
dependencies: string[];
}>;
getCell?: () => { value: number };
Expand Down
8 changes: 2 additions & 6 deletions packages/loot-core/src/server/admin/types/handlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,11 @@ export interface AdminHandlers {

'user-add': (
user: Omit<UserEntity, 'id'>,
) => Promise<
{ error?: string; id?: undefined } | { error?: undefined; id: string }
>;
) => Promise<{ error: string } | { id: string }>;

'user-update': (
user: Omit<UserEntity, 'id'>,
) => Promise<
{ error?: string; id?: undefined } | { error?: undefined; id: string }
>;
) => Promise<{ error: string } | { id: string }>;

'access-add': (
user: NewUserAccessEntity,
Expand Down
8 changes: 3 additions & 5 deletions packages/loot-core/src/server/aql/compiler.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { QueryState } from 'loot-core/shared/query';

Check warning on line 1 in packages/loot-core/src/server/aql/compiler.ts

View workflow job for this annotation

GitHub Actions / lint

'loot-core/shared/query' import is restricted from being used by a pattern. Please use relative imports in loot-core instead of importing from `loot-core/*`

import { getNormalisedString } from '../../shared/normalisation';

// @ts-strict-ignore
Expand Down Expand Up @@ -1005,11 +1007,7 @@ export type SchemaConfig = {
| Record<string, unknown>
| ((name: string, config: { withDead; isJoin; tableOptions }) => unknown);
tableFilters?: (name: string) => unknown[];
customizeQuery?: <
T extends { table: string; orderExpressions: readonly unknown[] },
>(
queryString: T,
) => T;
customizeQuery?: (queryString: QueryState) => QueryState;
views?: Record<
string,
{
Expand Down
2 changes: 1 addition & 1 deletion packages/loot-core/src/server/rules/types/handlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export interface RulesHandlers {

'rules-get': () => Promise<RuleEntity[]>;

'rule-get': (arg: { id: string }) => Promise<RuleEntity>;
'rule-get': (arg: { id: RuleEntity['id'] }) => Promise<RuleEntity>;

'rules-run': (arg: {
transaction: TransactionEntity;
Expand Down
3 changes: 2 additions & 1 deletion packages/loot-core/src/types/server-handlers.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,8 @@ export interface ServerHandlers {

'create-query': (arg: { sheetName; name; query }) => Promise<unknown>;

query: (query: Query) => Promise<{ data: unknown; dependencies: string[] }>;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
query: (query: Query) => Promise<{ data: any; dependencies: string[] }>;

'account-update': (arg: { id; name }) => Promise<unknown>;

Expand Down

0 comments on commit 5cdbd82

Please sign in to comment.