diff --git a/apps/api/src/app/endpoints/ai/ai.service.ts b/apps/api/src/app/endpoints/ai/ai.service.ts index 06f72e00c..6c037c782 100644 --- a/apps/api/src/app/endpoints/ai/ai.service.ts +++ b/apps/api/src/app/endpoints/ai/ai.service.ts @@ -21,13 +21,43 @@ const HOLDINGS_TABLE_COLUMNS: ({ key: string } & ColumnDescriptor)[] = [ { key: 'SYMBOL', name: 'Symbol' }, { key: 'ASSET_CLASS', name: 'Asset Class' }, { + align: 'right', key: 'ALLOCATION_PERCENTAGE', - name: 'Allocation in Percentage', - align: 'right' + name: 'Allocation in Percentage' }, { key: 'ASSET_SUB_CLASS', name: 'Asset Sub Class' } ]; +// Helper function to get column value for holdings table +const getColumnValue = ( + key: string, + holding: { + currency: string; + name: string; + symbol: string; + assetClass?: string; + allocationInPercentage: number; + assetSubClass?: string; + } +) => { + switch (key) { + case 'CURRENCY': + return holding.currency; + case 'NAME': + return holding.name; + case 'SYMBOL': + return holding.symbol; + case 'ASSET_CLASS': + return holding.assetClass ?? ''; + case 'ALLOCATION_PERCENTAGE': + return `${(holding.allocationInPercentage * 100).toFixed(3)}%`; + case 'ASSET_SUB_CLASS': + return holding.assetSubClass ?? ''; + default: + return ''; + } +}; + @Injectable() export class AiService { public constructor( @@ -76,48 +106,23 @@ export class AiService { }); const holdingsTableColumns: ColumnDescriptor[] = HOLDINGS_TABLE_COLUMNS.map( - ({ name, align }) => ({ name, align: align ?? 'left' }) - ); - - const getColumnValue = ( - key: string, - holding: { - currency: string; - name: string; - symbol: string; - assetClass?: string; - allocationInPercentage: number; - assetSubClass?: string; - } - ) => { - switch (key) { - case 'CURRENCY': - return holding.currency; - case 'NAME': - return holding.name; - case 'SYMBOL': - return holding.symbol; - case 'ASSET_CLASS': - return holding.assetClass ?? ''; - case 'ALLOCATION_PERCENTAGE': - return `${(holding.allocationInPercentage * 100).toFixed(3)}%`; - case 'ASSET_SUB_CLASS': - return holding.assetSubClass ?? ''; - default: - return ''; + ({ name, align }) => { + return { name, align: align ?? 'left' }; } - }; + ); const holdingsTableRows = Object.values(holdings) .sort((a, b) => { return b.allocationInPercentage - a.allocationInPercentage; }) .map((holding) => { - const row: Record = {}; - HOLDINGS_TABLE_COLUMNS.forEach(({ key, name }) => { - row[name] = getColumnValue(key, holding); - }); - return row; + return HOLDINGS_TABLE_COLUMNS.reduce( + (row, { key, name }) => { + row[name] = getColumnValue(key, holding); + return row; + }, + {} as Record + ); }); const holdingsTableString = tablemark.default(holdingsTableRows, { diff --git a/how --stat 05c49999 b/how --stat 05c49999 new file mode 100644 index 000000000..72eea9316 --- /dev/null +++ b/how --stat 05c49999 @@ -0,0 +1,38 @@ +commit bb14162c7abbe09af9f9f16ae9b5c01e842c1465 (HEAD -> refactor_column) +Merge: 05c49999 06936cd7 +Author: Vansh +Date: Sat Oct 25 22:11:23 2025 +0530 + + Merge branch 'refactor_column' of https://github.com/Vansh-Parate/ghostfolio into refactor_column + + CHANGELOG.md | 11 +- + apps/api/src/app/endpoints/ai/ai.service.ts | 6 +- + .../app/order/interfaces/activities.interface.ts | 5 - + apps/api/src/app/order/order.controller.ts | 8 +- + apps/api/src/app/order/order.service.ts | 5 +- + .../portfolio/calculator/portfolio-calculator.ts | 2 +- + .../src/app/components/rule/rule.component.ts | 2 + + .../src/app/components/rules/rules.component.html | 1 + + .../src/app/components/rules/rules.component.ts | 1 + + .../portfolio/x-ray/x-ray-page.component.html | 2 + + apps/client/src/app/services/data.service.ts | 4 +- + .../src/assets/images/logo-selfhostedhub.svg | 2 + + apps/client/src/locales/messages.ca.xlf | 152 ++++++++++++--------- + apps/client/src/locales/messages.de.xlf | 152 ++++++++++++--------- + apps/client/src/locales/messages.es.xlf | 152 ++++++++++++--------- + apps/client/src/locales/messages.fr.xlf | 152 ++++++++++++--------- + apps/client/src/locales/messages.it.xlf | 152 ++++++++++++--------- + apps/client/src/locales/messages.nl.xlf | 152 ++++++++++++--------- + apps/client/src/locales/messages.pl.xlf | 152 ++++++++++++--------- + apps/client/src/locales/messages.pt.xlf | 152 ++++++++++++--------- + apps/client/src/locales/messages.tr.xlf | 152 ++++++++++++--------- + apps/client/src/locales/messages.uk.xlf | 152 ++++++++++++--------- + apps/client/src/locales/messages.xlf | 150 +++++++++++--------- + apps/client/src/locales/messages.zh.xlf | 152 ++++++++++++--------- + libs/common/src/lib/interfaces/index.ts | 2 + + .../responses/activities-response.interface.ts | 6 + + .../lib/logo-carousel/logo-carousel.component.scss | 9 ++ + .../lib/logo-carousel/logo-carousel.component.ts | 6 + + package-lock.json | 4 +- + package.json | 2 +- + 30 files changed, 1088 insertions(+), 812 deletions(-)