immich/server/src/controllers/server-info.controller.ts
Jason Rasmussen 8a445cac07
chore: build metadata (#10612)
feat: build metadata
2024-06-26 08:25:09 -04:00

74 lines
1.8 KiB
TypeScript

import { Controller, Get } from '@nestjs/common';
import { ApiTags } from '@nestjs/swagger';
import {
ServerAboutResponseDto,
ServerConfigDto,
ServerFeaturesDto,
ServerMediaTypesResponseDto,
ServerPingResponse,
ServerStatsResponseDto,
ServerStorageResponseDto,
ServerThemeDto,
ServerVersionResponseDto,
} from 'src/dtos/server-info.dto';
import { Authenticated } from 'src/middleware/auth.guard';
import { ServerInfoService } from 'src/services/server-info.service';
import { VersionService } from 'src/services/version.service';
@ApiTags('Server Info')
@Controller('server-info')
export class ServerInfoController {
constructor(
private service: ServerInfoService,
private versionService: VersionService,
) {}
@Get('about')
@Authenticated()
getAboutInfo(): Promise<ServerAboutResponseDto> {
return this.service.getAboutInfo();
}
@Get('storage')
@Authenticated()
getStorage(): Promise<ServerStorageResponseDto> {
return this.service.getStorage();
}
@Get('ping')
pingServer(): ServerPingResponse {
return this.service.ping();
}
@Get('version')
getServerVersion(): ServerVersionResponseDto {
return this.versionService.getVersion();
}
@Get('features')
getServerFeatures(): Promise<ServerFeaturesDto> {
return this.service.getFeatures();
}
@Get('theme')
getTheme(): Promise<ServerThemeDto> {
return this.service.getTheme();
}
@Get('config')
getServerConfig(): Promise<ServerConfigDto> {
return this.service.getConfig();
}
@Authenticated({ admin: true })
@Get('statistics')
getServerStatistics(): Promise<ServerStatsResponseDto> {
return this.service.getStatistics();
}
@Get('media-types')
getSupportedMediaTypes(): ServerMediaTypesResponseDto {
return this.service.getSupportedMediaTypes();
}
}