Files
immich/server/src/controllers/system-metadata.controller.ts

58 lines
2.1 KiB
TypeScript
Raw Normal View History

import { Body, Controller, Get, HttpCode, HttpStatus, Post } from '@nestjs/common';
2025-11-11 17:01:14 -05:00
import { ApiOperation, ApiTags } from '@nestjs/swagger';
2025-05-27 16:33:23 +02:00
import {
AdminOnboardingUpdateDto,
ReverseGeocodingStateResponseDto,
VersionCheckStateResponseDto,
} from 'src/dtos/system-metadata.dto';
2025-11-11 17:01:14 -05:00
import { ApiTag, Permission } from 'src/enum';
import { Authenticated } from 'src/middleware/auth.guard';
import { SystemMetadataService } from 'src/services/system-metadata.service';
2025-11-11 17:01:14 -05:00
@ApiTags(ApiTag.SystemMetadata)
@Controller('system-metadata')
export class SystemMetadataController {
constructor(private service: SystemMetadataService) {}
@Get('admin-onboarding')
2025-07-15 14:50:13 -04:00
@Authenticated({ permission: Permission.SystemMetadataRead, admin: true })
2025-11-11 17:01:14 -05:00
@ApiOperation({
summary: 'Retrieve admin onboarding',
description: 'Retrieve the current admin onboarding status.',
})
getAdminOnboarding(): Promise<AdminOnboardingUpdateDto> {
return this.service.getAdminOnboarding();
}
@Post('admin-onboarding')
2025-07-15 14:50:13 -04:00
@Authenticated({ permission: Permission.SystemMetadataUpdate, admin: true })
@HttpCode(HttpStatus.NO_CONTENT)
2025-11-11 17:01:14 -05:00
@ApiOperation({
summary: 'Update admin onboarding',
description: 'Update the admin onboarding status.',
})
updateAdminOnboarding(@Body() dto: AdminOnboardingUpdateDto): Promise<void> {
return this.service.updateAdminOnboarding(dto);
}
@Get('reverse-geocoding-state')
2025-07-15 14:50:13 -04:00
@Authenticated({ permission: Permission.SystemMetadataRead, admin: true })
2025-11-11 17:01:14 -05:00
@ApiOperation({
summary: 'Retrieve reverse geocoding state',
description: 'Retrieve the current state of the reverse geocoding import.',
})
getReverseGeocodingState(): Promise<ReverseGeocodingStateResponseDto> {
return this.service.getReverseGeocodingState();
}
2025-05-27 16:33:23 +02:00
@Get('version-check-state')
2025-07-15 14:50:13 -04:00
@Authenticated({ permission: Permission.SystemMetadataRead, admin: true })
2025-11-11 17:01:14 -05:00
@ApiOperation({
summary: 'Retrieve version check state',
description: 'Retrieve the current state of the version check process.',
})
2025-05-27 16:33:23 +02:00
getVersionCheckState(): Promise<VersionCheckStateResponseDto> {
return this.service.getVersionCheckState();
}
}