Feature/rename Subscription to subscriptions in user database schema (#4575)
* Rename Subscription to subscriptions * Update changelog
This commit is contained in:
parent
d6e0b499d9
commit
3091c3f080
@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
### Changed
|
||||
|
||||
- Made the historical market data editor expandable in the admin control panel
|
||||
- Renamed `Subscription` to `subscriptions` in the `User` database schema
|
||||
- Parallelized the requests in the get quotes functionality of the _Financial Modeling Prep_ service
|
||||
- Migrated the lookup functionality by `isin` of the _Financial Modeling Prep_ service to its stable API version
|
||||
|
||||
|
@ -645,7 +645,7 @@ export class AdminService {
|
||||
Order: {
|
||||
where: {
|
||||
User: {
|
||||
Subscription: {
|
||||
subscriptions: {
|
||||
some: {
|
||||
expiresAt: {
|
||||
gt: new Date()
|
||||
@ -806,7 +806,7 @@ export class AdminService {
|
||||
createdAt: true,
|
||||
id: true,
|
||||
role: true,
|
||||
Subscription: {
|
||||
subscriptions: {
|
||||
orderBy: {
|
||||
expiresAt: 'desc'
|
||||
},
|
||||
@ -821,7 +821,7 @@ export class AdminService {
|
||||
});
|
||||
|
||||
return usersWithAnalytics.map(
|
||||
({ _count, Analytics, createdAt, id, role, Subscription }) => {
|
||||
({ _count, Analytics, createdAt, id, role, subscriptions }) => {
|
||||
const daysSinceRegistration =
|
||||
differenceInDays(new Date(), createdAt) + 1;
|
||||
const engagement = Analytics
|
||||
@ -830,8 +830,8 @@ export class AdminService {
|
||||
|
||||
const subscription =
|
||||
this.configurationService.get('ENABLE_FEATURE_SUBSCRIPTION') &&
|
||||
Subscription?.length > 0
|
||||
? Subscription[0]
|
||||
subscriptions?.length > 0
|
||||
? subscriptions[0]
|
||||
: undefined;
|
||||
|
||||
return {
|
||||
|
@ -189,7 +189,7 @@ export class UserService {
|
||||
provider,
|
||||
role,
|
||||
Settings,
|
||||
Subscription,
|
||||
subscriptions,
|
||||
thirdPartyId,
|
||||
updatedAt
|
||||
} = await this.prismaService.user.findUnique({
|
||||
@ -200,7 +200,7 @@ export class UserService {
|
||||
},
|
||||
Analytics: true,
|
||||
Settings: true,
|
||||
Subscription: true
|
||||
subscriptions: true
|
||||
},
|
||||
where: userWhereUniqueInput
|
||||
});
|
||||
@ -340,8 +340,8 @@ export class UserService {
|
||||
|
||||
if (this.configurationService.get('ENABLE_FEATURE_SUBSCRIPTION')) {
|
||||
user.subscription = await this.subscriptionService.getSubscription({
|
||||
createdAt: user.createdAt,
|
||||
subscriptions: Subscription
|
||||
subscriptions,
|
||||
createdAt: user.createdAt
|
||||
});
|
||||
|
||||
if (user.subscription?.type === 'Basic') {
|
||||
|
@ -55,14 +55,14 @@ export class SymbolProfileService {
|
||||
? {
|
||||
some: {
|
||||
User: {
|
||||
Subscription: { some: { expiresAt: { gt: new Date() } } }
|
||||
subscriptions: { some: { expiresAt: { gt: new Date() } } }
|
||||
}
|
||||
}
|
||||
}
|
||||
: {
|
||||
every: {
|
||||
User: {
|
||||
Subscription: { none: { expiresAt: { gt: new Date() } } }
|
||||
subscriptions: { none: { expiresAt: { gt: new Date() } } }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -250,6 +250,7 @@ model User {
|
||||
id String @id @default(uuid())
|
||||
provider Provider @default(ANONYMOUS)
|
||||
role Role @default(USER)
|
||||
subscriptions Subscription[]
|
||||
thirdPartyId String?
|
||||
updatedAt DateTime @updatedAt
|
||||
watchlist SymbolProfile[] @relation("UserWatchlist")
|
||||
@ -261,7 +262,6 @@ model User {
|
||||
AuthDevice AuthDevice[]
|
||||
Order Order[]
|
||||
Settings Settings?
|
||||
Subscription Subscription[]
|
||||
SymbolProfile SymbolProfile[]
|
||||
Tag Tag[]
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user