Skip to content

Commit

Permalink
Turned some things from interfaces into entity classes
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewpetro committed Feb 18, 2024
1 parent 85daeb8 commit 6c71a74
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 11 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { IdentifiedDocument } from 'nano'
import { DeviceState } from '../enums/device-state.interface'

export interface IrrigationEventDocument extends IdentifiedDocument {
export class IrrigationEventDocument implements IdentifiedDocument {
_id: string
deviceName: string
deviceId: number
state: DeviceState
Expand Down
2 changes: 1 addition & 1 deletion src/irrigation-events/irrigation-events.service.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Test, TestingModule } from '@nestjs/testing'
import { IrrigationEvent } from './interfaces/irrigation-event.interface'
import { IrrigationEventDocument } from './interfaces/irrigation-event-document.interface'
import { IrrigationEventDocument } from './entities/irrigation-event.entity'
import { MakerApiEventDto } from './dto/maker-api-event.dto'
import { DeviceState } from './enums/device-state.interface'
import { ConfigModule } from '@nestjs/config'
Expand Down
2 changes: 1 addition & 1 deletion src/irrigation-events/irrigation-events.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Injectable, OnModuleInit } from '@nestjs/common'
import Nano, { DocumentScope } from 'nano'
import { ConfigService } from '@nestjs/config'
import EnvironmentVariables from '@/environment-variables'
import { IrrigationEventDocument } from './interfaces/irrigation-event-document.interface'
import { IrrigationEventDocument } from './entities/irrigation-event.entity'
import { IrrigationEvent } from './interfaces/irrigation-event.interface'
import * as queryBuilders from './queries'
import { MakerApiEventDto } from './dto/maker-api-event.dto'
Expand Down
7 changes: 7 additions & 0 deletions src/sunrise-sunset/entities/sunrise-sunset.entity.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { IdentifiedDocument } from 'nano'

export class SunriseSunsetDocument implements IdentifiedDocument {
_id: string
sunrise: string
sunset: string
}

This file was deleted.

2 changes: 1 addition & 1 deletion src/sunrise-sunset/sunrise-sunset.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { ConfigModule } from '@nestjs/config'
import axios, { AxiosRequestConfig } from 'axios'
import { format, parseISO } from 'date-fns'
import { DatabaseModule } from '@/database/database.module'
import { SunriseSunsetDocument } from './interfaces/sunrise-sunset-document.interface'
import { SunriseSunsetDocument } from './entities/sunrise-sunset.entity'
import { SunriseSunsets } from './interfaces/sunrise-sunset.interface'

// Mock the Nano library
Expand Down
2 changes: 1 addition & 1 deletion src/sunrise-sunset/sunrise-sunset.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Injectable, OnModuleInit } from '@nestjs/common'
import { ConfigService } from '@nestjs/config'
import { DocumentScope } from 'nano'
import axios, { AxiosInstance } from 'axios'
import { SunriseSunsetDocument } from './interfaces/sunrise-sunset-document.interface'
import { SunriseSunsetDocument } from './entities/sunrise-sunset.entity'
import { SunriseSunsetResponse } from './interfaces/sunrise-sunset-response.interface'
import { sunriseSunsetQueryBuilder } from './queries'
import { addDays, format } from 'date-fns'
Expand Down

0 comments on commit 6c71a74

Please sign in to comment.