Refactoring of controllers and service interfaces

DTO should only be used for sending information to and from user.
Services now have methods which return normal internal objects and
methods which convert them to DTOs. This conversion is done in the
controlers

Signed-off-by: Yannick Bungers <git@innay.de>
This commit is contained in:
Yannick Bungers 2021-01-30 00:06:38 +01:00 committed by David Mehren
parent e8e269b1bb
commit 0d5b9dea00
No known key found for this signature in database
GPG key ID: 185982BA4C42B7C3
8 changed files with 175 additions and 147 deletions

View file

@ -8,6 +8,7 @@ import { Controller, Get, UseGuards } from '@nestjs/common';
import { MonitoringService } from '../../../monitoring/monitoring.service';
import { TokenAuthGuard } from '../../../auth/token-auth.guard';
import { ApiSecurity } from '@nestjs/swagger';
import { ServerStatusDto } from '../../../monitoring/server-status.dto';
@ApiSecurity('token')
@Controller('monitoring')
@ -16,7 +17,8 @@ export class MonitoringController {
@UseGuards(TokenAuthGuard)
@Get()
getStatus() {
getStatus() : Promise<ServerStatusDto> {
// TODO: toServerStatusDto.
return this.monitoringService.getServerStatus();
}