Browse Source

Refactoring

pull/3117/head
Thomas Kaul 1 year ago
parent
commit
b4650deb12
  1. 3
      apps/client/src/app/components/admin-market-data-detail/admin-market-data-detail.component.ts
  2. 2
      apps/client/src/app/components/admin-market-data-detail/market-data-detail-dialog/interfaces/interfaces.ts
  3. 4
      apps/client/src/app/components/admin-market-data-detail/market-data-detail-dialog/market-data-detail-dialog.component.ts
  4. 2
      apps/client/src/app/components/admin-market-data-detail/market-data-detail-dialog/market-data-detail-dialog.html
  5. 6
      apps/client/src/app/services/admin.service.ts

3
apps/client/src/app/components/admin-market-data-detail/admin-market-data-detail.component.ts

@ -155,12 +155,11 @@ export class AdminMarketDataDetailComponent implements OnChanges, OnInit {
day: string; day: string;
yearMonth: string; yearMonth: string;
}) { }) {
const date = `${yearMonth}-${day}`;
const marketPrice = this.marketDataByMonth[yearMonth]?.[day]?.marketPrice; const marketPrice = this.marketDataByMonth[yearMonth]?.[day]?.marketPrice;
const dialogRef = this.dialog.open(MarketDataDetailDialog, { const dialogRef = this.dialog.open(MarketDataDetailDialog, {
data: <MarketDataDetailDialogParams>{ data: <MarketDataDetailDialogParams>{
date, dateString: `${yearMonth}-${day}`,
marketPrice, marketPrice,
currency: this.currency, currency: this.currency,
dataSource: this.dataSource, dataSource: this.dataSource,

2
apps/client/src/app/components/admin-market-data-detail/market-data-detail-dialog/interfaces/interfaces.ts

@ -5,7 +5,7 @@ import { DataSource } from '@prisma/client';
export interface MarketDataDetailDialogParams { export interface MarketDataDetailDialogParams {
currency: string; currency: string;
dataSource: DataSource; dataSource: DataSource;
date: string; dateString: string;
marketPrice: number; marketPrice: number;
symbol: string; symbol: string;
user: User; user: User;

4
apps/client/src/app/components/admin-market-data-detail/market-data-detail-dialog/market-data-detail-dialog.component.ts

@ -45,7 +45,7 @@ export class MarketDataDetailDialog implements OnDestroy {
this.adminService this.adminService
.fetchSymbolForDate({ .fetchSymbolForDate({
dataSource: this.data.dataSource, dataSource: this.data.dataSource,
date: this.data.date, dateString: this.data.dateString,
symbol: this.data.symbol symbol: this.data.symbol
}) })
.pipe(takeUntil(this.unsubscribeSubject)) .pipe(takeUntil(this.unsubscribeSubject))
@ -63,7 +63,7 @@ export class MarketDataDetailDialog implements OnDestroy {
marketData: { marketData: {
marketData: [ marketData: [
{ {
date: this.data.date, date: this.data.dateString,
marketPrice: this.data.marketPrice marketPrice: this.data.marketPrice
} }
] ]

2
apps/client/src/app/components/admin-market-data-detail/market-data-detail-dialog/market-data-detail-dialog.html

@ -9,7 +9,7 @@
matInput matInput
name="date" name="date"
[matDatepicker]="date" [matDatepicker]="date"
[(ngModel)]="data.date" [(ngModel)]="data.dateString"
/> />
<mat-datepicker-toggle class="mr-2" matSuffix [for]="date"> <mat-datepicker-toggle class="mr-2" matSuffix [for]="date">
<ion-icon <ion-icon

6
apps/client/src/app/services/admin.service.ts

@ -188,14 +188,14 @@ export class AdminService {
public fetchSymbolForDate({ public fetchSymbolForDate({
dataSource, dataSource,
date, dateString,
symbol symbol
}: { }: {
dataSource: DataSource; dataSource: DataSource;
date: string; dateString: string;
symbol: string; symbol: string;
}) { }) {
const url = `/api/v1/symbol/${dataSource}/${symbol}/${date}`; const url = `/api/v1/symbol/${dataSource}/${symbol}/${dateString}`;
return this.http.get<IDataProviderHistoricalResponse>(url); return this.http.get<IDataProviderHistoricalResponse>(url);
} }

Loading…
Cancel
Save