Skip to content

Commit

Permalink
Merge branch 'main' into renovate/dayjs-1.x-lockfile
Browse files Browse the repository at this point in the history
  • Loading branch information
oxisto authored Dec 23, 2024
2 parents ff19f0b + 1c5c954 commit 708c699
Show file tree
Hide file tree
Showing 12 changed files with 96 additions and 103 deletions.
1 change: 1 addition & 0 deletions ui/.env.development
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
AUTH_CLIENT_ID=dashboard
7 changes: 4 additions & 3 deletions ui/app/(app)/portfolios/[name]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@ import client from "@/lib/api";
import Link from "next/link";

export interface PortfolioProps {
params: {
params: Promise<{
name: string;
};
}>;
}

export default async function Portfolio({ params }: PortfolioProps) {
export default async function Portfolio(props: PortfolioProps) {
const params = await props.params;
const { data: portfolio } = await client.GET("/v1/portfolios/{name}", {
params: { path: { name: params.name } },
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,8 @@ interface PortfolioTransactionProps {
}
interface EditPortfolioTransactionProps extends PortfolioTransactionProps {}

export default async function EditPortfolioTransaction({
params,
}: EditPortfolioTransactionProps) {
export default async function EditPortfolioTransaction(props: EditPortfolioTransactionProps) {
const params = await props.params;
const { data, error } = await client.GET("/v1/securities");
const create = params.transactionName == "new";
if (create && data) {
Expand Down
5 changes: 2 additions & 3 deletions ui/app/(app)/portfolios/[name]/transactions/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@ import client from "@/lib/api";

interface PortfolioTransactionProps extends PortfolioProps {}

export default async function PortfolioTransactions({
params,
}: PortfolioTransactionProps) {
export default async function PortfolioTransactions(props: PortfolioTransactionProps) {
const params = await props.params;
const { data: portfolio } = await client.GET("/v1/portfolios/{name}", {
params: { path: { name: params.name } },
});
Expand Down
4 changes: 2 additions & 2 deletions ui/components/portfolio-position-row.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { components } from "@/lib/api/v1";
import { components, SchemaPortfolioPosition } from "@/lib/api/v1";
import { classNames, shorten } from "@/lib/util";
import {
ArrowDownIcon,
Expand All @@ -9,7 +9,7 @@ import FormattedCurrency from "./formatted-currency";
import FormattedPercentage from "./formatted-percentage";

interface PortfolioPositionRowProps {
position: components["schemas"]["PortfolioPosition"];
position: SchemaPortfolioPosition;
}

export default function PortfolioPositionRow({
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions ui/lib/api/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { decode } from "next-auth/jwt";
import { cookies } from "next/headers";
import createClient, { Middleware } from "openapi-fetch";
import type { paths } from "./v1";
export * from "./types";
export * from "./v1";

const authMiddleware: Middleware = {
async onRequest({ request }) {
Expand All @@ -13,7 +13,7 @@ const authMiddleware: Middleware = {
: "authjs.session-token";
// Retrieve our frontend auth cookie that contains the encrypted frontend
// token
const cookie = cookies().get(cookieName);
const cookie = (await cookies()).get(cookieName);

// Decode/decrypt the token to access the backend API token
const token = await decode({
Expand Down
8 changes: 0 additions & 8 deletions ui/lib/api/types.ts

This file was deleted.

12 changes: 12 additions & 0 deletions ui/lib/api/v1.d.ts → ui/lib/api/v1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,18 @@ export interface components {
headers: never;
pathItems: never;
}
export type SchemaCurrency = components['schemas']['Currency'];
export type SchemaGoogleProtobufAny = components['schemas']['GoogleProtobufAny'];
export type SchemaListPortfolioTransactionsResponse = components['schemas']['ListPortfolioTransactionsResponse'];
export type SchemaListPortfoliosResponse = components['schemas']['ListPortfoliosResponse'];
export type SchemaListSecuritiesResponse = components['schemas']['ListSecuritiesResponse'];
export type SchemaListedSecurity = components['schemas']['ListedSecurity'];
export type SchemaPortfolio = components['schemas']['Portfolio'];
export type SchemaPortfolioEvent = components['schemas']['PortfolioEvent'];
export type SchemaPortfolioPosition = components['schemas']['PortfolioPosition'];
export type SchemaPortfolioSnapshot = components['schemas']['PortfolioSnapshot'];
export type SchemaSecurity = components['schemas']['Security'];
export type SchemaStatus = components['schemas']['Status'];
export type $defs = Record<string, never>;
export interface operations {
PortfolioService_ListPortfolios: {
Expand Down
4 changes: 2 additions & 2 deletions ui/lib/currency.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Currency } from "@/lib/api";
import { SchemaCurrency } from "@/lib/api";

/**
* This function returns a currency value to a decimal. Internally,
Expand All @@ -10,7 +10,7 @@ import { Currency } from "@/lib/api";
* @param currency the currency to convert
* @returns a decimal representation
*/
export function toDecimal(currency?: Currency): number {
export function toDecimal(currency?: SchemaCurrency): number {
if (
currency == undefined ||
currency.value == undefined ||
Expand Down
Loading

0 comments on commit 708c699

Please sign in to comment.