Skip to content

Commit

Permalink
Renamed switches to deviceIds
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewpetro committed Mar 3, 2024
1 parent 35bb982 commit a0d86e5
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export class CreateIrrigationProgramDto {

@IsInt({ each: true })
@IsPositive({ each: true })
switches: number[]
deviceIds: number[]

@IsBoolean()
simultaneousIrrigation: boolean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export class IrrigationProgramEntity {
public readonly duration: number,
public readonly wateringPeriod: number,
public readonly startTime: string,
public readonly switches: number[],
public readonly deviceIds: number[],
public readonly simultaneousIrrigation: boolean,
public readonly nextRunDate?: string
) {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export interface IrrigationProgram {
duration: number
wateringPeriod: number
startTime: string
switches: number[]
deviceIds: number[]
simultaneousIrrigation: boolean
nextRunDate?: string
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const mockCreateDto = {
duration: 10,
wateringPeriod: 2,
startTime: '12:00:00',
switches: [1, 2],
deviceIds: [1, 2],
simultaneousIrrigation: true,
} as CreateIrrigationProgramDto

Expand Down
18 changes: 9 additions & 9 deletions src/irrigation-programs/irrigation-programs.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ describe('IrrigationProgramsService', () => {
duration: 10,
wateringPeriod: 2,
startTime: '12:00',
switches: [1, 2],
deviceIds: [1, 2],
simultaneousIrrigation: true,
}
const irrigationProgram = await service.create(mockCreateDto)
Expand All @@ -89,7 +89,7 @@ describe('IrrigationProgramsService', () => {
duration: 10,
wateringPeriod: 2,
startTime: '12:00',
switches: [1, 2],
deviceIds: [1, 2],
simultaneousIrrigation: true,
}
try {
Expand All @@ -107,7 +107,7 @@ describe('IrrigationProgramsService', () => {
duration: 10,
wateringPeriod: 2,
startTime: '12:00',
switches: [1, 2],
deviceIds: [1, 2],
simultaneousIrrigation: true,
}
try {
Expand All @@ -126,15 +126,15 @@ describe('IrrigationProgramsService', () => {
duration: 10,
wateringPeriod: 2,
startTime: '12:00',
switches: [1, 2],
deviceIds: [1, 2],
simultaneousIrrigation: true,
}
const mockIrrigationProgram2 = {
name: 'Irrigation Program 2',
duration: 20,
wateringPeriod: 4,
startTime: '05:00',
switches: [3],
deviceIds: [3],
simultaneousIrrigation: false,
}
const uuid1 = uuidv4()
Expand Down Expand Up @@ -177,7 +177,7 @@ describe('IrrigationProgramsService', () => {
duration: 10,
wateringPeriod: 2,
startTime: '12:00',
switches: [1, 2],
deviceIds: [1, 2],
simultaneousIrrigation: true,
}
mockGet.mockResolvedValue({ _id: id, ...mockPartialIrrigationProgram } as IrrigationProgramEntity)
Expand Down Expand Up @@ -232,7 +232,7 @@ describe('IrrigationProgramsService', () => {
duration: 10,
wateringPeriod: 2,
startTime: '12:00',
switches: [1, 2],
deviceIds: [1, 2],
simultaneousIrrigation: true,
}
mockGet.mockResolvedValue({ _id: id, _rev: rev, ...mockIrrigationProgram })
Expand Down Expand Up @@ -307,7 +307,7 @@ describe('IrrigationProgramsService', () => {
duration: 10,
wateringPeriod: 2,
startTime: '12:00',
switches: [1, 2],
deviceIds: [1, 2],
simultaneousIrrigation: true,
}
mockGet.mockResolvedValue({ _id: id, _rev: rev, ...mockIrrigationProgram })
Expand All @@ -333,7 +333,7 @@ describe('IrrigationProgramsService', () => {
duration: 10,
wateringPeriod: 2,
startTime: '12:00',
switches: [1, 2],
deviceIds: [1, 2],
simultaneousIrrigation: true,
}
mockGet.mockResolvedValue({ _id: id, _rev: rev, ...mockIrrigationProgram })
Expand Down
2 changes: 1 addition & 1 deletion src/irrigation-programs/irrigation-programs.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const irrigationEntityToIrrigationInterface = (
duration: irrigationProgramEntity.duration,
wateringPeriod: irrigationProgramEntity.wateringPeriod,
startTime: irrigationProgramEntity.startTime,
switches: irrigationProgramEntity.switches,
deviceIds: irrigationProgramEntity.deviceIds,
simultaneousIrrigation: irrigationProgramEntity.simultaneousIrrigation,
nextRunDate: irrigationProgramEntity.nextRunDate,
})
Expand Down

0 comments on commit a0d86e5

Please sign in to comment.