Spaces:
Runtime error
Runtime error
| import { | |
| Entity, | |
| Column, | |
| PrimaryGeneratedColumn, | |
| CreateDateColumn, | |
| UpdateDateColumn, | |
| ManyToOne, | |
| JoinColumn, | |
| Index, | |
| } from 'typeorm'; | |
| import { Session } from '../../session/entities/session.entity'; | |
| // One template name per session: makes resolve-by-name deterministic and rejects duplicates. | |
| // Mirrored by the AddTemplateNameUnique migration for non-synchronize (Postgres / opted-out) DBs. | |
| ('IDX_templates_session_name', ['sessionId', 'name'], { unique: true }) | |
| ('templates') | |
| export class Template { | |
| ('uuid') | |
| id: string; | |
| // varchar (not uuid) to match the authoritative migration DDL and sessions.id; the data connection | |
| // runs synchronize:false, so a 'uuid' decorator here would only mislead schema diffs / a stray sync. | |
| ({ type: 'varchar' }) | |
| sessionId: string; | |
| (() => Session, { onDelete: 'CASCADE' }) | |
| ({ name: 'sessionId' }) | |
| session: Session; | |
| ({ type: 'varchar', length: 100 }) | |
| name: string; | |
| ({ type: 'text' }) | |
| body: string; | |
| ({ type: 'text', nullable: true }) | |
| header: string | null; | |
| ({ type: 'text', nullable: true }) | |
| footer: string | null; | |
| () | |
| createdAt: Date; | |
| () | |
| updatedAt: Date; | |
| } | |