Skip to content

Open Source Wealth Management Software. Angular + NestJS + Prisma + Nx + TypeScript 🤍

Feature/add prefix to coupon codes (#1562)

Thomas Kaul8818e09be8ff
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 939f5ea5dc..134f7d4312 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 f629b620dd..e528e748b9 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 7b34aaf336..5c85292312 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`;