Browse Source

Merge pull request #141 from dandevaud/bugfix/Several-Bugfixes

Bugfix/several bugfixes
pull/5027/head
dandevaud 8 months ago
committed by GitHub
parent
commit
a865f8a427
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 3
      apps/api/src/app/admin/admin.controller.ts
  2. 4
      apps/api/src/app/admin/update-asset-profile.dto.ts
  3. 2
      apps/api/src/services/data-provider/manual/manual.service.ts
  4. 7
      apps/client/src/app/components/admin-market-data/asset-profile-dialog/asset-profile-dialog.component.ts
  5. 10
      apps/client/src/app/components/header/header.component.ts
  6. 2
      apps/client/src/app/services/admin.service.ts

3
apps/api/src/app/admin/admin.controller.ts

@ -371,7 +371,8 @@ export class AdminController {
tags: {
connect: assetProfileData.tags?.map(({ id }) => {
return { id };
})
}),
disconnect: assetProfileData.tagsDisconnected?.map(({ id }) => ({ id }))
}
});
}

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

@ -39,6 +39,10 @@ export class UpdateAssetProfileDto {
@IsOptional()
tags?: Tag[];
@IsArray()
@IsOptional()
tagsDisconnected?: Tag[];
@IsObject()
@IsOptional()
scraperConfiguration?: Prisma.InputJsonObject;

2
apps/api/src/services/data-provider/manual/manual.service.ts

@ -30,7 +30,7 @@ import * as cheerio from 'cheerio';
import { isUUID } from 'class-validator';
import { addDays, format, isBefore } from 'date-fns';
import got, { Headers } from 'got';
import jsonpath from 'jsonpath';
import * as jsonpath from 'jsonpath';
@Injectable()
export class ManualService implements DataProviderInterface {

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

@ -71,6 +71,7 @@ export class AssetProfileDialog implements OnDestroy, OnInit {
}),
name: ['', Validators.required],
tags: new FormControl<Tag[]>(undefined),
tagsDisconnected: new FormControl<Tag[]>(undefined),
scraperConfiguration: '',
sectors: '',
symbolMapping: '',
@ -172,6 +173,7 @@ export class AssetProfileDialog implements OnDestroy, OnInit {
assetSubClass: this.assetProfile.assetSubClass ?? null,
comment: this.assetProfile?.comment ?? '',
tags: this.assetProfile?.tags ?? [],
tagsDisconnected: [],
countries: JSON.stringify(
this.assetProfile?.countries?.map(({ code, weight }) => {
return { code, weight };
@ -328,6 +330,7 @@ export class AssetProfileDialog implements OnDestroy, OnInit {
assetSubClass: this.assetProfileForm.get('assetSubClass').value,
comment: this.assetProfileForm.get('comment').value || null,
tags: this.assetProfileForm.get('tags').value,
tagsDisconnected: this.assetProfileForm.get('tagsDisconnected').value,
currency: this.assetProfileForm.get('currency').value,
name: this.assetProfileForm.get('name').value,
url: this.assetProfileForm.get('url').value
@ -404,6 +407,10 @@ export class AssetProfileDialog implements OnDestroy, OnInit {
return id !== aTag.id;
})
);
this.assetProfileForm.controls['tagsDisconnected'].setValue([
...(this.assetProfileForm.controls['tagsDisconnected'].value ?? []),
aTag
]);
this.assetProfileForm.markAsDirty();
}

10
apps/client/src/app/components/header/header.component.ts

@ -176,15 +176,19 @@ export class HeaderComponent implements OnChanges {
for (const filter of filters) {
if (filter.type === 'ACCOUNT') {
userSetting['filters.accounts'] = filter.id ? [filter.id] : null;
userSetting['filters.accounts'] = filter.id?.length
? [filter.id]
: null;
} else if (filter.type === 'ASSET_CLASS') {
userSetting['filters.assetClasses'] = filter.id ? [filter.id] : null;
userSetting['filters.assetClasses'] = filter.id?.length
? [filter.id]
: null;
} else if (filter.type === 'DATA_SOURCE') {
userSetting['filters.dataSource'] = filter.id ? filter.id : null;
} else if (filter.type === 'SYMBOL') {
userSetting['filters.symbol'] = filter.id ? filter.id : null;
} else if (filter.type === 'TAG') {
userSetting['filters.tags'] = filter.id ? [filter.id] : null;
userSetting['filters.tags'] = filter.id?.length ? [filter.id] : null;
}
}

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

@ -245,6 +245,7 @@ export class AdminService {
symbol,
symbolMapping,
tags,
tagsDisconnected,
url
}: AssetProfileIdentifier & UpdateAssetProfileDto) {
return this.http.patch<EnhancedSymbolProfile>(
@ -260,6 +261,7 @@ export class AdminService {
sectors,
symbolMapping,
tags,
tagsDisconnected,
url
}
);

Loading…
Cancel
Save