feat: add conversation module

This commit is contained in:
2026-09-30 17:55:21 +03:30
parent 13ba11f951
commit 9842f4db31
14 changed files with 270 additions and 18 deletions
@@ -0,0 +1,33 @@
import {
Column,
CreateDateColumn,
Entity,
ManyToOne,
PrimaryGeneratedColumn,
} from 'typeorm';
import { Conversation } from './conversation.entity';
import { MessageRole } from '../enums/message-role.enum';
@Entity()
export class Message {
@PrimaryGeneratedColumn()
id!: number;
@ManyToOne(() => Conversation, (conversation) => conversation.messages, {
onDelete: 'CASCADE',
})
conversation!: Conversation;
@Column({
type: 'enum',
enum: MessageRole,
nullable: false,
})
role!: MessageRole;
@Column({ type: 'text' })
content!: string;
@CreateDateColumn()
createdAt!: Date;
}