csehatt741 1 day ago
committed by GitHub
parent
commit
27b0774e53
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 1
      CHANGELOG.md
  2. 5
      apps/api/src/app/admin/admin.service.ts
  3. 8
      apps/api/src/app/endpoints/ai/ai.service.ts
  4. 4
      apps/api/src/app/endpoints/data-providers/ghostfolio/ghostfolio.service.ts
  5. 20
      apps/api/src/app/info/info.service.ts
  6. 3
      apps/api/src/app/subscription/subscription.controller.ts
  7. 6
      apps/api/src/app/subscription/subscription.service.ts
  8. 11
      apps/api/src/app/user/user.service.ts
  9. 12
      apps/api/src/services/benchmark/benchmark.service.ts
  10. 8
      apps/api/src/services/data-provider/data-provider.service.ts
  11. 4
      apps/api/src/services/data-provider/ghostfolio/ghostfolio.service.ts
  12. 8
      apps/api/src/services/demo/demo.service.ts
  13. 5
      apps/api/src/services/exchange-rate-data/exchange-rate-data.service.ts
  14. 7
      apps/api/src/services/property/property.service.ts
  15. 4
      apps/api/src/services/queues/data-gathering/data-gathering.service.ts

1
CHANGELOG.md

@ -19,6 +19,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Enhanced the sitemap to dynamically compose public routes - Enhanced the sitemap to dynamically compose public routes
- Renamed `Account` to `account` in the `Order` database schema - Renamed `Account` to `account` in the `Order` database schema
- Improved the language localization for German (`de`) - Improved the language localization for German (`de`)
- Improved `PropertyService` by making `getByKey()` function generic
## 2.175.0 - 2025-06-28 ## 2.175.0 - 2025-06-28

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

@ -114,9 +114,8 @@ export class AdminService {
await this.marketDataService.deleteMany({ dataSource, symbol }); await this.marketDataService.deleteMany({ dataSource, symbol });
const currency = getCurrencyFromSymbol(symbol); const currency = getCurrencyFromSymbol(symbol);
const customCurrencies = (await this.propertyService.getByKey( const customCurrencies =
PROPERTY_CURRENCIES await this.propertyService.getByKey<string[]>(PROPERTY_CURRENCIES);
)) as string[];
if (customCurrencies.includes(currency)) { if (customCurrencies.includes(currency)) {
const updatedCustomCurrencies = customCurrencies.filter( const updatedCustomCurrencies = customCurrencies.filter(

8
apps/api/src/app/endpoints/ai/ai.service.ts

@ -19,13 +19,13 @@ export class AiService {
) {} ) {}
public async generateText({ prompt }: { prompt: string }) { public async generateText({ prompt }: { prompt: string }) {
const openRouterApiKey = (await this.propertyService.getByKey( const openRouterApiKey = await this.propertyService.getByKey<string>(
PROPERTY_API_KEY_OPENROUTER PROPERTY_API_KEY_OPENROUTER
)) as string; );
const openRouterModel = (await this.propertyService.getByKey( const openRouterModel = await this.propertyService.getByKey<string>(
PROPERTY_OPENROUTER_MODEL PROPERTY_OPENROUTER_MODEL
)) as string; );
const openRouterService = createOpenRouter({ const openRouterService = createOpenRouter({
apiKey: openRouterApiKey apiKey: openRouterApiKey

4
apps/api/src/app/endpoints/data-providers/ghostfolio/ghostfolio.service.ts

@ -164,9 +164,9 @@ export class GhostfolioService {
public async getMaxDailyRequests() { public async getMaxDailyRequests() {
return parseInt( return parseInt(
((await this.propertyService.getByKey( (await this.propertyService.getByKey<string>(
PROPERTY_DATA_SOURCES_GHOSTFOLIO_DATA_PROVIDER_MAX_REQUESTS PROPERTY_DATA_SOURCES_GHOSTFOLIO_DATA_PROVIDER_MAX_REQUESTS
)) as string) || '0', )) || '0',
10 10
); );
} }

20
apps/api/src/app/info/info.service.ts

@ -64,9 +64,9 @@ export class InfoService {
} }
if (this.configurationService.get('ENABLE_FEATURE_READ_ONLY_MODE')) { if (this.configurationService.get('ENABLE_FEATURE_READ_ONLY_MODE')) {
isReadOnlyMode = (await this.propertyService.getByKey( isReadOnlyMode = await this.propertyService.getByKey<boolean>(
PROPERTY_IS_READ_ONLY_MODE PROPERTY_IS_READ_ONLY_MODE
)) as boolean; );
} }
if (this.configurationService.get('ENABLE_FEATURE_SOCIAL_LOGIN')) { if (this.configurationService.get('ENABLE_FEATURE_SOCIAL_LOGIN')) {
@ -81,9 +81,9 @@ export class InfoService {
globalPermissions.push(permissions.enableSubscription); globalPermissions.push(permissions.enableSubscription);
info.countriesOfSubscribers = info.countriesOfSubscribers =
((await this.propertyService.getByKey( (await this.propertyService.getByKey<string[]>(
PROPERTY_COUNTRIES_OF_SUBSCRIBERS PROPERTY_COUNTRIES_OF_SUBSCRIBERS
)) as string[]) ?? []; )) ?? [];
info.stripePublicKey = this.configurationService.get('STRIPE_PUBLIC_KEY'); info.stripePublicKey = this.configurationService.get('STRIPE_PUBLIC_KEY');
} }
@ -230,15 +230,15 @@ export class InfoService {
} }
private async countSlackCommunityUsers() { private async countSlackCommunityUsers() {
return (await this.propertyService.getByKey( return await this.propertyService.getByKey<string>(
PROPERTY_SLACK_COMMUNITY_USERS PROPERTY_SLACK_COMMUNITY_USERS
)) as string; );
} }
private async getDemoAuthToken() { private async getDemoAuthToken() {
const demoUserId = (await this.propertyService.getByKey( const demoUserId = await this.propertyService.getByKey<string>(
PROPERTY_DEMO_USER_ID PROPERTY_DEMO_USER_ID
)) as string; );
if (demoUserId) { if (demoUserId) {
return this.jwtService.sign({ return this.jwtService.sign({
@ -298,9 +298,9 @@ export class InfoService {
private async getUptime(): Promise<number> { private async getUptime(): Promise<number> {
{ {
try { try {
const monitorId = (await this.propertyService.getByKey( const monitorId = await this.propertyService.getByKey<string>(
PROPERTY_BETTER_UPTIME_MONITOR_ID PROPERTY_BETTER_UPTIME_MONITOR_ID
)) as string; );
const { data } = await fetch( const { data } = await fetch(
`https://uptime.betterstack.com/api/v2/monitors/${monitorId}/sla?from=${format( `https://uptime.betterstack.com/api/v2/monitors/${monitorId}/sla?from=${format(

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

@ -49,8 +49,7 @@ export class SubscriptionController {
} }
let coupons = let coupons =
((await this.propertyService.getByKey(PROPERTY_COUPONS)) as Coupon[]) ?? (await this.propertyService.getByKey<Coupon[]>(PROPERTY_COUPONS)) ?? [];
[];
const coupon = coupons.find((currentCoupon) => { const coupon = coupons.find((currentCoupon) => {
return currentCoupon.code === couponCode; return currentCoupon.code === couponCode;

6
apps/api/src/app/subscription/subscription.service.ts

@ -50,8 +50,7 @@ export class SubscriptionService {
const subscriptionOffers: { const subscriptionOffers: {
[offer in SubscriptionOfferKey]: SubscriptionOffer; [offer in SubscriptionOfferKey]: SubscriptionOffer;
} = } =
((await this.propertyService.getByKey(PROPERTY_STRIPE_CONFIG)) as any) ?? (await this.propertyService.getByKey<any>(PROPERTY_STRIPE_CONFIG)) ?? {};
{};
const subscriptionOffer = Object.values(subscriptionOffers).find( const subscriptionOffer = Object.values(subscriptionOffers).find(
(subscriptionOffer) => { (subscriptionOffer) => {
@ -213,8 +212,7 @@ export class SubscriptionService {
const offers: { const offers: {
[offer in SubscriptionOfferKey]: SubscriptionOffer; [offer in SubscriptionOfferKey]: SubscriptionOffer;
} = } =
((await this.propertyService.getByKey(PROPERTY_STRIPE_CONFIG)) as any) ?? (await this.propertyService.getByKey<any>(PROPERTY_STRIPE_CONFIG)) ?? {};
{};
return { return {
...offers[key], ...offers[key],

11
apps/api/src/app/user/user.service.ts

@ -125,9 +125,10 @@ export class UserService {
let systemMessage: SystemMessage; let systemMessage: SystemMessage;
const systemMessageProperty = (await this.propertyService.getByKey( const systemMessageProperty =
PROPERTY_SYSTEM_MESSAGE await this.propertyService.getByKey<SystemMessage>(
)) as SystemMessage; PROPERTY_SYSTEM_MESSAGE
);
if (systemMessageProperty?.targetGroups?.includes(subscription?.type)) { if (systemMessageProperty?.targetGroups?.includes(subscription?.type)) {
systemMessage = systemMessageProperty; systemMessage = systemMessageProperty;
@ -443,9 +444,9 @@ export class UserService {
currentPermissions.push(permissions.toggleReadOnlyMode); currentPermissions.push(permissions.toggleReadOnlyMode);
} }
const isReadOnlyMode = (await this.propertyService.getByKey( const isReadOnlyMode = await this.propertyService.getByKey<boolean>(
PROPERTY_IS_READ_ONLY_MODE PROPERTY_IS_READ_ONLY_MODE
)) as boolean; );
if (isReadOnlyMode) { if (isReadOnlyMode) {
currentPermissions = currentPermissions.filter((permission) => { currentPermissions = currentPermissions.filter((permission) => {

12
apps/api/src/services/benchmark/benchmark.service.ts

@ -106,9 +106,9 @@ export class BenchmarkService {
enableSharing = false enableSharing = false
} = {}): Promise<Partial<SymbolProfile>[]> { } = {}): Promise<Partial<SymbolProfile>[]> {
const symbolProfileIds: string[] = ( const symbolProfileIds: string[] = (
((await this.propertyService.getByKey( (await this.propertyService.getByKey<BenchmarkProperty[]>(
PROPERTY_BENCHMARKS PROPERTY_BENCHMARKS
)) as BenchmarkProperty[]) ?? [] )) ?? []
) )
.filter((benchmark) => { .filter((benchmark) => {
if (enableSharing) { if (enableSharing) {
@ -154,9 +154,9 @@ export class BenchmarkService {
} }
let benchmarks = let benchmarks =
((await this.propertyService.getByKey( (await this.propertyService.getByKey<BenchmarkProperty[]>(
PROPERTY_BENCHMARKS PROPERTY_BENCHMARKS
)) as BenchmarkProperty[]) ?? []; )) ?? [];
benchmarks.push({ symbolProfileId: assetProfile.id }); benchmarks.push({ symbolProfileId: assetProfile.id });
@ -191,9 +191,9 @@ export class BenchmarkService {
} }
let benchmarks = let benchmarks =
((await this.propertyService.getByKey( (await this.propertyService.getByKey<BenchmarkProperty[]>(
PROPERTY_BENCHMARKS PROPERTY_BENCHMARKS
)) as BenchmarkProperty[]) ?? []; )) ?? [];
benchmarks = benchmarks.filter(({ symbolProfileId }) => { benchmarks = benchmarks.filter(({ symbolProfileId }) => {
return symbolProfileId !== assetProfile.id; return symbolProfileId !== assetProfile.id;

8
apps/api/src/services/data-provider/data-provider.service.ts

@ -52,9 +52,9 @@ export class DataProviderService implements OnModuleInit {
public async onModuleInit() { public async onModuleInit() {
this.dataProviderMapping = this.dataProviderMapping =
((await this.propertyService.getByKey(PROPERTY_DATA_SOURCE_MAPPING)) as { (await this.propertyService.getByKey<{
[dataProviderName: string]: string; [dataProviderName: string]: string;
}) ?? {}; }>(PROPERTY_DATA_SOURCE_MAPPING)) ?? {};
} }
public async checkQuote(dataSource: DataSource) { public async checkQuote(dataSource: DataSource) {
@ -183,9 +183,9 @@ export class DataProviderService implements OnModuleInit {
return DataSource[dataSource]; return DataSource[dataSource];
}); });
const ghostfolioApiKey = (await this.propertyService.getByKey( const ghostfolioApiKey = await this.propertyService.getByKey<string>(
PROPERTY_API_KEY_GHOSTFOLIO PROPERTY_API_KEY_GHOSTFOLIO
)) as string; );
if (includeGhostfolio || ghostfolioApiKey) { if (includeGhostfolio || ghostfolioApiKey) {
dataSources.push('GHOSTFOLIO'); dataSources.push('GHOSTFOLIO');

4
apps/api/src/services/data-provider/ghostfolio/ghostfolio.service.ts

@ -295,9 +295,9 @@ export class GhostfolioService implements DataProviderInterface {
} }
private async getRequestHeaders() { private async getRequestHeaders() {
const apiKey = (await this.propertyService.getByKey( const apiKey = await this.propertyService.getByKey<string>(
PROPERTY_API_KEY_GHOSTFOLIO PROPERTY_API_KEY_GHOSTFOLIO
)) as string; );
return { return {
[HEADER_KEY_TOKEN]: `Api-Key ${apiKey}` [HEADER_KEY_TOKEN]: `Api-Key ${apiKey}`

8
apps/api/src/services/demo/demo.service.ts

@ -17,10 +17,10 @@ export class DemoService {
) {} ) {}
public async syncDemoUserAccount() { public async syncDemoUserAccount() {
const [demoAccountId, demoUserId] = (await Promise.all([ const [demoAccountId, demoUserId] = await Promise.all([
this.propertyService.getByKey(PROPERTY_DEMO_ACCOUNT_ID), this.propertyService.getByKey<string>(PROPERTY_DEMO_ACCOUNT_ID),
this.propertyService.getByKey(PROPERTY_DEMO_USER_ID) this.propertyService.getByKey<string>(PROPERTY_DEMO_USER_ID)
])) as [string, string]; ]);
let activities = await this.prismaService.order.findMany({ let activities = await this.prismaService.order.findMany({
orderBy: { orderBy: {

5
apps/api/src/services/exchange-rate-data/exchange-rate-data.service.ts

@ -497,9 +497,8 @@ export class ExchangeRateDataService {
currencies.push(currency); currencies.push(currency);
}); });
const customCurrencies = (await this.propertyService.getByKey( const customCurrencies =
PROPERTY_CURRENCIES await this.propertyService.getByKey<string[]>(PROPERTY_CURRENCIES);
)) as string[];
if (customCurrencies?.length > 0) { if (customCurrencies?.length > 0) {
currencies = currencies.concat(customCurrencies); currencies = currencies.concat(customCurrencies);

7
apps/api/src/services/property/property.service.ts

@ -38,15 +38,14 @@ export class PropertyService {
return response; return response;
} }
public async getByKey(aKey: string) { public async getByKey<TKey>(aKey: string): Promise<TKey | undefined> {
const properties = await this.get(); const properties = await this.get();
return properties?.[aKey]; return properties?.[aKey] as TKey;
} }
public async isUserSignupEnabled() { public async isUserSignupEnabled() {
return ( return (
((await this.getByKey(PROPERTY_IS_USER_SIGNUP_ENABLED)) as boolean) ?? (await this.getByKey<boolean>(PROPERTY_IS_USER_SIGNUP_ENABLED)) ?? true
true
); );
} }

4
apps/api/src/services/queues/data-gathering/data-gathering.service.ts

@ -406,9 +406,9 @@ export class DataGatheringService {
private async getSymbolsMax(): Promise<IDataGatheringItem[]> { private async getSymbolsMax(): Promise<IDataGatheringItem[]> {
const benchmarkAssetProfileIdMap: { [key: string]: boolean } = {}; const benchmarkAssetProfileIdMap: { [key: string]: boolean } = {};
( (
((await this.propertyService.getByKey( (await this.propertyService.getByKey<BenchmarkProperty[]>(
PROPERTY_BENCHMARKS PROPERTY_BENCHMARKS
)) as BenchmarkProperty[]) ?? [] )) ?? []
).forEach(({ symbolProfileId }) => { ).forEach(({ symbolProfileId }) => {
benchmarkAssetProfileIdMap[symbolProfileId] = true; benchmarkAssetProfileIdMap[symbolProfileId] = true;
}); });

Loading…
Cancel
Save