51 lines
1.2 KiB
TypeScript
51 lines
1.2 KiB
TypeScript
import {
|
|
Column,
|
|
CreateDateColumn,
|
|
Entity,
|
|
JoinColumn,
|
|
ManyToOne,
|
|
PrimaryGeneratedColumn,
|
|
} from 'typeorm';
|
|
import { CardInstance } from './card_instances.entity';
|
|
import { Users } from './users.entity';
|
|
|
|
export enum CardResponseActionType {
|
|
ACCEPT = 'accept',
|
|
REFUSE = 'refuse',
|
|
ACK = 'ack',
|
|
}
|
|
|
|
@Entity('card_responses', { schema: 'public' })
|
|
export class CardResponse {
|
|
@PrimaryGeneratedColumn('uuid')
|
|
id: string;
|
|
|
|
@Column({ name: 'id_card', type: 'uuid' })
|
|
id_card: string;
|
|
|
|
@ManyToOne(() => CardInstance, (c) => c.responses, { onDelete: 'CASCADE' })
|
|
@JoinColumn({ name: 'id_card', referencedColumnName: 'id' })
|
|
card: CardInstance;
|
|
|
|
@Column({ name: 'id_utilisateur', type: 'uuid' })
|
|
id_utilisateur: string;
|
|
|
|
@ManyToOne(() => Users, { onDelete: 'CASCADE' })
|
|
@JoinColumn({ name: 'id_utilisateur', referencedColumnName: 'id' })
|
|
user: Users;
|
|
|
|
@Column({
|
|
type: 'enum',
|
|
enum: CardResponseActionType,
|
|
enumName: 'card_response_action_type',
|
|
name: 'action',
|
|
})
|
|
action: CardResponseActionType;
|
|
|
|
@Column({ name: 'comment', type: 'text', nullable: true })
|
|
comment?: string;
|
|
|
|
@CreateDateColumn({ name: 'cree_le', type: 'timestamptz' })
|
|
cree_le: Date;
|
|
}
|