chore: finish frontend ESLint migration #18
Frontend security / security (push) Successful in 9s
Frontend verify / verify (push) Failing after 37m50s
Frontend security / security (pull_request) Successful in 9s
Frontend verify / verify (pull_request) Failing after 42m10s
Conventional commits / commits (pull_request) Successful in 29s
Frontend security / security (push) Successful in 9s
Frontend verify / verify (push) Failing after 37m50s
Frontend security / security (pull_request) Successful in 9s
Frontend verify / verify (pull_request) Failing after 42m10s
Conventional commits / commits (pull_request) Successful in 29s
Enable every plugin recommended preset and replace Biome with ESLint formatting. Preserve API contracts and JSX whitespace; verify source, tests, builds and tooling.
This commit is contained in:
@@ -1,16 +1,16 @@
|
||||
import { apiQueryClient, type paths, useResourceQuery } from "@/shared/api";
|
||||
|
||||
type OperationsEndpoint =
|
||||
paths["/api/v1/brokerage-accounts/{accountId}/operations"]["get"];
|
||||
|
||||
type BrokerageOperation = NonNullable<
|
||||
OperationsEndpoint["responses"][200]["content"]["application/json"]["data"]
|
||||
>["items"][number];
|
||||
|
||||
type BrokerageOperationsQuery = Omit<
|
||||
NonNullable<OperationsEndpoint["parameters"]["query"]>,
|
||||
"sync"
|
||||
>;
|
||||
type OperationCategory = BrokerageOperation["category"];
|
||||
type OperationsEndpoint
|
||||
= paths["/api/v1/brokerage-accounts/{accountId}/operations"]["get"];
|
||||
|
||||
const operationCategories = [
|
||||
"trade",
|
||||
@@ -21,19 +21,6 @@ const operationCategories = [
|
||||
"other",
|
||||
] as const satisfies readonly OperationCategory[];
|
||||
|
||||
function brokerageOperationsQueryParams(query: BrokerageOperationsQuery) {
|
||||
return {
|
||||
...(query.instrumentUid ? { instrumentUid: query.instrumentUid } : {}),
|
||||
...(query.from ? { from: query.from } : {}),
|
||||
...(query.to ? { to: query.to } : {}),
|
||||
...(query.categories?.length
|
||||
? { categories: [...query.categories].sort() }
|
||||
: {}),
|
||||
...(query.cursor ? { cursor: query.cursor } : {}),
|
||||
...(query.limit ? { limit: query.limit } : {}),
|
||||
};
|
||||
}
|
||||
|
||||
function brokerageOperationsQueryOptions(
|
||||
accountId: string | undefined,
|
||||
query: BrokerageOperationsQuery = {},
|
||||
@@ -44,12 +31,23 @@ function brokerageOperationsQueryOptions(
|
||||
{
|
||||
params: {
|
||||
path: { accountId: accountId ?? "" },
|
||||
query: brokerageOperationsQueryParams(query),
|
||||
query: brokerageOperationsQueryParameters(query),
|
||||
},
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
function brokerageOperationsQueryParameters(query: BrokerageOperationsQuery) {
|
||||
return {
|
||||
...(query.instrumentUid && { instrumentUid: query.instrumentUid }),
|
||||
...(query.from && { from: query.from }),
|
||||
...(query.to && { to: query.to }),
|
||||
...(query.categories?.length && { categories: query.categories.toSorted((left, right) => left.localeCompare(right)) }),
|
||||
...(query.cursor && { cursor: query.cursor }),
|
||||
...(query.limit && { limit: query.limit }),
|
||||
};
|
||||
}
|
||||
|
||||
function useBrokerageOperations(
|
||||
accountId: string | undefined,
|
||||
query: BrokerageOperationsQuery = {},
|
||||
@@ -65,8 +63,8 @@ function useBrokerageOperations(
|
||||
export {
|
||||
type BrokerageOperation,
|
||||
brokerageOperationsQueryOptions,
|
||||
brokerageOperationsQueryParams,
|
||||
type OperationCategory,
|
||||
brokerageOperationsQueryParameters as brokerageOperationsQueryParams,
|
||||
operationCategories,
|
||||
type OperationCategory,
|
||||
useBrokerageOperations,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user