immich/server/apps/immich/src/controllers/server-info.controller.ts

41 lines
1,008 B
TypeScript
Raw Normal View History

2023-03-21 22:49:19 -04:00
import {
ServerInfoResponseDto,
ServerInfoService,
ServerPingResponse,
ServerStatsResponseDto,
ServerVersionReponseDto,
} from '@app/domain';
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';
import { UseValidation } from '../decorators/use-validation.decorator';
2023-03-21 22:49:19 -04:00
@ApiTags('Server Info')
@Controller('server-info')
@UseValidation()
2023-03-21 22:49:19 -04:00
export class ServerInfoController {
constructor(private service: ServerInfoService) {}
2023-03-21 22:49:19 -04: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();
}
}