2026-04-05 21:53:30 +08:00
|
|
|
import { DbAwareColumn, resolveDbType } from '@server/utils/DbColumnHelper';
|
2026-02-16 21:36:55 +05:00
|
|
|
import {
|
|
|
|
|
Column,
|
|
|
|
|
Entity,
|
|
|
|
|
Index,
|
|
|
|
|
ManyToOne,
|
|
|
|
|
PrimaryGeneratedColumn,
|
2026-04-05 21:53:30 +08:00
|
|
|
UpdateDateColumn,
|
2026-02-16 21:36:55 +05:00
|
|
|
} from 'typeorm';
|
2021-10-24 21:44:20 +09:00
|
|
|
import Issue from './Issue';
|
|
|
|
|
import { User } from './User';
|
|
|
|
|
|
|
|
|
|
@Entity()
|
|
|
|
|
class IssueComment {
|
|
|
|
|
@PrimaryGeneratedColumn()
|
|
|
|
|
public id: number;
|
|
|
|
|
|
|
|
|
|
@ManyToOne(() => User, {
|
|
|
|
|
eager: true,
|
|
|
|
|
onDelete: 'CASCADE',
|
|
|
|
|
})
|
2026-02-16 21:36:55 +05:00
|
|
|
@Index()
|
2021-10-24 21:44:20 +09:00
|
|
|
public user: User;
|
|
|
|
|
|
|
|
|
|
@ManyToOne(() => Issue, (issue) => issue.comments, {
|
|
|
|
|
onDelete: 'CASCADE',
|
|
|
|
|
})
|
2026-02-16 21:36:55 +05:00
|
|
|
@Index()
|
2021-10-24 21:44:20 +09:00
|
|
|
public issue: Issue;
|
|
|
|
|
|
|
|
|
|
@Column({ type: 'text' })
|
|
|
|
|
public message: string;
|
|
|
|
|
|
2025-05-10 03:38:22 +08:00
|
|
|
@DbAwareColumn({ type: 'datetime', default: () => 'CURRENT_TIMESTAMP' })
|
2021-10-24 21:44:20 +09:00
|
|
|
public createdAt: Date;
|
|
|
|
|
|
2026-04-20 17:13:52 +02:00
|
|
|
@UpdateDateColumn({
|
|
|
|
|
type: resolveDbType('datetime'),
|
|
|
|
|
default: () => 'CURRENT_TIMESTAMP',
|
|
|
|
|
})
|
2021-10-24 21:44:20 +09:00
|
|
|
public updatedAt: Date;
|
|
|
|
|
|
|
|
|
|
constructor(init?: Partial<IssueComment>) {
|
|
|
|
|
Object.assign(this, init);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default IssueComment;
|