From 8818e09be8ffbe123c81fd17fc9938fe56d9761f Mon Sep 17 00:00:00 2001 From: Thomas Kaul <4159106+dtslvr@users.noreply.github.com> Date: Sat, 31 Dec 2022 17:06:15 +0100 Subject: [PATCH] Feature/add prefix to coupon codes (#1562) * Add prefix * Update changelog --- CHANGELOG.md | 6 ++++++ .../components/admin-overview/admin-overview.component.ts | 6 +++++- libs/common/src/lib/config.ts | 3 ++- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 939f5ea5d..134f7d431 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## Unreleased + +### Added + +- Added a prefix to the codes of the coupon system + ## 1.222.0 - 2022-12-29 ### Added diff --git a/apps/client/src/app/components/admin-overview/admin-overview.component.ts b/apps/client/src/app/components/admin-overview/admin-overview.component.ts index f629b620d..e528e748b 100644 --- a/apps/client/src/app/components/admin-overview/admin-overview.component.ts +++ b/apps/client/src/app/components/admin-overview/admin-overview.component.ts @@ -4,6 +4,7 @@ import { CacheService } from '@ghostfolio/client/services/cache.service'; import { DataService } from '@ghostfolio/client/services/data.service'; import { UserService } from '@ghostfolio/client/services/user/user.service'; import { + ghostfolioPrefix, PROPERTY_COUPONS, PROPERTY_CURRENCIES, PROPERTY_IS_READ_ONLY_MODE, @@ -97,7 +98,10 @@ export class AdminOverviewComponent implements OnDestroy, OnInit { public onAddCoupon() { const coupons = [ ...this.coupons, - { code: this.generateCouponCode(16), duration: this.couponDuration } + { + code: `${ghostfolioPrefix}${this.generateCouponCode(14)}`, + duration: this.couponDuration + } ]; this.putAdminSetting({ key: PROPERTY_COUPONS, value: coupons }); } diff --git a/libs/common/src/lib/config.ts b/libs/common/src/lib/config.ts index 7b34aaf33..5c8529231 100644 --- a/libs/common/src/lib/config.ts +++ b/libs/common/src/lib/config.ts @@ -4,7 +4,8 @@ import ms from 'ms'; export const DEMO_USER_ID = '9b112b4d-3b7d-4bad-9bdd-3b0f7b4dac2f'; -export const ghostfolioScraperApiSymbolPrefix = '_GF_'; +export const ghostfolioPrefix = 'GF'; +export const ghostfolioScraperApiSymbolPrefix = `_${ghostfolioPrefix}_`; export const ghostfolioCashSymbol = `${ghostfolioScraperApiSymbolPrefix}CASH`; export const ghostfolioFearAndGreedIndexDataSource = DataSource.RAPID_API; export const ghostfolioFearAndGreedIndexSymbol = `${ghostfolioScraperApiSymbolPrefix}FEAR_AND_GREED_INDEX`;