2023-03-21 22:49:19 -04:00
|
|
|
import {
|
|
|
|
|
ServerInfoResponseDto,
|
|
|
|
|
ServerInfoService,
|
|
|
|
|
ServerPingResponse,
|
|
|
|
|
ServerStatsResponseDto,
|
|
|
|
|
ServerVersionReponseDto,
|
|
|
|
|
} from '@app/domain';
|
2023-04-03 06:24:18 +02:00
|
|
|
import { Controller, Get } from '@nestjs/common';
|
2023-03-21 22:49:19 -04:00
|
|
|
import { ApiTags } from '@nestjs/swagger';
|
|
|
|
|
import { Authenticated } from '../decorators/authenticated.decorator';
|
2023-04-03 06:24:18 +02:00
|
|
|
import { UseValidation } from '../decorators/use-validation.decorator';
|
2023-03-21 22:49:19 -04:00
|
|
|
|
|
|
|
|
@ApiTags('Server Info')
|
|
|
|
|
@Controller('server-info')
|
2023-04-03 06:24:18 +02:00
|
|
|
@UseValidation()
|
2023-03-21 22:49:19 -04:00
|
|
|
export class ServerInfoController {
|
2023-03-24 00:53:56 -04:00
|
|
|
constructor(private service: ServerInfoService) {}
|
2023-03-21 22:49:19 -04:00
|
|
|
|
2023-03-27 16:38:54 +02:00
|
|
|
@Authenticated()
|
2023-03-21 22:49:19 -04:00
|
|
|
@Get()
|
|
|
|
|
getServerInfo(): Promise<ServerInfoResponseDto> {
|
|
|
|
|
return this.service.getInfo();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Get('/ping')
|
|
|
|
|
pingServer(): ServerPingResponse {
|
|
|
|
|
return this.service.ping();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Get('/version')
|
|
|
|
|
getServerVersion(): ServerVersionReponseDto {
|
|
|
|
|
return this.service.getVersion();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Authenticated({ admin: true })
|
|
|
|
|
@Get('/stats')
|
|
|
|
|
getStats(): Promise<ServerStatsResponseDto> {
|
|
|
|
|
return this.service.getStats();
|
|
|
|
|
}
|
|
|
|
|
}
|