nestjs rewrite
This commit is contained in:
42
server/src/gis/gis.controller.ts
Normal file
42
server/src/gis/gis.controller.ts
Normal file
@ -0,0 +1,42 @@
|
||||
import { Controller, Get, Param, ParseIntPipe, Query } from '@nestjs/common';
|
||||
import { GisService } from './gis.service';
|
||||
|
||||
@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)
|
||||
}
|
||||
|
||||
@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()
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user