2024-04-19 20:36:15 -04:00
|
|
|
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';
|
2024-04-19 20:36:15 -04:00
|
|
|
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)
|
2024-04-19 20:36:15 -04:00
|
|
|
@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.',
|
|
|
|
|
})
|
2024-04-19 20:36:15 -04:00
|
|
|
getAdminOnboarding(): Promise<AdminOnboardingUpdateDto> {
|
|
|
|
|
return this.service.getAdminOnboarding();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Post('admin-onboarding')
|
2025-07-15 14:50:13 -04:00
|
|
|
@Authenticated({ permission: Permission.SystemMetadataUpdate, admin: true })
|
2025-08-08 15:56:37 -04:00
|
|
|
@HttpCode(HttpStatus.NO_CONTENT)
|
2025-11-11 17:01:14 -05:00
|
|
|
@ApiOperation({
|
|
|
|
|
summary: 'Update admin onboarding',
|
|
|
|
|
description: 'Update the admin onboarding status.',
|
|
|
|
|
})
|
2024-04-19 20:36:15 -04:00
|
|
|
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.',
|
|
|
|
|
})
|
2024-04-19 20:36:15 -04:00
|
|
|
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();
|
|
|
|
|
}
|
2024-04-19 20:36:15 -04:00
|
|
|
}
|