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C5D,gBAAgB,EAAE,IAAI;oBACtB,OAAO,EAAE,IAAI;iBACd,CAAC;aACH,CAAC;YACF,wBAAU;YACV,0BAAW;YACX,gCAAc;YACd,8BAAa;SACd;QACD,WAAW,EAAE,CAAC,8BAAa,CAAC;QAC5B,SAAS,EAAE,CAAC,wBAAU,EAAE,gBAAU,CAAC;KACpC,CAAC;GACW,SAAS,CAAG"} |
File diff suppressed because one or more lines are too long
@ -0,0 +1,17 @@ |
|||||||
|
import { Column, Entity, ManyToOne, PrimaryGeneratedColumn } from 'typeorm'; |
||||||
|
import { Sensor } from './sensor.entity'; |
||||||
|
|
||||||
|
@Entity() |
||||||
|
export class SensorData { |
||||||
|
@PrimaryGeneratedColumn() |
||||||
|
id: number; |
||||||
|
|
||||||
|
@Column('float') |
||||||
|
value: number; |
||||||
|
|
||||||
|
@Column({ type: 'timestamp' }) |
||||||
|
recordedAt: Date; |
||||||
|
|
||||||
|
@ManyToOne(() => Sensor, (sensor) => sensor.data, { onDelete: 'CASCADE' }) // FK Onwer
|
||||||
|
sensor: Sensor; |
||||||
|
} |
@ -0,0 +1,19 @@ |
|||||||
|
import { TimestampedEntity } from 'src/common/entities/timestamped.entity'; |
||||||
|
import { User } from 'src/users/entities/user.entity'; |
||||||
|
import { Column, Entity, ManyToMany, OneToMany, PrimaryGeneratedColumn } from 'typeorm'; |
||||||
|
import { Sensor } from './sensor.entity'; |
||||||
|
|
||||||
|
@Entity() |
||||||
|
export class SensorGroup extends TimestampedEntity { |
||||||
|
@PrimaryGeneratedColumn() |
||||||
|
id: number; |
||||||
|
|
||||||
|
@Column() |
||||||
|
name: string; |
||||||
|
|
||||||
|
@ManyToMany(() => User, (user) => user.sensorGroups) |
||||||
|
users: User[]; |
||||||
|
|
||||||
|
@OneToMany(() => Sensor, (sensor) => sensor.group) |
||||||
|
sensors: Sensor[]; |
||||||
|
} |
@ -0,0 +1,19 @@ |
|||||||
|
import { TimestampedEntity } from 'src/common/entities/timestamped.entity'; |
||||||
|
import { Column, Entity, ManyToOne, OneToMany, PrimaryGeneratedColumn } from 'typeorm'; |
||||||
|
import { SensorGroup } from './sensor-group.entity'; |
||||||
|
import { SensorData } from './sensor-data.entity'; |
||||||
|
|
||||||
|
@Entity() |
||||||
|
export class Sensor extends TimestampedEntity { |
||||||
|
@PrimaryGeneratedColumn() |
||||||
|
id: number; |
||||||
|
|
||||||
|
@Column() |
||||||
|
name: string; |
||||||
|
|
||||||
|
@ManyToOne(() => SensorGroup, (group) => group.sensors, { onDelete: 'CASCADE' }) // FK Onwer
|
||||||
|
group: SensorGroup; |
||||||
|
|
||||||
|
@OneToMany(() => SensorData, (data) => data.sensor) |
||||||
|
data: SensorData[]; |
||||||
|
} |
@ -0,0 +1,10 @@ |
|||||||
|
import { Module } from '@nestjs/common'; |
||||||
|
import { TypeOrmModule } from '@nestjs/typeorm'; |
||||||
|
import { SensorGroup } from './entities/sensor-group.entity'; |
||||||
|
import { Sensor } from './entities/sensor.entity'; |
||||||
|
import { SensorData } from './entities/sensor-data.entity'; |
||||||
|
|
||||||
|
@Module({ |
||||||
|
imports: [TypeOrmModule.forFeature([SensorGroup, Sensor, SensorData])], |
||||||
|
}) |
||||||
|
export class SensorsModule {} |
Loading…
Reference in new issue