Form-Service/src/participant/entity/participant.entity.ts

31 lines
829 B
TypeScript

import { Column, Entity, ManyToOne } from 'typeorm';
import { BaseEntity } from 'src/_core/entity/_base.entity';
import { Form } from 'src/form/entity/form.entity';
import { Realm } from '../../realm/entity/realm.entity';
@Entity({ name: 'participants' })
export class Participant extends BaseEntity {
@Column({
type: 'uuid',
unique: true,
})
userId: string;
@Column({
type: 'enum',
enum: ['moderator', 'tester', 'admin', 'user'],
default: 'user',
})
role: 'moderator' | 'tester' | 'admin' | 'user';
@Column()
displayName: string;
// Many-to-One relationship with Form
@ManyToOne(() => Form, form => form.participants)
form: Form;
// Many-to-One relationship with Realm (if a participant belongs to a realm)
@ManyToOne(() => Realm, realm => realm.participants)
realm: Realm;
}