mirror of
https://github.com/SyncrowIOT/backend.git
synced 2025-07-10 15:17:41 +00:00
33 lines
923 B
TypeScript
33 lines
923 B
TypeScript
import { Column, Entity, JoinColumn, ManyToOne } from 'typeorm';
|
|
import { AbstractEntity } from '../../abstract/entities/abstract.entity';
|
|
import { SpaceEntity } from './space.entity';
|
|
import { Direction } from '@app/common/constants/direction.enum';
|
|
|
|
@Entity({ name: 'space-link' })
|
|
export class SpaceLinkEntity extends AbstractEntity {
|
|
@ManyToOne(() => SpaceEntity, { nullable: false, onDelete: 'CASCADE' })
|
|
@JoinColumn({ name: 'start_space_id' })
|
|
public startSpace: SpaceEntity;
|
|
|
|
@ManyToOne(() => SpaceEntity, { nullable: false, onDelete: 'CASCADE' })
|
|
@JoinColumn({ name: 'end_space_id' })
|
|
public endSpace: SpaceEntity;
|
|
|
|
@Column({
|
|
nullable: false,
|
|
default: false,
|
|
})
|
|
public disabled: boolean;
|
|
|
|
@Column({
|
|
nullable: false,
|
|
enum: Object.values(Direction),
|
|
})
|
|
direction: string;
|
|
|
|
constructor(partial: Partial<SpaceLinkEntity>) {
|
|
super();
|
|
Object.assign(this, partial);
|
|
}
|
|
}
|