Add new page module and services; refactor existing entities
- Introduced a new page module with associated services. - Refactored TypeORM entities in user and workspace modules.
This commit is contained in:
@@ -15,28 +15,30 @@ export class WorkspaceInvitation {
|
||||
@PrimaryGeneratedColumn('uuid')
|
||||
id: string;
|
||||
|
||||
@Column()
|
||||
workspaceId: string;
|
||||
|
||||
@ManyToOne(() => Workspace, {
|
||||
onDelete: 'CASCADE',
|
||||
createForeignKeyConstraints: false,
|
||||
})
|
||||
@JoinColumn({ name: 'workspaceId' })
|
||||
workspace: Workspace;
|
||||
|
||||
@ManyToOne(() => User, {
|
||||
onDelete: 'SET NULL',
|
||||
createForeignKeyConstraints: false,
|
||||
})
|
||||
@Column()
|
||||
invitedById: string;
|
||||
|
||||
@ManyToOne(() => User)
|
||||
@JoinColumn({ name: 'invitedById' })
|
||||
invitedBy: User;
|
||||
|
||||
@Column({ type: 'varchar', length: 255 })
|
||||
@Column({ length: 255 })
|
||||
email: string;
|
||||
|
||||
@Column({ type: 'varchar', length: 100, nullable: true })
|
||||
role?: string;
|
||||
@Column({ length: 100, nullable: true })
|
||||
role: string;
|
||||
|
||||
@Column({ type: 'varchar', length: 100, nullable: true })
|
||||
status?: string;
|
||||
@Column({ length: 100, nullable: true })
|
||||
status: string;
|
||||
|
||||
@CreateDateColumn()
|
||||
createdAt: Date;
|
||||
|
||||
@@ -17,28 +17,26 @@ export class WorkspaceUser {
|
||||
@PrimaryGeneratedColumn('uuid')
|
||||
id: string;
|
||||
|
||||
@Column()
|
||||
userId: string;
|
||||
|
||||
@ManyToOne(() => User, (user) => user.workspaceUser, {
|
||||
onDelete: 'CASCADE',
|
||||
createForeignKeyConstraints: false,
|
||||
})
|
||||
@JoinColumn({ name: 'userId' })
|
||||
user: User;
|
||||
|
||||
@Column()
|
||||
userId: string;
|
||||
workspaceId: string;
|
||||
|
||||
@ManyToOne(() => Workspace, (workspace) => workspace.workspaceUser, {
|
||||
@ManyToOne(() => Workspace, (workspace) => workspace.workspaceUsers, {
|
||||
onDelete: 'CASCADE',
|
||||
createForeignKeyConstraints: false,
|
||||
})
|
||||
@JoinColumn({ name: 'workspaceId' })
|
||||
workspace: Workspace;
|
||||
|
||||
@Column()
|
||||
workspaceId: string;
|
||||
|
||||
@Column({ type: 'varchar', length: 100, nullable: true })
|
||||
role?: string;
|
||||
@Column({ length: 100, nullable: true })
|
||||
role: string;
|
||||
|
||||
@CreateDateColumn()
|
||||
createdAt: Date;
|
||||
|
||||
@@ -10,53 +10,60 @@ import {
|
||||
} from 'typeorm';
|
||||
import { User } from '../../user/entities/user.entity';
|
||||
import { WorkspaceUser } from './workspace-user.entity';
|
||||
import { Page } from '../../page/entities/page.entity';
|
||||
import { WorkspaceInvitation } from './workspace-invitation.entity';
|
||||
|
||||
@Entity('workspaces')
|
||||
export class Workspace {
|
||||
@PrimaryGeneratedColumn('uuid')
|
||||
id: string;
|
||||
|
||||
@Column()
|
||||
@Column({ length: 255, nullable: true })
|
||||
name: string;
|
||||
|
||||
@Column({ type: 'text', nullable: true })
|
||||
description?: string;
|
||||
description: string;
|
||||
|
||||
@Column({ nullable: true })
|
||||
logo?: string;
|
||||
@Column({ length: 255, nullable: true })
|
||||
logo: string;
|
||||
|
||||
@Column({ unique: true })
|
||||
@Column({ length: 255, unique: true })
|
||||
hostname: string;
|
||||
|
||||
@Column({ nullable: true })
|
||||
customDomain?: string;
|
||||
@Column({ length: 255, nullable: true })
|
||||
customDomain: string;
|
||||
|
||||
@Column({ type: 'boolean', default: true })
|
||||
enableInvite: boolean;
|
||||
|
||||
@Column({ type: 'text', unique: true, nullable: true })
|
||||
inviteCode?: string;
|
||||
@Column({ length: 255, unique: true, nullable: true })
|
||||
inviteCode: string;
|
||||
|
||||
@Column({ type: 'jsonb', nullable: true })
|
||||
settings?: any;
|
||||
|
||||
@ManyToOne(() => User, (user) => user.workspaces, {
|
||||
createForeignKeyConstraints: false,
|
||||
})
|
||||
@JoinColumn({ name: 'creatorId' })
|
||||
creator: User;
|
||||
settings: any;
|
||||
|
||||
@Column()
|
||||
creatorId: string;
|
||||
|
||||
@ManyToOne(() => User, (user) => user.workspaces)
|
||||
@JoinColumn({ name: 'creatorId' })
|
||||
creator: User;
|
||||
|
||||
@CreateDateColumn()
|
||||
createdAt: Date;
|
||||
|
||||
@UpdateDateColumn()
|
||||
updatedAt: Date;
|
||||
|
||||
@OneToMany(() => WorkspaceUser, (workspaceUser) => workspaceUser.workspace, {
|
||||
createForeignKeyConstraints: false,
|
||||
})
|
||||
workspaceUser: WorkspaceUser[];
|
||||
@OneToMany(() => WorkspaceUser, (workspaceUser) => workspaceUser.workspace)
|
||||
workspaceUsers: WorkspaceUser[];
|
||||
|
||||
@OneToMany(
|
||||
() => WorkspaceInvitation,
|
||||
(workspaceInvitation) => workspaceInvitation.workspace,
|
||||
)
|
||||
workspaceInvitations: WorkspaceInvitation[];
|
||||
|
||||
@OneToMany(() => Page, (page) => page.workspace)
|
||||
pages: Page[];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user