chore: import DH V2 D5.6.4 production baseline
This commit is contained in:
@@ -0,0 +1,65 @@
|
||||
import {
|
||||
Body,
|
||||
Controller,
|
||||
Delete,
|
||||
Get,
|
||||
Param,
|
||||
ParseUUIDPipe,
|
||||
Put,
|
||||
Query,
|
||||
Req,
|
||||
} from '@nestjs/common';
|
||||
import { RequirePermissions } from '../authorization/decorators/require-permissions.decorator';
|
||||
import { CurrentAuth } from '../auth/decorators/current-auth.decorator';
|
||||
import type {
|
||||
AuthPrincipal,
|
||||
RequestWithContext,
|
||||
} from '../common/http/request-context';
|
||||
import { AssetGeometriesService } from './asset-geometries.service';
|
||||
import { MapAssetsQueryDto } from './dto/map-assets-query.dto';
|
||||
import { UpsertAssetGeometryDto } from './dto/upsert-asset-geometry.dto';
|
||||
|
||||
@Controller('assets')
|
||||
export class AssetGeometriesController {
|
||||
constructor(private readonly geometries: AssetGeometriesService) {}
|
||||
|
||||
@Get(':id/geometry')
|
||||
@RequirePermissions('assets.read')
|
||||
get(
|
||||
@Param('id', new ParseUUIDPipe({ version: '4' })) id: string,
|
||||
) {
|
||||
return this.geometries.get(id);
|
||||
}
|
||||
|
||||
@Put(':id/geometry')
|
||||
@RequirePermissions('assets.update_geometry')
|
||||
upsert(
|
||||
@Param('id', new ParseUUIDPipe({ version: '4' })) id: string,
|
||||
@Body() dto: UpsertAssetGeometryDto,
|
||||
@CurrentAuth() principal: AuthPrincipal,
|
||||
@Req() request: RequestWithContext,
|
||||
) {
|
||||
return this.geometries.upsert(id, dto, principal, request);
|
||||
}
|
||||
|
||||
@Delete(':id/geometry')
|
||||
@RequirePermissions('assets.update_geometry')
|
||||
remove(
|
||||
@Param('id', new ParseUUIDPipe({ version: '4' })) id: string,
|
||||
@CurrentAuth() principal: AuthPrincipal,
|
||||
@Req() request: RequestWithContext,
|
||||
) {
|
||||
return this.geometries.remove(id, principal, request);
|
||||
}
|
||||
}
|
||||
|
||||
@Controller('map/assets')
|
||||
export class MapAssetsController {
|
||||
constructor(private readonly geometries: AssetGeometriesService) {}
|
||||
|
||||
@Get()
|
||||
@RequirePermissions('assets.read')
|
||||
map(@Query() query: MapAssetsQueryDto) {
|
||||
return this.geometries.map(query);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user