Browse Source

First Implementation of tags on holdings

pull/5027/head
Dan 2 years ago
parent
commit
65abae14e6
  1. 2
      apps/api/src/app/admin/admin.service.ts
  2. 12
      apps/api/src/app/admin/update-asset-profile.dto.ts
  3. 2
      apps/api/src/services/symbol-profile/symbol-profile.service.ts
  4. 5
      apps/client/src/app/components/admin-market-data/asset-profile-dialog/asset-profile-dialog.component.ts
  5. 11
      apps/client/src/app/components/admin-market-data/asset-profile-dialog/asset-profile-dialog.html
  6. 1
      libs/common/src/lib/interfaces/enhanced-symbol-profile.interface.ts

2
apps/api/src/app/admin/admin.service.ts

@ -308,6 +308,7 @@ export class AdminService {
comment,
dataSource,
name,
tags,
scraperConfiguration,
symbol,
symbolMapping
@ -318,6 +319,7 @@ export class AdminService {
comment,
dataSource,
name,
tags,
scraperConfiguration,
symbol,
symbolMapping

12
apps/api/src/app/admin/update-asset-profile.dto.ts

@ -1,5 +1,11 @@
import { AssetClass, AssetSubClass, Prisma } from '@prisma/client';
import { IsEnum, IsObject, IsOptional, IsString } from 'class-validator';
import {
IsArray,
IsEnum,
IsObject,
IsOptional,
IsString
} from 'class-validator';
export class UpdateAssetProfileDto {
@IsEnum(AssetClass, { each: true })
@ -18,6 +24,10 @@ export class UpdateAssetProfileDto {
@IsOptional()
name?: string;
@IsArray()
@IsOptional()
tags?: string[];
@IsObject()
@IsOptional()
scraperConfiguration?: Prisma.InputJsonObject;

2
apps/api/src/services/symbol-profile/symbol-profile.service.ts

@ -91,6 +91,7 @@ export class SymbolProfileService {
comment,
dataSource,
name,
tags,
scraperConfiguration,
symbol,
symbolMapping
@ -101,6 +102,7 @@ export class SymbolProfileService {
assetSubClass,
comment,
name,
tags,
scraperConfiguration,
symbolMapping
},

5
apps/client/src/app/components/admin-market-data/asset-profile-dialog/asset-profile-dialog.component.ts

@ -51,6 +51,7 @@ export class AssetProfileDialog implements OnDestroy, OnInit {
assetSubClass: new FormControl<AssetSubClass>(undefined),
comment: '',
name: ['', Validators.required],
tags: new FormControl<string[]>(undefined),
scraperConfiguration: '',
symbolMapping: ''
});
@ -66,6 +67,8 @@ export class AssetProfileDialog implements OnDestroy, OnInit {
[name: string]: { name: string; value: number };
};
public HoldingTags: { id: string; label: string }[];
private static readonly HISTORICAL_DATA_TEMPLATE = `date;marketPrice\n${format(
new Date(),
DATE_FORMAT
@ -132,6 +135,7 @@ export class AssetProfileDialog implements OnDestroy, OnInit {
assetClass: this.assetProfile.assetClass,
assetSubClass: this.assetProfile.assetSubClass,
comment: this.assetProfile?.comment ?? '',
tags: this.assetProfile?.tags,
scraperConfiguration: JSON.stringify(
this.assetProfile?.scraperConfiguration ?? {}
),
@ -225,6 +229,7 @@ export class AssetProfileDialog implements OnDestroy, OnInit {
assetSubClass: this.assetProfileForm.controls['assetSubClass'].value,
comment: this.assetProfileForm.controls['comment'].value ?? null,
name: this.assetProfileForm.controls['name'].value,
tag: this.assetProfileForm.controls['tags'].value,
scraperConfiguration,
symbolMapping
};

11
apps/client/src/app/components/admin-market-data/asset-profile-dialog/asset-profile-dialog.html

@ -210,6 +210,17 @@
</mat-select>
</mat-form-field>
</div>
<div class="mt-3">
<mat-form-field appearance="outline" class="w-100">
<mat-label i18n>Tags</mat-label>
<mat-select formControlName="tags" multiple>
<mat-option [value]="null"></mat-option>
<mat-option *ngFor="let tag of HoldingTags" [value]="tag.id"
>{{ tag.label }}</mat-option
>
</mat-select>
</mat-form-field>
</div>
<div class="d-flex my-3">
<div class="w-50">
<mat-checkbox

1
libs/common/src/lib/interfaces/enhanced-symbol-profile.interface.ts

@ -23,4 +23,5 @@ export interface EnhancedSymbolProfile {
symbolMapping?: { [key: string]: string };
updatedAt: Date;
url?: string;
tags?: string[];
}

Loading…
Cancel
Save