Skip to content

Commit

Permalink
Merge pull request #263 from WE-ARE-RACCOONS/RAC-367
Browse files Browse the repository at this point in the history
RAC-367 feat : ํ›„๋ฐฐ ํšŒ์›๊ฐ€์ž…์‹œ ๋งค์นญ ๋™์˜์—ฌ๋ถ€์— ๋”ฐ๋ผ ์•Œ๋ฆผํ†ก ์ „์†ก ๊ธฐ๋Šฅ ์ถ”๊ฐ€
  • Loading branch information
ywj9811 authored May 15, 2024
2 parents 91df0b8 + a4d7b71 commit af200b9
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import com.postgraduate.domain.wish.application.mapper.WishMapper;
import com.postgraduate.domain.wish.domain.entity.Wish;
import com.postgraduate.domain.wish.domain.service.WishSaveService;
import com.postgraduate.global.bizppurio.application.usecase.BizppurioJuniorMessage;
import com.postgraduate.global.bizppurio.application.usecase.BizppurioSeniorMessage;
import com.postgraduate.global.slack.SlackSignUpMessage;
import lombok.RequiredArgsConstructor;
Expand Down Expand Up @@ -43,13 +44,16 @@ public class SignUpUseCase {
private final UserUtils userUtils;
private final SeniorUtils seniorUtils;
private final BizppurioSeniorMessage bizppurioSeniorMessage;
private final BizppurioJuniorMessage bizppurioJuniorMessage;

public User userSignUp(SignUpRequest request) {
userUtils.checkPhoneNumber(request.phoneNumber());
User user = mapToUser(request, profile);
Wish wish = WishMapper.mapToWish(user, request);
wishSaveService.save(wish);
userSaveService.save(user);
if (request.matchingReceive())
bizppurioJuniorMessage.matchingWaiting(user);
slackSignUpMessage.sendJuniorSignUp(user, wish);
return user;
}
Expand All @@ -72,6 +76,8 @@ public User changeSenior(User user, SeniorChangeRequest changeRequest) {
public void changeUser(User user, UserChangeRequest changeRequest) {
Wish wish = WishMapper.mapToWish(user, changeRequest);
wishSaveService.save(wish);
if (changeRequest.matchingReceive())
bizppurioJuniorMessage.matchingWaiting(user);
slackSignUpMessage.sendJuniorSignUp(user, wish);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
package com.postgraduate.global.bizppurio.application.mapper;

import com.postgraduate.global.bizppurio.application.dto.req.JuniorMatchingFailRequest;
import com.postgraduate.global.bizppurio.application.dto.req.JuniorMatchingSuccessRequest;
import com.postgraduate.global.bizppurio.application.dto.req.JuniorMatchingWaitingRequest;
import com.postgraduate.domain.user.domain.entity.User;
import com.postgraduate.global.bizppurio.application.dto.req.CommonRequest;
import com.postgraduate.global.bizppurio.application.dto.req.ContentRequest;
import com.postgraduate.global.bizppurio.application.dto.req.JuniorMatchingFailRequest;
import com.postgraduate.global.bizppurio.application.dto.req.JuniorMatchingSuccessRequest;
import com.postgraduate.global.bizppurio.application.dto.req.content.*;
import com.postgraduate.global.bizppurio.application.dto.req.content.button.WebLinkButton;
import org.springframework.beans.factory.annotation.Value;
Expand Down Expand Up @@ -239,19 +238,19 @@ public CommonRequest mapToJuniorMatchingSuccess(JuniorMatchingSuccessRequest req
return createCommonRequest(messageBody, request.phoneNumber());
}

public CommonRequest mapToJuniorMatchingWaiting(JuniorMatchingWaitingRequest request) {
public CommonRequest mapToJuniorMatchingWaiting(User user) {
String message = (
"์•ˆ๋…•ํ•˜์„ธ์š”, " + request.name() + "๋‹˜.\n" +
"์•ˆ๋…•ํ•˜์„ธ์š”, " + user.getNickName() + "๋‹˜.\n" +
"\n" +
"๊น€์„ ๋ฐฐ์™€ ํ•จ๊ป˜ ํ•ด์ฃผ์…”์„œ ๊ฐ์‚ฌ๋“œ๋ฆฝ๋‹ˆ๋‹ค.\n" +
"\n" +
request.name() + "๋‹˜์ด ์‹ ์ฒญํ•œ ์„ ๋ฐฐ๋ฅผ ์ €ํฌ ๊น€์„ ๋ฐฐ์—์„œ ์ฐพ๊ณ  ์žˆ์–ด์š” !\n" +
user.getNickName() + "๋‹˜์ด ์‹ ์ฒญํ•œ ์„ ๋ฐฐ๋ฅผ ์ €ํฌ ๊น€์„ ๋ฐฐ์—์„œ ์ฐพ๊ณ  ์žˆ์–ด์š” !\n" +
"\n" +
"์‹ ์ฒญํ•ด์ฃผ์‹  ์„ ๋ฐฐ๋ฅผ ์ฐพ๋Š”๋ฐ์—๋Š” 3~7์ผ ์ •๋„ ์†Œ์š”๋˜์–ด์š” \uD83D\uDE0A"
);
);

JuniorMatchingWaitingMessage messageBody = new JuniorMatchingWaitingMessage(message, senderKey, juniorMatchingWaiting);
return createCommonRequest(messageBody, request.phoneNumber());
return createCommonRequest(messageBody, user.getPhoneNumber());
}

private CommonRequest createCommonRequest(Message messageBody, String phoneNumber) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import com.postgraduate.domain.user.domain.entity.User;
import com.postgraduate.global.bizppurio.application.dto.req.JuniorMatchingFailRequest;
import com.postgraduate.global.bizppurio.application.dto.req.JuniorMatchingSuccessRequest;
import com.postgraduate.global.bizppurio.application.dto.req.JuniorMatchingWaitingRequest;
import com.postgraduate.global.bizppurio.application.mapper.BizppurioMapper;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
Expand Down Expand Up @@ -36,8 +35,8 @@ public void mentoringFinish(User user) {
bizppurioSend.sendMessageWithExceptionHandling(() -> mapper.mapToJuniorFinish(user));
}

public void matchingWaiting(JuniorMatchingWaitingRequest request) {
bizppurioSend.sendMessageWithExceptionHandling(() -> mapper.mapToJuniorMatchingWaiting(request));
public void matchingWaiting(User user) {
bizppurioSend.sendMessageWithExceptionHandling(() -> mapper.mapToJuniorMatchingWaiting(user));
}

public void matchingFail(JuniorMatchingFailRequest request) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

import com.postgraduate.global.bizppurio.application.dto.req.JuniorMatchingFailRequest;
import com.postgraduate.global.bizppurio.application.dto.req.JuniorMatchingSuccessRequest;
import com.postgraduate.global.bizppurio.application.dto.req.JuniorMatchingWaitingRequest;
import com.postgraduate.global.bizppurio.application.usecase.BizppurioJuniorMessage;
import com.postgraduate.global.dto.ResponseDto;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
Expand All @@ -19,19 +19,15 @@
public class BizppurioController {
private final BizppurioJuniorMessage bizppurioJuniorMessage;

@PostMapping("/matching/waiting")
public ResponseDto<Void> matchingWaiting(@RequestBody JuniorMatchingWaitingRequest request) {
bizppurioJuniorMessage.matchingWaiting(request);
return ResponseDto.create("200", request.phoneNumber() + " ๋ฒˆํ˜ธ๋กœ " + request.name() + " ๋‹˜๊ป˜ ์•Œ๋ฆผํ†ก ์ „์†ก ์™„๋ฃŒ");
}

@PostMapping("/matching/fail")
@Operation(summary = "๋งค์นญ ์‹คํŒจ์‹œ ์ „์†ก")
public ResponseDto<Void> matchingFail(@RequestBody JuniorMatchingFailRequest request) {
bizppurioJuniorMessage.matchingFail(request);
return ResponseDto.create("200", request.phoneNumber() + " ๋ฒˆํ˜ธ๋กœ " + request.name() + " ๋‹˜๊ป˜ ์•Œ๋ฆผํ†ก ์ „์†ก ์™„๋ฃŒ");
}

@PostMapping("/matching/success")
@Operation(summary = "๋งค์นญ ์„ฑ๊ณต์‹œ ์ „์†ก")
public ResponseDto<Void> matchingSuccess(@RequestBody JuniorMatchingSuccessRequest request) {
bizppurioJuniorMessage.matchingSuccess(request);
return ResponseDto.create("200", request.phoneNumber() + " ๋ฒˆํ˜ธ๋กœ " + request.name() + " ๋‹˜๊ป˜ ์•Œ๋ฆผํ†ก ์ „์†ก ์™„๋ฃŒ");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import com.postgraduate.domain.wish.domain.entity.Wish;
import com.postgraduate.domain.wish.domain.entity.constant.Status;
import com.postgraduate.domain.wish.domain.service.WishSaveService;
import com.postgraduate.global.bizppurio.application.usecase.BizppurioJuniorMessage;
import com.postgraduate.global.bizppurio.application.usecase.BizppurioSeniorMessage;
import com.postgraduate.global.slack.SlackSignUpMessage;
import org.junit.jupiter.api.BeforeEach;
Expand Down Expand Up @@ -56,6 +57,8 @@ class SignUpUseTypeTest {
@Mock
private BizppurioSeniorMessage bizppurioSeniorMessage;
@Mock
private BizppurioJuniorMessage bizppurioJuniorMessage;
@Mock
private SeniorSaveService seniorSaveService;
@Mock
private SalarySaveService salarySaveService;
Expand Down

0 comments on commit af200b9

Please sign in to comment.