Skip to content

Commit

Permalink
[#45]Feat: 소셜로그인 닉네임 생성 규칙 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
EveKristinLee committed Mar 14, 2022
1 parent b1d6f86 commit a7ffbe5
Show file tree
Hide file tree
Showing 46 changed files with 772 additions and 315 deletions.
21 changes: 0 additions & 21 deletions backend/src/main/java/moviegoods/movie/configure/ApiKeyConfig.java

This file was deleted.

22 changes: 9 additions & 13 deletions backend/src/main/java/moviegoods/movie/configure/WebConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,11 @@

import moviegoods.movie.domain.argumentresolver.LoginMemberArgumentResolver;
import moviegoods.movie.domain.interceptor.LoginCheckInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.method.support.HandlerMethodArgumentResolver;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import javax.servlet.Filter;
import java.util.List;

@Configuration
Expand All @@ -21,13 +17,13 @@ public void addArgumentResolvers(List<HandlerMethodArgumentResolver> resolvers)
resolvers.add(new LoginMemberArgumentResolver());
}

// @Override
// public void addInterceptors(InterceptorRegistry registry) {
//
// registry.addInterceptor(new LoginCheckInterceptor())
// .order(2)
// .addPathPatterns("/event/like", "/mypage", "/transactions/search")
// .excludePathPatterns("/main/**", "/members/add", "/signin", "/logout",
// "/css/**", "/*.ico", "/error");
// }
@Override
public void addInterceptors(InterceptorRegistry registry) {

registry.addInterceptor(new LoginCheckInterceptor())
.order(2)
.addPathPatterns("/direct-message", "/mypage")
.excludePathPatterns("/main/**", "/members/add", "/signin", "/logout",
"/css/**", "/*.ico", "/error");
}
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package moviegoods.movie.configure;

import moviegoods.movie.domain.interceptor.HttpHandshakeInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.messaging.simp.config.MessageBrokerRegistry;
import org.springframework.web.socket.config.annotation.EnableWebSocketMessageBroker;
import org.springframework.web.socket.config.annotation.StompEndpointRegistry;
import org.springframework.web.socket.config.annotation.WebSocketMessageBrokerConfigurer;
import org.springframework.web.socket.server.support.HttpSessionHandshakeInterceptor;

@Configuration
@EnableWebSocketMessageBroker
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,18 @@ public class ChatController {
private final FireBaseService fireBaseService;

@MessageMapping("/chat/message")
public void message(@Login User loginUser, DirectMessage message, SimpMessageHeaderAccessor headerAccessor) throws IOException, FirebaseAuthException {
User user1 = (User) headerAccessor.getSessionAttributes().get(SessionConfig.SessionConst.LOGIN_MEMBER);

// if(message.getMessageType().equals(DirectMessage.MessageType.ENTER)) {
// message.setContent(message.getNickname() + "입장");
public void message(@Login User loginUser,DirectMessage message, SimpMessageHeaderAccessor headerAccessor) throws IOException, FirebaseAuthException {

//}
messageService.saveMessage(user1,message);
User user1 = (User) headerAccessor.getSessionAttributes().get(SessionConfig.SessionConst.LOGIN_MEMBER);
String url= messageService.saveMessage(user1,message);
if(message.getImage_url()!=null){
message.setImage_url(url);
}else{
message.setImage_url("");
}
message.setNickname(user1.getNickname());
message.setUser_id(user1.getUser_id());
log.info("message={}", message);


messagingTemplate.convertAndSend("/sub/chat/room/"+message.getChat_room_id(), message);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import moviegoods.movie.domain.argumentresolver.Login;
import moviegoods.movie.domain.dto.booleanResult.ResultResponseDto;
import moviegoods.movie.domain.dto.directMessage.DirectMessageCreateRoomRequestDto;
import moviegoods.movie.domain.dto.directMessage.DirectMessageCreateRoomResponseDto;
import moviegoods.movie.domain.dto.directMessage.DirectMessageDetailResponseDto;
Expand Down Expand Up @@ -32,7 +33,13 @@ public class ChatRoomController {
@PostMapping
public ResponseEntity<DirectMessageCreateRoomResponseDto> create(@Login User loginUser, @RequestBody DirectMessageCreateRoomRequestDto requestDto){
DirectMessageCreateRoomResponseDto responseDto = chatRoomService.createRoom(loginUser, requestDto);
ResponseEntity<DirectMessageCreateRoomResponseDto> result = new ResponseEntity<>(responseDto, HttpStatus.OK);
ResponseEntity<DirectMessageCreateRoomResponseDto> result;
result = new ResponseEntity<>(responseDto, HttpStatus.OK);

if (!responseDto.isResult()) {
result = new ResponseEntity<>(responseDto, HttpStatus.UNAUTHORIZED);
}

return result;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import moviegoods.movie.configure.SessionConfig;
import moviegoods.movie.domain.argumentresolver.Login;
import moviegoods.movie.domain.dto.booleanResult.ResultResponseDto;
import moviegoods.movie.domain.dto.events.*;
Expand All @@ -12,7 +11,6 @@
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import java.text.ParseException;
import java.util.List;

@RestController
Expand All @@ -24,23 +22,32 @@ public class EventsController {
private final EventsService eventsService;

@GetMapping("/search")
public ResponseEntity<List<EventsSearchResponseDto>> search(@Login User loginUser, @ModelAttribute EventsSearchRequestDto requestDto) throws ParseException {
public ResponseEntity<List<EventsSearchResponseDto>> search(@Login User loginUser, @ModelAttribute EventsSearchRequestDto requestDto) {
List<EventsSearchResponseDto> list = eventsService.search(loginUser, requestDto);
ResponseEntity<List<EventsSearchResponseDto>> result = new ResponseEntity<>(list, HttpStatus.OK);

return result;
}

@GetMapping("/detail")
public ResponseEntity<EventsDetailResponseDto> detail(@Login User loginUser, @ModelAttribute EventsDetailRequestDto requestDto) throws ParseException {
public ResponseEntity<EventsDetailResponseDto> detail(@Login User loginUser, @ModelAttribute EventsDetailRequestDto requestDto) {
EventsDetailResponseDto detail_result = eventsService.detail(loginUser, requestDto);
ResponseEntity<EventsDetailResponseDto> result = new ResponseEntity<>(detail_result, HttpStatus.OK);

return result;
}

@PostMapping("/like")
public ResultResponseDto like(@Login User loginUser, @RequestBody EventsLikeRequestDto requestDto) throws ParseException {
public ResponseEntity<ResultResponseDto> like(@Login User loginUser, @RequestBody EventsLikeRequestDto requestDto) {
ResultResponseDto resultResponseDto = eventsService.like(loginUser, requestDto);
return resultResponseDto;
ResponseEntity<ResultResponseDto> result;
result = new ResponseEntity<>(resultResponseDto, HttpStatus.OK);

if (!resultResponseDto.isResult()) {
result = new ResponseEntity<>(resultResponseDto, HttpStatus.UNAUTHORIZED);
}

return result;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
package moviegoods.movie.controller;

import com.google.firebase.auth.FirebaseAuthException;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import moviegoods.movie.domain.argumentresolver.Login;
import moviegoods.movie.domain.dto.booleanResult.ResultResponseDto;
import moviegoods.movie.domain.dto.generalBoard.*;
import moviegoods.movie.domain.entity.User.User;
import moviegoods.movie.service.GeneralBoardService;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;
import java.util.List;



@RestController
@Slf4j
@RequiredArgsConstructor
@RequestMapping("/general-board")
public class GeneralBoardController {
private final GeneralBoardService generalBoardService;

@PostMapping("/write")
public ResponseEntity<ResultResponseDto> write(@Login User loginUser, @RequestParam(value="image_url",required = false) MultipartFile image_url,
@RequestParam(value="title")String title,
@RequestParam(value="content")String content
) throws IOException, FirebaseAuthException {
GeneralBoardWriteRequestDto requestDto = new GeneralBoardWriteRequestDto(title, content, image_url);
ResultResponseDto resultResponseDto = generalBoardService.savePost(loginUser,requestDto);

ResponseEntity<ResultResponseDto> result;
result = new ResponseEntity<>(resultResponseDto, HttpStatus.OK);

if (!resultResponseDto.isResult()) {
result = new ResponseEntity<>(resultResponseDto, HttpStatus.UNAUTHORIZED);
}

return result;

}

@GetMapping("/search")
public ResponseEntity<List<GeneralBoardSearchResponseDto>> search(@ModelAttribute GeneralBoardSearchRequestDto requestDto){
List<GeneralBoardSearchResponseDto> list = generalBoardService.search(requestDto);
ResponseEntity<List<GeneralBoardSearchResponseDto>> entity = new ResponseEntity<>(list, HttpStatus.OK);

return entity;
}

@GetMapping("/detail")
public GeneralBoardDetailResponseDto detail(@Login User loginUser, @ModelAttribute GeneralBoardDetailRequestDto requestDto){
GeneralBoardDetailResponseDto responseDto = generalBoardService.detailInfo(loginUser, requestDto);

return responseDto;
}

@PostMapping("/comment")
public ResponseEntity<ResultResponseDto> saveComment(@Login User loginUser, @RequestBody GeneralBoardCommentRequestDto requestDto){
ResultResponseDto resultResponseDto = generalBoardService.saveComment(loginUser,requestDto);
ResponseEntity<ResultResponseDto> result;
result = new ResponseEntity<>(resultResponseDto, HttpStatus.OK);

if (!resultResponseDto.isResult()) {
result = new ResponseEntity<>(resultResponseDto, HttpStatus.UNAUTHORIZED);
}

return result;
}

@DeleteMapping("/detail")
public ResultResponseDto deleteDetail(@Login User loginUser, @RequestBody GeneralBoardDetailDeleteRequestDto requestDto){
ResultResponseDto resultResponseDto=generalBoardService.deleteDetail(loginUser, requestDto);

return resultResponseDto;
}

@DeleteMapping("/comment")
public ResultResponseDto deleteComment(@Login User loginUser, @RequestBody GeneralBoardCommentDeleteRequestDto requestDto){
ResultResponseDto resultResponseDto=generalBoardService.deleteComment(loginUser, requestDto);

return resultResponseDto;
}


}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import moviegoods.movie.domain.argumentresolver.Login;
import moviegoods.movie.domain.dto.booleanResult.ResultResponseDto;
import moviegoods.movie.domain.dto.informationShare.*;
import moviegoods.movie.domain.entity.Comment.Comment;
import moviegoods.movie.domain.entity.Post.Post;
import moviegoods.movie.domain.entity.User.User;
import moviegoods.movie.service.FireBaseService;
Expand All @@ -31,22 +30,26 @@ public class InformationShareController {
private final FireBaseService fireBaseService;

@PostMapping("/write")
public Result write2(@Login User loginUser, @RequestParam(value="image_url",required = false)MultipartFile image_url,
public ResponseEntity<Result> write2(@Login User loginUser, @RequestParam(value="image_url",required = false)MultipartFile image_url,
@RequestParam(value="cinema_name")String cinema_name,
@RequestParam(value="cinema_area")String cinema_area,
@RequestParam(value="cinema_branch")String cinema_branch,
@RequestParam(value="title")String title,
@RequestParam(value="content")String content
) throws IOException, FirebaseAuthException {
Long user_id = null;
if (loginUser != null) {
user_id = loginUser.getUser_id();
}
ResponseEntity<Result> result2;
Result result=new Result();
if (cinema_area.equals("") || cinema_name.equals("") || cinema_branch.equals("") || user_id.equals("") || title.equals("") || content.equals("")) {
if (loginUser == null) {
result2 = new ResponseEntity<>(result, HttpStatus.UNAUTHORIZED);
return result2;
}
Long user_id = loginUser.getUser_id();

if (cinema_area.equals("") || cinema_name.equals("") || cinema_branch.equals("") || user_id.equals("") || title.equals("") || content.equals("")) {
result.setResult(false);
return result;
result2 = new ResponseEntity<>(result, HttpStatus.OK);

return result2;
}
InformationShareRequestWrite isrw=new InformationShareRequestWrite(user_id,image_url,cinema_branch,cinema_area,cinema_name,title,content);

Expand All @@ -58,9 +61,10 @@ public Result write2(@Login User loginUser, @RequestParam(value="image_url",requ
log.info("저장된 post_user_id={}",post.getUser().getUser_id());
}


result.setResult(true);
return result;
result2 = new ResponseEntity<>(result, HttpStatus.OK);

return result2;

}

Expand All @@ -78,10 +82,16 @@ public InformationShareResponseDetail detail(@Login User loginUser, @ModelAttrib
}

@PostMapping("/comment")
public ResultResponseDto saveComment(@Login User loginUser, @RequestBody InformationShareRequestSaveComment isrsc){
public ResponseEntity<ResultResponseDto> saveComment(@Login User loginUser, @RequestBody InformationShareRequestSaveComment isrsc){
ResultResponseDto resultResponseDto=informationShareService.saveComment(loginUser,isrsc);
ResponseEntity<ResultResponseDto> result;
result = new ResponseEntity<>(resultResponseDto, HttpStatus.OK);

return resultResponseDto;
if (!resultResponseDto.isResult()) {
result = new ResponseEntity<>(resultResponseDto, HttpStatus.UNAUTHORIZED);
}

return result;
}

@DeleteMapping("/detail")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import moviegoods.movie.domain.argumentresolver.Login;
import moviegoods.movie.domain.dto.booleanResult.ResultResponseDto;
import moviegoods.movie.domain.dto.logout.LogOutRequestDto;
import moviegoods.movie.domain.entity.User.User;
import moviegoods.movie.service.LogOutService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
Expand All @@ -18,13 +18,14 @@
@Slf4j
@RestController
@RequiredArgsConstructor
@RequestMapping("users/logout")
public class LogOutController {

private final LogOutService logOutService;

@PostMapping("/logout")
public ResultResponseDto logout(@RequestBody LogOutRequestDto requestDto, HttpSession session) throws IOException {
ResultResponseDto resultResponseDto = logOutService.logout(requestDto, session);
@PostMapping
public ResultResponseDto logout(@Login User loginUser, HttpSession session) {
ResultResponseDto resultResponseDto = logOutService.logout(loginUser, session);
return resultResponseDto;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,14 @@ public MainVideoResponseDto video() throws IOException {
}

@GetMapping("/event-limit")
public ResponseEntity<List<MainEventLimitResponseDto>> eventLimit(@Login User loginUser) throws ParseException {
public ResponseEntity<List<MainEventLimitResponseDto>> eventLimit(@Login User loginUser){
List<MainEventLimitResponseDto> list = mainService.eventLimit(loginUser);
ResponseEntity<List<MainEventLimitResponseDto>> result = new ResponseEntity<>(list, HttpStatus.OK);
return result;
}

@GetMapping("/daily-community")
public ResponseEntity<List<MainDailyCommunityResponseDto>> dailyCommunity(@ModelAttribute MainDailyCommunityRequestDto requestDto) throws ParseException {
public ResponseEntity<List<MainDailyCommunityResponseDto>> dailyCommunity(@ModelAttribute MainDailyCommunityRequestDto requestDto) {
List<MainDailyCommunityResponseDto> list = mainService.dailyCommunity(requestDto);
ResponseEntity<List<MainDailyCommunityResponseDto>> result = new ResponseEntity<>(list, HttpStatus.OK);
return result;
Expand Down
Loading

0 comments on commit a7ffbe5

Please sign in to comment.