mirror of
https://github.com/SECTL/SecScore.git
synced 2026-07-21 11:49:02 +08:00
35 lines
909 B
TypeScript
35 lines
909 B
TypeScript
import { Column, Entity, PrimaryGeneratedColumn, ManyToMany, JoinTable } from 'typeorm'
|
|
import { TagEntity } from './TagEntity'
|
|
|
|
@Entity({ name: 'students' })
|
|
export class StudentEntity {
|
|
@PrimaryGeneratedColumn()
|
|
id!: number
|
|
|
|
@Column({ type: 'text' })
|
|
name!: string
|
|
|
|
@Column({ type: 'text', default: '[]' })
|
|
tags!: string
|
|
|
|
@Column({ type: 'integer', default: 0 })
|
|
score!: number
|
|
|
|
@Column({ type: 'text', nullable: true })
|
|
extra_json!: string | null
|
|
|
|
@Column({ type: 'text', default: () => 'CURRENT_TIMESTAMP' })
|
|
created_at!: string
|
|
|
|
@Column({ type: 'text', default: () => 'CURRENT_TIMESTAMP' })
|
|
updated_at!: string
|
|
|
|
@ManyToMany(() => TagEntity, { cascade: true })
|
|
@JoinTable({
|
|
name: 'student_tags',
|
|
joinColumn: { name: 'student_id', referencedColumnName: 'id' },
|
|
inverseJoinColumn: { name: 'tag_id', referencedColumnName: 'id' }
|
|
})
|
|
tagEntities!: TagEntity[]
|
|
}
|