1
0
forked from Cutlery/immich
immich-quadlet/server/src/immich/controllers/server-info.controller.ts
Alex c254a04aec
feat(server): add endpoint to get supported media types on the server (#3284)
* feat(server): add endpoint to get supported media types on the server

* api generation

* remove xmp format

* change dto

* openapi

* dev
2023-07-15 20:24:46 -05:00

50 lines
1.2 KiB
TypeScript

import {
ServerInfoResponseDto,
ServerInfoService,
ServerMediaTypesResponseDto,
ServerPingResponse,
ServerStatsResponseDto,
ServerVersionReponseDto,
} from '@app/domain';
import { Controller, Get } from '@nestjs/common';
import { ApiTags } from '@nestjs/swagger';
import { AdminRoute, Authenticated, PublicRoute } from '../app.guard';
import { UseValidation } from '../app.utils';
@ApiTags('Server Info')
@Controller('server-info')
@Authenticated()
@UseValidation()
export class ServerInfoController {
constructor(private service: ServerInfoService) {}
@Get()
getServerInfo(): Promise<ServerInfoResponseDto> {
return this.service.getInfo();
}
@PublicRoute()
@Get('/ping')
pingServer(): ServerPingResponse {
return this.service.ping();
}
@PublicRoute()
@Get('/version')
getServerVersion(): ServerVersionReponseDto {
return this.service.getVersion();
}
@AdminRoute()
@Get('/stats')
getStats(): Promise<ServerStatsResponseDto> {
return this.service.getStats();
}
@PublicRoute()
@Get('/media-types')
getSupportedMediaTypes(): ServerMediaTypesResponseDto {
return this.service.getSupportedMediaTypes();
}
}