Add PollutantType enum and update AQI-related entities and services to use it

This commit is contained in:
faris Aljohari
2025-06-11 00:28:00 -06:00
parent c86be27576
commit 2cb77504ca
5 changed files with 72 additions and 67 deletions

View File

@ -9,173 +9,173 @@ export class AqiSpaceDailyPollutantStatsEntity extends AbstractEntity<AqiSpaceDa
@Column({ nullable: false })
public spaceUuid: string;
@ManyToOne(() => SpaceEntity, (space) => space.presenceSensorDaily)
@ManyToOne(() => SpaceEntity, (space) => space.aqiSensorDaily)
space: SpaceEntity;
@Column({ type: 'date', nullable: false })
public eventDate: Date;
@Column('float', { nullable: true })
public goodAqiPercentage: number;
public goodAqiPercentage?: number;
@Column('float', { nullable: true })
public moderateAqiPercentage: number;
public moderateAqiPercentage?: number;
@Column('float', { nullable: true })
public unhealthySensitiveAqiPercentage: number;
public unhealthySensitiveAqiPercentage?: number;
@Column('float', { nullable: true })
public unhealthyAqiPercentage: number;
public unhealthyAqiPercentage?: number;
@Column('float', { nullable: true })
public veryUnhealthyAqiPercentage: number;
public veryUnhealthyAqiPercentage?: number;
@Column('float', { nullable: true })
public hazardousAqiPercentage: number;
public hazardousAqiPercentage?: number;
@Column('float', { nullable: true })
public dailyAvgAqi: number;
public dailyAvgAqi?: number;
@Column('float', { nullable: true })
public dailyMaxAqi: number;
public dailyMaxAqi?: number;
@Column('float', { nullable: true })
public dailyMinAqi: number;
public dailyMinAqi?: number;
@Column('float', { nullable: true })
public goodPm25Percentage: number;
public goodPm25Percentage?: number;
@Column('float', { nullable: true })
public moderatePm25Percentage: number;
public moderatePm25Percentage?: number;
@Column('float', { nullable: true })
public unhealthySensitivePm25Percentage: number;
public unhealthySensitivePm25Percentage?: number;
@Column('float', { nullable: true })
public unhealthyPm25Percentage: number;
public unhealthyPm25Percentage?: number;
@Column('float', { nullable: true })
public veryUnhealthyPm25Percentage: number;
public veryUnhealthyPm25Percentage?: number;
@Column('float', { nullable: true })
public hazardousPm25Percentage: number;
public hazardousPm25Percentage?: number;
@Column('float', { nullable: true })
public dailyAvgPm25: number;
public dailyAvgPm25?: number;
@Column('float', { nullable: true })
public dailyMaxPm25: number;
public dailyMaxPm25?: number;
@Column('float', { nullable: true })
public dailyMinPm25: number;
public dailyMinPm25?: number;
@Column('float', { nullable: true })
public goodPm10Percentage: number;
public goodPm10Percentage?: number;
@Column('float', { nullable: true })
public moderatePm10Percentage: number;
public moderatePm10Percentage?: number;
@Column('float', { nullable: true })
public unhealthySensitivePm10Percentage: number;
public unhealthySensitivePm10Percentage?: number;
@Column('float', { nullable: true })
public unhealthyPm10Percentage: number;
public unhealthyPm10Percentage?: number;
@Column('float', { nullable: true })
public veryUnhealthyPm10Percentage: number;
public veryUnhealthyPm10Percentage?: number;
@Column('float', { nullable: true })
public hazardousPm10Percentage: number;
public hazardousPm10Percentage?: number;
@Column('float', { nullable: true })
public dailyAvgPm10: number;
public dailyAvgPm10?: number;
@Column('float', { nullable: true })
public dailyMaxPm10: number;
public dailyMaxPm10?: number;
@Column('float', { nullable: true })
public dailyMinPm10: number;
public dailyMinPm10?: number;
@Column('float', { nullable: true })
public goodVocPercentage: number;
public goodVocPercentage?: number;
@Column('float', { nullable: true })
public moderateVocPercentage: number;
public moderateVocPercentage?: number;
@Column('float', { nullable: true })
public unhealthySensitiveVocPercentage: number;
public unhealthySensitiveVocPercentage?: number;
@Column('float', { nullable: true })
public unhealthyVocPercentage: number;
public unhealthyVocPercentage?: number;
@Column('float', { nullable: true })
public veryUnhealthyVocPercentage: number;
public veryUnhealthyVocPercentage?: number;
@Column('float', { nullable: true })
public hazardousVocPercentage: number;
public hazardousVocPercentage?: number;
@Column('float', { nullable: true })
public dailyAvgVoc: number;
public dailyAvgVoc?: number;
@Column('float', { nullable: true })
public dailyMaxVoc: number;
public dailyMaxVoc?: number;
@Column('float', { nullable: true })
public dailyMinVoc: number;
public dailyMinVoc?: number;
@Column('float', { nullable: true })
public goodCo2Percentage: number;
public goodCo2Percentage?: number;
@Column('float', { nullable: true })
public moderateCo2Percentage: number;
public moderateCo2Percentage?: number;
@Column('float', { nullable: true })
public unhealthySensitiveCo2Percentage: number;
public unhealthySensitiveCo2Percentage?: number;
@Column('float', { nullable: true })
public unhealthyCo2Percentage: number;
public unhealthyCo2Percentage?: number;
@Column('float', { nullable: true })
public veryUnhealthyCo2Percentage: number;
public veryUnhealthyCo2Percentage?: number;
@Column('float', { nullable: true })
public hazardousCo2Percentage: number;
public hazardousCo2Percentage?: number;
@Column('float', { nullable: true })
public dailyAvgCo2: number;
public dailyAvgCo2?: number;
@Column('float', { nullable: true })
public dailyMaxCo2: number;
public dailyMaxCo2?: number;
@Column('float', { nullable: true })
public dailyMinCo2: number;
public dailyMinCo2?: number;
@Column('float', { nullable: true })
public goodCh2oPercentage: number;
public goodCh2oPercentage?: number;
@Column('float', { nullable: true })
public moderateCh2oPercentage: number;
public moderateCh2oPercentage?: number;
@Column('float', { nullable: true })
public unhealthySensitiveCh2oPercentage: number;
public unhealthySensitiveCh2oPercentage?: number;
@Column('float', { nullable: true })
public unhealthyCh2oPercentage: number;
public unhealthyCh2oPercentage?: number;
@Column('float', { nullable: true })
public veryUnhealthyCh2oPercentage: number;
public veryUnhealthyCh2oPercentage?: number;
@Column('float', { nullable: true })
public hazardousCh2oPercentage: number;
public hazardousCh2oPercentage?: number;
@Column('float', { nullable: true })
public dailyAvgCh2o: number;
public dailyAvgCh2o?: number;
@Column('float', { nullable: true })
public dailyMaxCh2o: number;
public dailyMaxCh2o?: number;
@Column('float', { nullable: true })
public dailyMinCh2o: number;
public dailyMinCh2o?: number;
constructor(partial: Partial<AqiSpaceDailyPollutantStatsEntity>) {
super();

View File

@ -11,6 +11,7 @@ import { InviteUserSpaceEntity } from '../../Invite-user/entities';
import { SpaceProductAllocationEntity } from './space-product-allocation.entity';
import { SubspaceEntity } from './subspace/subspace.entity';
import { PresenceSensorDailySpaceEntity } from '../../presence-sensor/entities';
import { AqiSpaceDailyPollutantStatsEntity } from '../../aqi/entities';
@Entity({ name: 'space' })
export class SpaceEntity extends AbstractEntity<SpaceDto> {
@ -115,6 +116,9 @@ export class SpaceEntity extends AbstractEntity<SpaceDto> {
@OneToMany(() => PresenceSensorDailySpaceEntity, (sensor) => sensor.space)
presenceSensorDaily: PresenceSensorDailySpaceEntity[];
@OneToMany(() => AqiSpaceDailyPollutantStatsEntity, (aqi) => aqi.space)
aqiSensorDaily: AqiSpaceDailyPollutantStatsEntity[];
constructor(partial: Partial<SpaceEntity>) {
super();
Object.assign(this, partial);