-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9a8a519
commit 40a2554
Showing
14 changed files
with
96 additions
and
112 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { Type } from 'class-transformer'; | ||
import { IsNotEmpty, IsString } from 'class-validator'; | ||
|
||
export class CreateDeviceDto { | ||
@Type(() => String) | ||
@IsString() | ||
@IsNotEmpty() | ||
readonly ain: string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
import { Controller, Get } from '@nestjs/common'; | ||
import { DeviceDto } from './device.dto'; | ||
import { DeviceService } from './device.service'; | ||
import { DeviceEntity } from './device.entity'; | ||
|
||
@Controller('devices') | ||
export class DeviceController { | ||
constructor(private readonly deviceService: DeviceService) {} | ||
|
||
@Get() | ||
devices(): Promise<DeviceDto[]> { | ||
devices(): Promise<DeviceEntity[]> { | ||
return this.deviceService.getDevices(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import { Entity } from 'typeorm'; | ||
|
||
@Entity({ name: 'devices' }) | ||
export class DeviceEntity {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,16 @@ | ||
import { Injectable } from '@nestjs/common'; | ||
import { DeviceDto } from './device.dto'; | ||
import { InjectRepository } from '@nestjs/typeorm'; | ||
import { MeasurementEntity } from '../measurement/measurement.entity'; | ||
import { Repository } from 'typeorm'; | ||
import { DeviceEntity } from './device.entity'; | ||
|
||
@Injectable() | ||
export class DeviceService { | ||
constructor( | ||
@InjectRepository(MeasurementEntity) | ||
private measurementRepository: Repository<MeasurementEntity>, | ||
@InjectRepository(DeviceEntity) | ||
private deviceRepository: Repository<DeviceEntity>, | ||
) {} | ||
|
||
async getDevices(): Promise<DeviceDto[]> { | ||
const x = await this.measurementRepository | ||
.createQueryBuilder('measurement') | ||
.select('DISTINCT(device) ain') | ||
.getRawMany(); | ||
console.log(x); | ||
|
||
async getDevices(): Promise<DeviceEntity[]> { | ||
return Promise.resolve([]); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.