diff --git a/backend/src/auth/auth.controller.ts b/backend/src/auth/auth.controller.ts index 438de09..5d2b76a 100644 --- a/backend/src/auth/auth.controller.ts +++ b/backend/src/auth/auth.controller.ts @@ -1,21 +1,19 @@ import { Controller, Post, Body } from '@nestjs/common'; import { AuthService } from './auth.service'; +import { CreateUserDto } from './dto/create-user.dto'; +import { LoginUserDto } from './dto/login-user.dto'; @Controller('auth') export class AuthController { constructor(private readonly authService: AuthService) {} - @Post() - login(@Body('email') email: string, @Body('password') password: string) { - return { email, password }; + @Post('/login') + login(@Body() loginUserDto: LoginUserDto) { + return loginUserDto; } - @Post() - signup( - @Body('name') name: string, - @Body('email') email: string, - @Body('password') password: string, - ) { - return { name, email, password }; + @Post('/signup') + signup(@Body() createUserDto: CreateUserDto) { + return createUserDto; } } diff --git a/backend/src/auth/dto/create-user.dto.ts b/backend/src/auth/dto/create-user.dto.ts new file mode 100644 index 0000000..6f47eca --- /dev/null +++ b/backend/src/auth/dto/create-user.dto.ts @@ -0,0 +1,12 @@ +import { IsString, IsEmail } from 'class-validator'; + +export class CreateUserDto { + @IsString() + name: string; + + @IsEmail() + email: string; + + @IsString() + password: string; +} diff --git a/backend/src/auth/dto/login-user.dto.ts b/backend/src/auth/dto/login-user.dto.ts new file mode 100644 index 0000000..33d0056 --- /dev/null +++ b/backend/src/auth/dto/login-user.dto.ts @@ -0,0 +1,9 @@ +import { IsString, IsEmail } from 'class-validator'; + +export class LoginUserDto { + @IsEmail() + email: string; + + @IsString() + password: string; +} diff --git a/backend/src/comment/comment.controller.ts b/backend/src/comment/comment.controller.ts index 287b3f0..b14269a 100644 --- a/backend/src/comment/comment.controller.ts +++ b/backend/src/comment/comment.controller.ts @@ -1,12 +1,39 @@ -import { Controller, Get } from '@nestjs/common'; +import { Controller, Get, Post, Delete } from '@nestjs/common'; import { CommentService } from './comment.service'; @Controller('comment') export class CommentController { constructor(private readonly commentService: CommentService) {} - @Get() - getUser(): string { + @Post() + createComment() { return 'get user information'; } + + // 특정 웹툰의 댓글을 보는 기능 + @Get('webtoon/:webtoonId') + getWebtoonComments() { + return 'geting comments'; + } + + // 자신이 쓴 댓글 목록을 보는 기능 + @Get('user/:userId') + getUserComments() { + return 'reading comments'; + } + + @Post('like') + clickLike() { + return 'click like'; + } + + @Post('dislike') + clickDislike() { + return 'click like'; + } + + @Delete(':commentId') + deleteComment() { + return 'delete comment'; + } } diff --git a/backend/src/user/dto/update-user.dto.ts b/backend/src/user/dto/update-user.dto.ts new file mode 100644 index 0000000..5520203 --- /dev/null +++ b/backend/src/user/dto/update-user.dto.ts @@ -0,0 +1,12 @@ +import { IsString, IsEmail } from 'class-validator'; + +export class UpdateUserDto { + @IsString() + name: string; + + @IsEmail() + email: string; + + @IsString() + password: string; +} diff --git a/backend/src/user/user.controller.ts b/backend/src/user/user.controller.ts index 36931ee..6c71552 100644 --- a/backend/src/user/user.controller.ts +++ b/backend/src/user/user.controller.ts @@ -1,12 +1,23 @@ -import { Controller, Get } from '@nestjs/common'; +import { Controller, Get, Put, Delete, Body } from '@nestjs/common'; import { UserService } from './user.service'; +import { UpdateUserDto } from './dto/update-user.dto'; @Controller('user') export class UserController { constructor(private readonly userService: UserService) {} @Get() - getUser(): string { + getUser() { return 'get user information'; } + + @Put() + updateUser(@Body() updateUserDto: UpdateUserDto) { + return updateUserDto; + } + + @Delete() + deleteUser() { + return 'delete user'; + } }