import { Body, Controller, Get, Param, ParseIntPipe, Post, Query } from '@nestjs/common'; import { GisService } from './gis.service'; import { ApiBody } from '@nestjs/swagger'; import { BoundsRequestDto } from './dto/bound'; @Controller('gis') export class GisController { constructor(private readonly gisService: GisService) { } @Get('/type-roles') async getTypeRoles() { return await this.gisService.getTypeRoles() } @Get('/bounds/:entity_type') async getBoundsByEntityType(@Param('entity_type') entity_type: 'region' | 'district' | 'city') { return await this.gisService.getBoundsByEntityType(entity_type) } @Get('/bounds/:entity_type/:entity_id') async getBoundsByEntityTypeAndId(@Param('entity_type') entity_type: 'region' | 'district' | 'city', @Param('entity_id', new ParseIntPipe()) entity_id: number) { return await this.gisService.getBoundsByEntityTypeAndId(entity_type, entity_id) } @Post('/bounds/:entity_type') @ApiBody({ type: BoundsRequestDto }) async getBoundsByEntityTypeAndList( @Param('entity_type') entity_type: 'region' | 'district' | 'city', @Body('list') list: number[], ) { return await this.gisService.getBoundsByEntityTypeAndList(entity_type, list); } @Get('/images/all') async getImages(@Query('offset') offset: number, @Query('limit') limit: number, @Query('city_id') city_id: number) { return await this.gisService.getImages(offset, limit, city_id) } @Get('/figures/all') async getFigures(@Query('offset') offset: number, @Query('limit') limit: number, @Query('year') year: number, @Query('city_id') city_id: number) { return await this.gisService.getFigures(offset, limit, year, city_id) } @Get('/lines/all') async getLines(@Query('year') year: number, @Query('city_id') city_id: number) { return await this.gisService.getLines(year, city_id) } @Get('/regions/borders') async getRegionBorders() { return await this.gisService.getRegionBorders() } }