* Define quantity at checkout * Remove billing submenu when not isBillingEnabled * Remove feature flag * Log warning when missing subscription active workspace add or remove member * Display subscribe cta for free usage of twenty * Authorize all settings when subscription canceled or unpaid * Display subscribe cta for workspace with canceled subscription * Replace OneToOne by OneToMany * Add a currentBillingSubscriptionField * Handle multiple subscriptions by workspace * Fix redirection * Fix test * Fix billingState
52 lines
1.1 KiB
TypeScript
52 lines
1.1 KiB
TypeScript
import { Field, ID, ObjectType } from '@nestjs/graphql';
|
|
|
|
import {
|
|
Entity,
|
|
Unique,
|
|
PrimaryGeneratedColumn,
|
|
Column,
|
|
CreateDateColumn,
|
|
UpdateDateColumn,
|
|
ManyToOne,
|
|
} from 'typeorm';
|
|
import { IDField } from '@ptc-org/nestjs-query-graphql';
|
|
|
|
import { Workspace } from 'src/core/workspace/workspace.entity';
|
|
|
|
export enum FeatureFlagKeys {
|
|
IsBlocklistEnabled = 'IS_BLOCKLIST_ENABLED',
|
|
IsCalendarEnabled = 'IS_CALENDAR_ENABLED',
|
|
}
|
|
|
|
@Entity({ name: 'featureFlag', schema: 'core' })
|
|
@ObjectType('FeatureFlag')
|
|
@Unique('IndexOnKeyAndWorkspaceIdUnique', ['key', 'workspaceId'])
|
|
export class FeatureFlagEntity {
|
|
@IDField(() => ID)
|
|
@PrimaryGeneratedColumn('uuid')
|
|
id: string;
|
|
|
|
@Field()
|
|
@Column({ nullable: false, type: 'text' })
|
|
key: FeatureFlagKeys;
|
|
|
|
@Field()
|
|
@Column({ nullable: false, type: 'uuid' })
|
|
workspaceId: string;
|
|
|
|
@ManyToOne(() => Workspace, (workspace) => workspace.featureFlags, {
|
|
onDelete: 'CASCADE',
|
|
})
|
|
workspace: Workspace;
|
|
|
|
@Field()
|
|
@Column({ nullable: false })
|
|
value: boolean;
|
|
|
|
@CreateDateColumn()
|
|
createdAt: Date;
|
|
|
|
@UpdateDateColumn()
|
|
updatedAt: Date;
|
|
}
|