Feature/respect watcher count in delete asset profile checkbox (#4609)

* Respect watchedByCount in delete asset profile checkbox

* Update changelog
This commit is contained in:
Thomas Kaul 2025-04-27 09:46:25 +02:00 committed by GitHub
parent 07fa345457
commit 862de91e7b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 21 additions and 7 deletions

View File

@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Improved the error message of the currency code validation - Improved the error message of the currency code validation
- Tightened the currency code validation by requiring uppercase letters - Tightened the currency code validation by requiring uppercase letters
- Respected the watcher count for the delete asset profiles checkbox in the historical market data table of the admin control panel
- Improved the language localization for Français (`fr`) - Improved the language localization for Français (`fr`)
- Upgraded `ngx-skeleton-loader` from version `10.0.0` to `11.0.0` - Upgraded `ngx-skeleton-loader` from version `10.0.0` to `11.0.0`
- Upgraded `Nx` from version `20.8.0` to `20.8.1` - Upgraded `Nx` from version `20.8.0` to `20.8.1`

View File

@ -238,7 +238,10 @@ export class AdminService {
where, where,
select: { select: {
_count: { _count: {
select: { Order: true } select: {
Order: true,
watchedBy: true
}
}, },
assetClass: true, assetClass: true,
assetSubClass: true, assetSubClass: true,
@ -375,7 +378,9 @@ export class AdminService {
sectorsCount, sectorsCount,
activitiesCount: _count.Order, activitiesCount: _count.Order,
date: Order?.[0]?.date, date: Order?.[0]?.date,
isUsedByUsersWithSubscription: await isUsedByUsersWithSubscription isUsedByUsersWithSubscription:
await isUsedByUsersWithSubscription,
watchedByCount: _count.watchedBy
}; };
} }
) )
@ -752,7 +757,8 @@ export class AdminService {
id: undefined, id: undefined,
isActive: true, isActive: true,
name: symbol, name: symbol,
sectorsCount: 0 sectorsCount: 0,
watchedByCount: 0
}; };
} }
); );

View File

@ -55,7 +55,8 @@
adminMarketDataService.hasPermissionToDeleteAssetProfile({ adminMarketDataService.hasPermissionToDeleteAssetProfile({
activitiesCount: element.activitiesCount, activitiesCount: element.activitiesCount,
isBenchmark: element.isBenchmark, isBenchmark: element.isBenchmark,
symbol: element.symbol symbol: element.symbol,
watchedByCount: element.watchedByCount
}) })
) { ) {
<mat-checkbox <mat-checkbox

View File

@ -72,14 +72,19 @@ export class AdminMarketDataService {
public hasPermissionToDeleteAssetProfile({ public hasPermissionToDeleteAssetProfile({
activitiesCount, activitiesCount,
isBenchmark, isBenchmark,
symbol symbol,
}: Pick<AdminMarketDataItem, 'activitiesCount' | 'isBenchmark' | 'symbol'>) { watchedByCount
}: Pick<
AdminMarketDataItem,
'activitiesCount' | 'isBenchmark' | 'symbol' | 'watchedByCount'
>) {
return ( return (
activitiesCount === 0 && activitiesCount === 0 &&
!isBenchmark && !isBenchmark &&
!isDerivedCurrency(getCurrencyFromSymbol(symbol)) && !isDerivedCurrency(getCurrencyFromSymbol(symbol)) &&
!isRootCurrency(getCurrencyFromSymbol(symbol)) && !isRootCurrency(getCurrencyFromSymbol(symbol)) &&
!symbol.startsWith(ghostfolioScraperApiSymbolPrefix) !symbol.startsWith(ghostfolioScraperApiSymbolPrefix) &&
watchedByCount === 0
); );
} }
} }

View File

@ -22,4 +22,5 @@ export interface AdminMarketDataItem {
name: string; name: string;
sectorsCount: number; sectorsCount: number;
symbol: string; symbol: string;
watchedByCount: number;
} }