generated from moevm/nsql-clean-tempate
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #16 from moevm/routes
Routes module
- Loading branch information
Showing
8 changed files
with
161 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,34 @@ | ||
import {Body, Controller, Get, Param, Post, UsePipes, ValidationPipe} from '@nestjs/common'; | ||
import {RoutesService} from './routes.service'; | ||
import {CreateRouteDto} from "./dto/create-route.dto"; | ||
import {Public} from "../authorization/public.decorator"; | ||
import { Body, Controller, Get, HttpCode, HttpStatus, Param, Post, Req, UsePipes, ValidationPipe } from '@nestjs/common'; | ||
import { RoutesService } from './routes.service'; | ||
import { Public } from '../authorization/public.decorator'; | ||
import { CreateRouteDto } from './dto/create-route.dto'; | ||
|
||
@Controller("/api/route") | ||
@Controller("/api/routes") | ||
export class RoutesController { | ||
constructor(private readonly RoutesService: RoutesService) { | ||
} | ||
|
||
@UsePipes(new ValidationPipe()) | ||
@Post() | ||
async create(@Body() createRoutesDto: CreateRouteDto) { | ||
return await this.RoutesService.create(createRoutesDto); | ||
async create(@Body() createRouteDto: CreateRouteDto, @Req() req: any) { | ||
console.log(req.user) | ||
return this.RoutesService.create(createRouteDto, req.user.sub); | ||
} | ||
|
||
@Public() | ||
@HttpCode(HttpStatus.OK) | ||
@Post("build") | ||
async build(@Body() poiList: string[]) { | ||
return await this.RoutesService.build(poiList); | ||
} | ||
|
||
@Get() | ||
findAll() { | ||
async findAll() { | ||
return this.RoutesService.findAll(); | ||
} | ||
|
||
@Public() | ||
@Get(':id') | ||
findOne(@Param('id') id: string) { | ||
async findOne(@Param('id') id: string) { | ||
return this.RoutesService.findOne(id); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters