import { Controller, Post, Body, UsePipes, ValidationPipe, Get, UseGuards } from '@nestjs/common'; import { UserService } from './user.service'; import { UserDTO } from './user.dto'; import { AuthGuard } from 'src/shared/auth.guard'; @Controller('user') export class UserController { constructor(private userService: UserService) {} @Post('register') @UsePipes(new ValidationPipe()) createUser(@Body() data: UserDTO) { return this.userService.register(data); } @Post('login') @UsePipes(new ValidationPipe()) loginUser(@Body() data: UserDTO) { return this.userService.login(data); } @Get('map') @UseGuards(new AuthGuard()) showMap() { return 'karttanäkymä accessed'; } }