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
parent 3431934ceb
commit b07d6d478c
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();
}