31 lines
554 B
TypeScript
31 lines
554 B
TypeScript
import {
|
|
Entity,
|
|
PrimaryGeneratedColumn,
|
|
Column,
|
|
ManyToOne,
|
|
CreateDateColumn,
|
|
UpdateDateColumn,
|
|
} from 'typeorm';
|
|
import { ZoneEntity } from './zone.entity';
|
|
|
|
@Entity()
|
|
export class AccessEntity {
|
|
@PrimaryGeneratedColumn()
|
|
id: number;
|
|
|
|
@Column({ nullable: false })
|
|
key: string;
|
|
|
|
@ManyToOne(() => ZoneEntity, { onDelete: 'CASCADE' })
|
|
zone: ZoneEntity;
|
|
|
|
@CreateDateColumn()
|
|
public created_at: Date;
|
|
|
|
@UpdateDateColumn()
|
|
public updated_at: Date;
|
|
|
|
@Column({ type: 'datetime', nullable: true })
|
|
public expires_at?: Date;
|
|
}
|