generated from bastian/boilerplate
mvp
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
import {
|
||||
Column,
|
||||
CreateDateColumn,
|
||||
Entity,
|
||||
Index,
|
||||
JoinColumn,
|
||||
ManyToOne,
|
||||
PrimaryGeneratedColumn,
|
||||
} from 'typeorm';
|
||||
import { UserEntity } from '../../users/entities/user.entity';
|
||||
import { ProjectEntity } from './project.entity';
|
||||
|
||||
@Entity('project_activities')
|
||||
export class ProjectActivityEntity {
|
||||
@PrimaryGeneratedColumn('uuid')
|
||||
id!: string;
|
||||
|
||||
@ManyToOne(() => ProjectEntity, (project) => project.activities, {
|
||||
onDelete: 'CASCADE',
|
||||
})
|
||||
@JoinColumn({ name: 'project_id' })
|
||||
project!: ProjectEntity;
|
||||
|
||||
@Index('idx_project_activities_project_created')
|
||||
@Column({ name: 'project_id', type: 'char', length: 36 })
|
||||
projectId!: string;
|
||||
|
||||
@ManyToOne(() => UserEntity, { nullable: true, onDelete: 'SET NULL' })
|
||||
@JoinColumn({ name: 'actor_user_id' })
|
||||
actorUser!: UserEntity | null;
|
||||
|
||||
@Column({ name: 'actor_user_id', type: 'char', length: 36, nullable: true })
|
||||
actorUserId!: string | null;
|
||||
|
||||
@Column({ type: 'varchar', length: 80 })
|
||||
action!: string;
|
||||
|
||||
@Column({ type: 'json', nullable: true })
|
||||
metadata!: Record<string, string | number | boolean | null> | null;
|
||||
|
||||
@CreateDateColumn({ name: 'created_at', type: 'datetime', precision: 3 })
|
||||
createdAt!: Date;
|
||||
}
|
||||
Reference in New Issue
Block a user