mirror of
https://github.com/SyncrowIOT/backend.git
synced 2025-07-16 10:46:17 +00:00
33 lines
1.0 KiB
TypeScript
33 lines
1.0 KiB
TypeScript
import { Column, Entity, ManyToOne, Unique } from 'typeorm';
|
|
import { AbstractEntity } from '../../abstract/entities/abstract.entity';
|
|
import { SpaceEntity } from '../../space/entities/space.entity';
|
|
import { SpaceDailyOccupancyDurationDto } from '../dtos';
|
|
|
|
@Entity({ name: 'space-daily-occupancy-duration' })
|
|
@Unique(['spaceUuid', 'eventDate'])
|
|
export class SpaceDailyOccupancyDurationEntity extends AbstractEntity<SpaceDailyOccupancyDurationDto> {
|
|
@Column({ nullable: false })
|
|
public spaceUuid: string;
|
|
|
|
@Column({ nullable: false, type: 'date' })
|
|
public eventDate: string;
|
|
|
|
public CountTotalPresenceDetected: number;
|
|
|
|
@ManyToOne(() => SpaceEntity, (space) => space.presenceSensorDaily)
|
|
space: SpaceEntity;
|
|
|
|
@Column({ type: 'int' })
|
|
occupancyPercentage: number;
|
|
|
|
@Column({ type: 'int', nullable: true })
|
|
occupiedSeconds?: number;
|
|
|
|
@Column({ type: 'int', nullable: true })
|
|
deviceCount?: number;
|
|
constructor(partial: Partial<SpaceDailyOccupancyDurationEntity>) {
|
|
super();
|
|
Object.assign(this, partial);
|
|
}
|
|
}
|