Browse Source

Merge branch 'main' into feature/set-lastmod-dates-of-sitemap.xml-dynamically

pull/2170/head
Thomas Kaul 2 years ago
committed by GitHub
parent
commit
14742f4ccc
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      CHANGELOG.md
  2. 7
      apps/api/src/app/redis-cache/interfaces/redis-cache.interface.ts
  3. 8
      apps/api/src/app/redis-cache/interfaces/redis-store.interface.ts
  4. 15
      apps/api/src/app/redis-cache/redis-cache.service.ts
  5. 4
      libs/ui/src/lib/holdings-table/holdings-table.component.html
  6. 2
      libs/ui/src/lib/holdings-table/holdings-table.component.ts

8
CHANGELOG.md

@ -7,10 +7,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## Unreleased
### Added
- Added error handling for the _Redis_ connections to keep the app running if the connection fails
### Changed
- Set the `lastmod` dates of `sitemap.xml` dynamically
### Fixed
- Fixed the missing values in the holdings table
## 1.292.0 - 2023-07-24
### Added

7
apps/api/src/app/redis-cache/interfaces/redis-cache.interface.ts

@ -0,0 +1,7 @@
import { Cache } from 'cache-manager';
import type { RedisStore } from './redis-store.interface';
export interface RedisCache extends Cache {
store: RedisStore;
}

8
apps/api/src/app/redis-cache/interfaces/redis-store.interface.ts

@ -0,0 +1,8 @@
import { Store } from 'cache-manager';
import { RedisClient } from 'redis';
export interface RedisStore extends Store {
getClient: () => RedisClient;
isCacheableValue: (value: any) => boolean;
name: 'redis';
}

15
apps/api/src/app/redis-cache/redis-cache.service.ts

@ -1,14 +1,21 @@
import { ConfigurationService } from '@ghostfolio/api/services/configuration/configuration.service';
import { UniqueAsset } from '@ghostfolio/common/interfaces';
import { CACHE_MANAGER, Inject, Injectable } from '@nestjs/common';
import { Cache } from 'cache-manager';
import { CACHE_MANAGER, Inject, Injectable, Logger } from '@nestjs/common';
import type { RedisCache } from './interfaces/redis-cache.interface';
@Injectable()
export class RedisCacheService {
public constructor(
@Inject(CACHE_MANAGER) private readonly cache: Cache,
@Inject(CACHE_MANAGER) private readonly cache: RedisCache,
private readonly configurationService: ConfigurationService
) {}
) {
const client = cache.store.getClient();
client.on('error', (error) => {
Logger.error(error, 'RedisCacheService');
});
}
public async get(key: string): Promise<string> {
return await this.cache.get(key);

4
libs/ui/src/lib/holdings-table/holdings-table.component.html

@ -61,7 +61,7 @@
</td>
</ng-container>
<ng-container matColumnDef="value">
<ng-container matColumnDef="valueInBaseCurrency">
<th
*matHeaderCellDef
class="d-none d-lg-table-cell justify-content-end px-1"
@ -79,7 +79,7 @@
<gf-value
[isCurrency]="true"
[locale]="locale"
[value]="isLoading ? undefined : element.value"
[value]="isLoading ? undefined : element.valueInBaseCurrency"
></gf-value>
</div>
</td>

2
libs/ui/src/lib/holdings-table/holdings-table.component.ts

@ -55,7 +55,7 @@ export class HoldingsTableComponent implements OnChanges, OnDestroy, OnInit {
this.displayedColumns = ['icon', 'nameWithSymbol', 'dateOfFirstActivity'];
if (this.hasPermissionToShowValues) {
this.displayedColumns.push('value');
this.displayedColumns.push('valueInBaseCurrency');
}
this.displayedColumns.push('allocationInPercentage');

Loading…
Cancel
Save