Docs: Add more documentation to the public api

Signed-off-by: Philip Molares <philip.molares@udo.edu>
This commit is contained in:
Philip Molares 2021-03-19 12:10:46 +01:00 committed by David Mehren
parent 0e44f545a1
commit 53f5093630
No known key found for this signature in database
GPG key ID: 185982BA4C42B7C3
6 changed files with 199 additions and 7 deletions

View file

@ -7,8 +7,19 @@
import { Controller, Get, UseGuards } from '@nestjs/common';
import { MonitoringService } from '../../../monitoring/monitoring.service';
import { TokenAuthGuard } from '../../../auth/token-auth.guard';
import { ApiSecurity, ApiTags } from '@nestjs/swagger';
import {
ApiForbiddenResponse,
ApiOkResponse,
ApiProduces,
ApiSecurity,
ApiTags,
ApiUnauthorizedResponse,
} from '@nestjs/swagger';
import { ServerStatusDto } from '../../../monitoring/server-status.dto';
import {
forbiddenDescription,
unauthorizedDescription,
} from '../../utils/descriptions';
@ApiTags('monitoring')
@ApiSecurity('token')
@ -18,6 +29,12 @@ export class MonitoringController {
@UseGuards(TokenAuthGuard)
@Get()
@ApiOkResponse({
description: 'The server info',
type: ServerStatusDto,
})
@ApiUnauthorizedResponse({ description: unauthorizedDescription })
@ApiForbiddenResponse({ description: forbiddenDescription })
getStatus(): Promise<ServerStatusDto> {
// TODO: toServerStatusDto.
return this.monitoringService.getServerStatus();
@ -25,6 +42,12 @@ export class MonitoringController {
@UseGuards(TokenAuthGuard)
@Get('prometheus')
@ApiOkResponse({
description: 'Prometheus compatible monitoring data',
})
@ApiUnauthorizedResponse({ description: unauthorizedDescription })
@ApiForbiddenResponse({ description: forbiddenDescription })
@ApiProduces('text/plain')
getPrometheusStatus(): string {
return '';
}