Compile with swc on twenty-server (#4863)
Experiment using swc instead of tsc (as we did the switch on twenty-front) It's **much** faster (at least 5x) but has stricter requirements. I fixed the build but there's still an error while starting the server, opening this PR for discussion. Checkout the branch and try `nx build:swc twenty-server` Read: https://docs.nestjs.com/recipes/swc#common-pitfalls
This commit is contained in:
@ -8,6 +8,7 @@ import {
|
||||
JoinColumn,
|
||||
CreateDateColumn,
|
||||
UpdateDateColumn,
|
||||
Relation,
|
||||
} from 'typeorm';
|
||||
import { BeforeCreateOne, IDField } from '@ptc-org/nestjs-query-graphql';
|
||||
|
||||
@ -33,7 +34,7 @@ export class AppToken {
|
||||
onDelete: 'CASCADE',
|
||||
})
|
||||
@JoinColumn({ name: 'userId' })
|
||||
user: User;
|
||||
user: Relation<User>;
|
||||
|
||||
@Column()
|
||||
userId: string;
|
||||
@ -42,7 +43,7 @@ export class AppToken {
|
||||
onDelete: 'CASCADE',
|
||||
})
|
||||
@JoinColumn({ name: 'workspaceId' })
|
||||
workspace: Workspace;
|
||||
workspace: Relation<Workspace>;
|
||||
|
||||
@Column({ nullable: true })
|
||||
workspaceId: string;
|
||||
|
||||
@ -4,6 +4,7 @@ import {
|
||||
Entity,
|
||||
ManyToOne,
|
||||
PrimaryGeneratedColumn,
|
||||
Relation,
|
||||
Unique,
|
||||
UpdateDateColumn,
|
||||
} from 'typeorm';
|
||||
@ -42,7 +43,7 @@ export class BillingSubscriptionItem {
|
||||
onDelete: 'CASCADE',
|
||||
},
|
||||
)
|
||||
billingSubscription: BillingSubscription;
|
||||
billingSubscription: Relation<BillingSubscription>;
|
||||
|
||||
@Column({ nullable: false })
|
||||
stripeProductId: string;
|
||||
|
||||
@ -8,6 +8,7 @@ import {
|
||||
ManyToOne,
|
||||
OneToMany,
|
||||
PrimaryGeneratedColumn,
|
||||
Relation,
|
||||
UpdateDateColumn,
|
||||
} from 'typeorm';
|
||||
import Stripe from 'stripe';
|
||||
@ -37,7 +38,7 @@ export class BillingSubscription {
|
||||
onDelete: 'CASCADE',
|
||||
})
|
||||
@JoinColumn()
|
||||
workspace: Workspace;
|
||||
workspace: Relation<Workspace>;
|
||||
|
||||
@Column({ nullable: false, type: 'uuid' })
|
||||
workspaceId: string;
|
||||
@ -48,17 +49,17 @@ export class BillingSubscription {
|
||||
@Column({ unique: true, nullable: false })
|
||||
stripeSubscriptionId: string;
|
||||
|
||||
@Field()
|
||||
@Column({ nullable: false })
|
||||
@Field(() => String)
|
||||
@Column({ type: 'text', nullable: false })
|
||||
status: Stripe.Subscription.Status;
|
||||
|
||||
@Field({ nullable: true })
|
||||
@Column({ nullable: true })
|
||||
@Field(() => String, { nullable: true })
|
||||
@Column({ type: 'text', nullable: true })
|
||||
interval: Stripe.Price.Recurring.Interval;
|
||||
|
||||
@OneToMany(
|
||||
() => BillingSubscriptionItem,
|
||||
(billingSubscriptionItem) => billingSubscriptionItem.billingSubscription,
|
||||
)
|
||||
billingSubscriptionItems: BillingSubscriptionItem[];
|
||||
billingSubscriptionItems: Relation<BillingSubscriptionItem[]>;
|
||||
}
|
||||
|
||||
@ -8,6 +8,7 @@ import {
|
||||
CreateDateColumn,
|
||||
UpdateDateColumn,
|
||||
ManyToOne,
|
||||
Relation,
|
||||
} from 'typeorm';
|
||||
import { IDField } from '@ptc-org/nestjs-query-graphql';
|
||||
|
||||
@ -43,7 +44,7 @@ export class FeatureFlagEntity {
|
||||
@ManyToOne(() => Workspace, (workspace) => workspace.featureFlags, {
|
||||
onDelete: 'CASCADE',
|
||||
})
|
||||
workspace: Workspace;
|
||||
workspace: Relation<Workspace>;
|
||||
|
||||
@Field()
|
||||
@Column({ nullable: false })
|
||||
|
||||
@ -8,6 +8,7 @@ import {
|
||||
JoinColumn,
|
||||
ManyToOne,
|
||||
PrimaryGeneratedColumn,
|
||||
Relation,
|
||||
Unique,
|
||||
UpdateDateColumn,
|
||||
} from 'typeorm';
|
||||
@ -29,7 +30,7 @@ export class UserWorkspace {
|
||||
onDelete: 'CASCADE',
|
||||
})
|
||||
@JoinColumn({ name: 'userId' })
|
||||
user: User;
|
||||
user: Relation<User>;
|
||||
|
||||
@Field({ nullable: false })
|
||||
@Column()
|
||||
@ -40,7 +41,7 @@ export class UserWorkspace {
|
||||
onDelete: 'CASCADE',
|
||||
})
|
||||
@JoinColumn({ name: 'workspaceId' })
|
||||
workspace: Workspace;
|
||||
workspace: Relation<Workspace>;
|
||||
|
||||
@Field({ nullable: false })
|
||||
@Column()
|
||||
|
||||
@ -8,6 +8,7 @@ import {
|
||||
UpdateDateColumn,
|
||||
OneToMany,
|
||||
ManyToOne,
|
||||
Relation,
|
||||
} from 'typeorm';
|
||||
import { IDField } from '@ptc-org/nestjs-query-graphql';
|
||||
|
||||
@ -72,7 +73,7 @@ export class User {
|
||||
@ManyToOne(() => Workspace, (workspace) => workspace.users, {
|
||||
onDelete: 'SET NULL',
|
||||
})
|
||||
defaultWorkspace: Workspace;
|
||||
defaultWorkspace: Relation<Workspace>;
|
||||
|
||||
@Field()
|
||||
@Column()
|
||||
@ -89,12 +90,12 @@ export class User {
|
||||
@OneToMany(() => AppToken, (appToken) => appToken.user, {
|
||||
cascade: true,
|
||||
})
|
||||
appTokens: AppToken[];
|
||||
appTokens: Relation<AppToken[]>;
|
||||
|
||||
@Field(() => WorkspaceMember, { nullable: true })
|
||||
workspaceMember: WorkspaceMember;
|
||||
workspaceMember: Relation<WorkspaceMember>;
|
||||
|
||||
@Field(() => [UserWorkspace])
|
||||
@OneToMany(() => UserWorkspace, (userWorkspace) => userWorkspace.user)
|
||||
workspaces: UserWorkspace[];
|
||||
workspaces: Relation<UserWorkspace[]>;
|
||||
}
|
||||
|
||||
@ -7,6 +7,7 @@ import {
|
||||
Entity,
|
||||
OneToMany,
|
||||
PrimaryGeneratedColumn,
|
||||
Relation,
|
||||
UpdateDateColumn,
|
||||
} from 'typeorm';
|
||||
import Stripe from 'stripe';
|
||||
@ -60,25 +61,25 @@ export class Workspace {
|
||||
@OneToMany(() => AppToken, (appToken) => appToken.workspace, {
|
||||
cascade: true,
|
||||
})
|
||||
appTokens: AppToken[];
|
||||
appTokens: Relation<AppToken[]>;
|
||||
|
||||
@OneToMany(() => User, (user) => user.defaultWorkspace)
|
||||
users: User[];
|
||||
users: Relation<User[]>;
|
||||
|
||||
@OneToMany(() => UserWorkspace, (userWorkspace) => userWorkspace.workspace, {
|
||||
onDelete: 'CASCADE',
|
||||
})
|
||||
workspaceUsers: UserWorkspace[];
|
||||
workspaceUsers: Relation<UserWorkspace[]>;
|
||||
|
||||
@Field()
|
||||
@Column({ default: true })
|
||||
allowImpersonation: boolean;
|
||||
|
||||
@OneToMany(() => FeatureFlagEntity, (featureFlag) => featureFlag.workspace)
|
||||
featureFlags: FeatureFlagEntity[];
|
||||
featureFlags: Relation<FeatureFlagEntity[]>;
|
||||
|
||||
@Field()
|
||||
@Column({ default: 'incomplete' })
|
||||
@Field(() => String)
|
||||
@Column({ type: 'text', default: 'incomplete' })
|
||||
subscriptionStatus: Stripe.Subscription.Status;
|
||||
|
||||
@Field({ nullable: true })
|
||||
@ -91,5 +92,5 @@ export class Workspace {
|
||||
() => BillingSubscription,
|
||||
(billingSubscription) => billingSubscription.workspace,
|
||||
)
|
||||
billingSubscriptions: BillingSubscription[];
|
||||
billingSubscriptions: Relation<BillingSubscription[]>;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user