Browse Source

Merge branch 'main' into feature/upgrade-ngx-skeleton-loader-to-version-7.0.0

pull/1758/head
Thomas Kaul 3 years ago
committed by GitHub
parent
commit
6032223233
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 10
      CHANGELOG.md
  2. 2
      apps/api/src/app/subscription/subscription.controller.ts
  3. 19
      apps/api/src/app/subscription/subscription.service.ts
  4. 8
      apps/api/src/services/data-provider/manual/manual.service.ts
  5. 8
      package.json
  6. 30
      yarn.lock

10
CHANGELOG.md

@ -10,6 +10,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed ### Changed
- Upgraded `ngx-skeleton-loader` from version `5.0.0` to `7.0.0` - Upgraded `ngx-skeleton-loader` from version `5.0.0` to `7.0.0`
## 1.241.0 - 2023-03-01
### Changed
- Filtered activities with type `ITEM` from search results
- Considered the user's language in the _Stripe_ checkout
- Upgraded the _Stripe_ dependencies
- Upgraded `twitter-api-v2` from version `1.10.3` to `1.14.2` - Upgraded `twitter-api-v2` from version `1.10.3` to `1.14.2`
## 1.240.0 - 2023-02-26 ## 1.240.0 - 2023-02-26
@ -1846,7 +1854,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed ### Changed
- Extended the historical data view in the admin control panel - Extended the historical data view in the admin control panel
- Upgraded _Stripe_ dependencies - Upgraded the _Stripe_ dependencies
- Upgraded `prisma` from version `3.7.0` to `3.8.1` - Upgraded `prisma` from version `3.7.0` to `3.8.1`
### Fixed ### Fixed

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

@ -117,7 +117,7 @@ export class SubscriptionController {
return await this.subscriptionService.createCheckoutSession({ return await this.subscriptionService.createCheckoutSession({
couponId, couponId,
priceId, priceId,
userId: this.request.user.id user: this.request.user
}); });
} catch (error) { } catch (error) {
Logger.error(error, 'SubscriptionController'); Logger.error(error, 'SubscriptionController');

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

@ -4,6 +4,7 @@ import {
DEFAULT_LANGUAGE_CODE, DEFAULT_LANGUAGE_CODE,
PROPERTY_STRIPE_CONFIG PROPERTY_STRIPE_CONFIG
} from '@ghostfolio/common/config'; } from '@ghostfolio/common/config';
import { UserWithSettings } from '@ghostfolio/common/interfaces';
import { Subscription as SubscriptionInterface } from '@ghostfolio/common/interfaces/subscription.interface'; import { Subscription as SubscriptionInterface } from '@ghostfolio/common/interfaces/subscription.interface';
import { SubscriptionType } from '@ghostfolio/common/types/subscription.type'; import { SubscriptionType } from '@ghostfolio/common/types/subscription.type';
import { Injectable, Logger } from '@nestjs/common'; import { Injectable, Logger } from '@nestjs/common';
@ -23,7 +24,7 @@ export class SubscriptionService {
this.stripe = new Stripe( this.stripe = new Stripe(
this.configurationService.get('STRIPE_SECRET_KEY'), this.configurationService.get('STRIPE_SECRET_KEY'),
{ {
apiVersion: '2020-08-27' apiVersion: '2022-11-15'
} }
); );
} }
@ -31,17 +32,17 @@ export class SubscriptionService {
public async createCheckoutSession({ public async createCheckoutSession({
couponId, couponId,
priceId, priceId,
userId user
}: { }: {
couponId?: string; couponId?: string;
priceId: string; priceId: string;
userId: string; user: UserWithSettings;
}) { }) {
const checkoutSessionCreateParams: Stripe.Checkout.SessionCreateParams = { const checkoutSessionCreateParams: Stripe.Checkout.SessionCreateParams = {
cancel_url: `${this.configurationService.get( cancel_url: `${this.configurationService.get('ROOT_URL')}/${
'ROOT_URL' user.Settings?.settings?.language ?? DEFAULT_LANGUAGE_CODE
)}/${DEFAULT_LANGUAGE_CODE}/account`, }/account`,
client_reference_id: userId, client_reference_id: user.id,
line_items: [ line_items: [
{ {
price: priceId, price: priceId,
@ -116,10 +117,6 @@ export class SubscriptionService {
userId: session.client_reference_id userId: session.client_reference_id
}); });
await this.stripe.customers.update(session.customer as string, {
description: session.client_reference_id
});
return session.client_reference_id; return session.client_reference_id;
} catch (error) { } catch (error) {
Logger.error(error, 'SubscriptionService'); Logger.error(error, 'SubscriptionService');

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

@ -16,6 +16,7 @@ import { Injectable, Logger } from '@nestjs/common';
import { DataSource, SymbolProfile } from '@prisma/client'; import { DataSource, SymbolProfile } from '@prisma/client';
import bent from 'bent'; import bent from 'bent';
import * as cheerio from 'cheerio'; import * as cheerio from 'cheerio';
import { isUUID } from 'class-validator';
import { addDays, format, isBefore } from 'date-fns'; import { addDays, format, isBefore } from 'date-fns';
@Injectable() @Injectable()
@ -162,7 +163,7 @@ export class ManualService implements DataProviderInterface {
} }
public async search(aQuery: string): Promise<{ items: LookupItem[] }> { public async search(aQuery: string): Promise<{ items: LookupItem[] }> {
const items = await this.prismaService.symbolProfile.findMany({ let items = await this.prismaService.symbolProfile.findMany({
select: { select: {
currency: true, currency: true,
dataSource: true, dataSource: true,
@ -189,6 +190,11 @@ export class ManualService implements DataProviderInterface {
} }
}); });
items = items.filter(({ symbol }) => {
// Remove UUID symbols (activities of type ITEM)
return !isUUID(symbol);
});
return { items }; return { items };
} }
} }

8
package.json

@ -1,6 +1,6 @@
{ {
"name": "ghostfolio", "name": "ghostfolio",
"version": "1.240.0", "version": "1.241.0",
"homepage": "https://ghostfol.io", "homepage": "https://ghostfol.io",
"license": "AGPL-3.0", "license": "AGPL-3.0",
"scripts": { "scripts": {
@ -83,7 +83,7 @@
"@prisma/client": "4.10.1", "@prisma/client": "4.10.1",
"@simplewebauthn/browser": "5.2.1", "@simplewebauthn/browser": "5.2.1",
"@simplewebauthn/server": "5.2.1", "@simplewebauthn/server": "5.2.1",
"@stripe/stripe-js": "1.22.0", "@stripe/stripe-js": "1.47.0",
"alphavantage": "2.2.0", "alphavantage": "2.2.0",
"bent": "7.3.12", "bent": "7.3.12",
"big.js": "6.2.1", "big.js": "6.2.1",
@ -114,7 +114,7 @@
"ngx-device-detector": "3.0.0", "ngx-device-detector": "3.0.0",
"ngx-markdown": "15.1.0", "ngx-markdown": "15.1.0",
"ngx-skeleton-loader": "7.0.0", "ngx-skeleton-loader": "7.0.0",
"ngx-stripe": "13.0.0", "ngx-stripe": "15.5.0",
"papaparse": "5.3.1", "papaparse": "5.3.1",
"passport": "0.6.0", "passport": "0.6.0",
"passport-google-oauth20": "2.0.0", "passport-google-oauth20": "2.0.0",
@ -122,7 +122,7 @@
"prisma": "4.10.1", "prisma": "4.10.1",
"reflect-metadata": "0.1.13", "reflect-metadata": "0.1.13",
"rxjs": "7.5.6", "rxjs": "7.5.6",
"stripe": "8.199.0", "stripe": "11.12.0",
"svgmap": "2.6.0", "svgmap": "2.6.0",
"twitter-api-v2": "1.14.2", "twitter-api-v2": "1.14.2",
"uuid": "9.0.0", "uuid": "9.0.0",

30
yarn.lock

@ -5859,10 +5859,10 @@
regenerator-runtime "^0.13.7" regenerator-runtime "^0.13.7"
resolve-from "^5.0.0" resolve-from "^5.0.0"
"@stripe/stripe-js@1.22.0": "@stripe/stripe-js@1.47.0":
version "1.22.0" version "1.47.0"
resolved "https://registry.npmjs.org/@stripe/stripe-js/-/stripe-js-1.22.0.tgz" resolved "https://registry.yarnpkg.com/@stripe/stripe-js/-/stripe-js-1.47.0.tgz#48626a2e43302330aa826ce498a2d9761db4053d"
integrity sha512-fm8TR8r4LwbXgBIYdPmeMjJJkxxFC66tvoliNnmXOpUgZSgQKoNPW3ON0ZphZIiif1oqWNhAaSrr7tOvGu+AFg== integrity sha512-jKSClqEIKS2MbPCXlSsseDSZyJ3dVrfUrYMz5LBY1o9iS2tfKbpTZACt8r2g+xyQozI+uHr76pVTyFsmBKA4Mg==
"@tootallnate/once@2": "@tootallnate/once@2":
version "2.0.0" version "2.0.0"
@ -16492,10 +16492,10 @@ ngx-skeleton-loader@7.0.0:
perf-marks "^1.13.4" perf-marks "^1.13.4"
tslib "^2.0.0" tslib "^2.0.0"
ngx-stripe@13.0.0: ngx-stripe@15.5.0:
version "13.0.0" version "15.5.0"
resolved "https://registry.npmjs.org/ngx-stripe/-/ngx-stripe-13.0.0.tgz" resolved "https://registry.yarnpkg.com/ngx-stripe/-/ngx-stripe-15.5.0.tgz#b05fc1cf9f55bb5e7f307ac5cfdf29807a2f48a9"
integrity sha512-SImKvoC/mZZrtzh2UUmxFdkqMLKX2y+BtcvMAPdHD4D7miXWEjCTZeXt8h85mcfy7y1NKKwIipH4CSr9eBzZ4w== integrity sha512-Ut3JANfxSzl/4qy+pokHOXGVITgNSlSMv7XGN2Y4tPDk6BVUD9SSl/3VuXW9UdbKAmX0XS68nRACiKCOSet5zw==
dependencies: dependencies:
tslib "^2.3.0" tslib "^2.3.0"
@ -18268,14 +18268,14 @@ qs@6.10.3:
dependencies: dependencies:
side-channel "^1.0.4" side-channel "^1.0.4"
qs@6.11.0: qs@6.11.0, qs@^6.11.0:
version "6.11.0" version "6.11.0"
resolved "https://registry.yarnpkg.com/qs/-/qs-6.11.0.tgz#fd0d963446f7a65e1367e01abd85429453f0c37a" resolved "https://registry.yarnpkg.com/qs/-/qs-6.11.0.tgz#fd0d963446f7a65e1367e01abd85429453f0c37a"
integrity sha512-MvjoMCJwEarSbUYk5O+nmoSzSutSsTwF85zcHPQ9OrlFoZOYIjaqBAJIqIXjptyD5vThxGq52Xu/MaJzRkIk4Q== integrity sha512-MvjoMCJwEarSbUYk5O+nmoSzSutSsTwF85zcHPQ9OrlFoZOYIjaqBAJIqIXjptyD5vThxGq52Xu/MaJzRkIk4Q==
dependencies: dependencies:
side-channel "^1.0.4" side-channel "^1.0.4"
qs@^6.10.0, qs@^6.4.0, qs@^6.6.0: qs@^6.10.0, qs@^6.4.0:
version "6.10.5" version "6.10.5"
resolved "https://registry.npmjs.org/qs/-/qs-6.10.5.tgz" resolved "https://registry.npmjs.org/qs/-/qs-6.10.5.tgz"
integrity sha512-O5RlPh0VFtR78y79rgcgKK4wbAI0C5zGVLztOIdpWX6ep368q5Hv6XRxDvXuZ9q3C6v+e3n8UfZZJw7IIG27eQ== integrity sha512-O5RlPh0VFtR78y79rgcgKK4wbAI0C5zGVLztOIdpWX6ep368q5Hv6XRxDvXuZ9q3C6v+e3n8UfZZJw7IIG27eQ==
@ -20016,13 +20016,13 @@ strip-json-comments@^3.1.0, strip-json-comments@^3.1.1:
resolved "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz" resolved "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz"
integrity sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig== integrity sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==
stripe@8.199.0: stripe@11.12.0:
version "8.199.0" version "11.12.0"
resolved "https://registry.npmjs.org/stripe/-/stripe-8.199.0.tgz" resolved "https://registry.yarnpkg.com/stripe/-/stripe-11.12.0.tgz#2d7d4c37a6447a972128b1266e027693241704e3"
integrity sha512-Bc5Zfp6eOOCdde9x5NPrAczeGSKuNwemzjsfGJXWtpbUfQXgJujzTGgkhx2YuzamqakDYJkTgf9w7Ry2uY8QNA== integrity sha512-7yzFyVV/eYpYalfjnw1f9sh/N3r5QVdx5MFtmpOg2QikKVAW4AptXC8P0wj1KNCd/LIo23nTDo0+m9788jHswg==
dependencies: dependencies:
"@types/node" ">=8.1.0" "@types/node" ">=8.1.0"
qs "^6.6.0" qs "^6.11.0"
strong-log-transformer@^2.1.0: strong-log-transformer@^2.1.0:
version "2.1.0" version "2.1.0"

Loading…
Cancel
Save