refactor: enforce frontend view model boundaries
Frontend verify / commits (pull_request) Successful in 28s
Frontend verify / security (pull_request) Successful in 10s
Frontend verify / verify (pull_request) Successful in 8m19s

This commit is contained in:
2026-09-28 18:48:23 +03:00
parent 5b69003516
commit ca0ad4f824
287 changed files with 8558 additions and 4538 deletions
+10 -1
View File
@@ -18,6 +18,7 @@ function bondQueryOptions(uid: string) {
staleTime: BOND_STALE_TIME_MS,
};
}
function useBond(identifier: string) {
const isUid
= /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(
@@ -28,6 +29,7 @@ function useBond(identifier: string) {
...bondQueryOptions(identifier),
enabled: Boolean(identifier) && isUid,
});
const byTicker = useResourceQuery({
...apiQueryClient.queryOptions("get", "/api/v1/bonds/by-ticker/{ticker}", {
params: { path: { ticker: identifier } },
@@ -35,6 +37,7 @@ function useBond(identifier: string) {
enabled: Boolean(identifier) && !isUid,
staleTime: BOND_STALE_TIME_MS,
});
return isUid ? byUid : byTicker;
}
@@ -47,6 +50,7 @@ function useBondCandles(uid: string, period: BondPeriod) {
staleTime: BOND_STALE_TIME_MS,
});
}
function useBondCoupons(uid: string) {
return useResourceQuery({
meta: { accessGroup: "brokerage" },
@@ -57,6 +61,7 @@ function useBondCoupons(uid: string) {
staleTime: BOND_STALE_TIME_MS,
});
}
function useBondMetrics(uid: string) {
return useResourceQuery({
...apiQueryClient.queryOptions("get", "/api/v1/bonds/{uid}/metrics", {
@@ -66,6 +71,7 @@ function useBondMetrics(uid: string) {
staleTime: BOND_STALE_TIME_MS,
});
}
function useBondPosition(uid: string) {
return useResourceQuery({
meta: { accessGroup: "brokerage" },
@@ -76,6 +82,7 @@ function useBondPosition(uid: string) {
staleTime: BOND_STALE_TIME_MS,
});
}
function useBondQuote(uid: string) {
return useResourceQuery({
...apiQueryClient.queryOptions("get", "/api/v1/bonds/{uid}/quote", {
@@ -85,6 +92,7 @@ function useBondQuote(uid: string) {
staleTime: BOND_STALE_TIME_MS,
});
}
function useBondSearch(query: string) {
return useResourceQuery({
...apiQueryClient.queryOptions("get", "/api/v1/bonds", {
@@ -95,7 +103,8 @@ function useBondSearch(query: string) {
});
}
export { type BondPeriod,
export {
type BondPeriod,
MIN_BOND_SEARCH_LENGTH,
useBond,
useBondCandles,
+2 -1
View File
@@ -1,4 +1,5 @@
export { type BondPeriod,
export {
type BondPeriod,
MIN_BOND_SEARCH_LENGTH,
useBond,
useBondCandles,