f6f52d676f
Pg scan was redundant because historically the workspaceId was `varchar`, even though below migration won't change that we had a look to workspaceId col declaration across the codebase
45 lines
1.1 KiB
TypeScript
45 lines
1.1 KiB
TypeScript
import {
|
|
Column,
|
|
CreateDateColumn,
|
|
Entity,
|
|
Index,
|
|
JoinColumn,
|
|
ManyToOne,
|
|
OneToMany,
|
|
PrimaryGeneratedColumn,
|
|
UpdateDateColumn,
|
|
} from 'typeorm';
|
|
|
|
import { Relation } from 'src/engine/workspace-manager/workspace-sync-metadata/interfaces/relation.interface';
|
|
|
|
import { UserWorkspaceEntity } from 'src/engine/core-modules/user-workspace/user-workspace.entity';
|
|
import { AgentChatMessageEntity } from 'src/engine/metadata-modules/agent/agent-chat-message.entity';
|
|
|
|
@Entity('agentChatThread')
|
|
export class AgentChatThreadEntity {
|
|
@PrimaryGeneratedColumn('uuid')
|
|
id: string;
|
|
|
|
@Column({ nullable: false, type: 'uuid' })
|
|
@Index()
|
|
userWorkspaceId: string;
|
|
|
|
@ManyToOne(() => UserWorkspaceEntity, {
|
|
onDelete: 'CASCADE',
|
|
})
|
|
@JoinColumn({ name: 'userWorkspaceId' })
|
|
userWorkspace: Relation<UserWorkspaceEntity>;
|
|
|
|
@Column({ nullable: true, type: 'varchar' })
|
|
title: string;
|
|
|
|
@OneToMany(() => AgentChatMessageEntity, (message) => message.thread)
|
|
messages: Relation<AgentChatMessageEntity[]>;
|
|
|
|
@CreateDateColumn()
|
|
createdAt: Date;
|
|
|
|
@UpdateDateColumn()
|
|
updatedAt: Date;
|
|
}
|