Skip to content

Commit

Permalink
✨ feat: 컨트롤러 작성 (#27)
Browse files Browse the repository at this point in the history
  • Loading branch information
jiiiiiw committed Feb 29, 2024
1 parent 7c8423a commit 3e882e0
Showing 1 changed file with 33 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package com.smunity.petition.domain.account.controller;

import com.smunity.petition.domain.account.dto.UserLoginRequestDto;
import com.smunity.petition.domain.account.dto.UserLoginResponseDto;
import com.smunity.petition.domain.account.dto.UserSignupRequestDto;
import com.smunity.petition.domain.account.dto.UserSignupResponseDto;
import com.smunity.petition.domain.account.service.AccountsService;
import com.smunity.petition.global.common.ApiResponse;
import jakarta.validation.Valid;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RequiredArgsConstructor
@RestController
@RequestMapping("/api/v1/accounts")
public class AccountsController {
private final AccountsService accountsService;

@PostMapping("/login")
public ApiResponse<UserLoginResponseDto> login(@Valid @RequestBody UserLoginRequestDto requestDto) {
return ApiResponse.onSuccess(accountsService.login(requestDto));
}

@PostMapping("/signup")
public ApiResponse<UserSignupResponseDto> signup(@Valid @RequestBody UserSignupRequestDto requestDto) {
return ApiResponse.onSuccess(accountsService.signup(requestDto));
}
}

0 comments on commit 3e882e0

Please sign in to comment.