Skip to content

Commit 47649b5

Browse files
authored
Merge pull request #85 from 9ITHON/dev
Dev
2 parents 67c032b + b410cd4 commit 47649b5

File tree

5 files changed

+71
-48
lines changed

5 files changed

+71
-48
lines changed

β€Žbackend/src/main/java/com/together/backend/domain/pill/controller/UserPillController.javaβ€Ž

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -25,84 +25,84 @@ public class UserPillController {
2525
@PostMapping("user-pill/intake-info")
2626
public BaseResponse<UserPillResponse> createUserPill(@AuthenticationPrincipal CustomOAuth2User oAuth2User, @RequestBody UserPillRequest dto) {
2727
if (oAuth2User ==null) {
28-
log.error("μΈμ¦λ˜μ§€ μ•Šμ€ μ‚¬μš©μž μš”μ²­: {}", dto);
29-
return new BaseResponse<>(BaseResponseStatus.UNAUTHORIZED, "둜그인 정보가 μ—†μŠ΅λ‹ˆλ‹€.");
28+
log.error("@@@@@μΈμ¦λ˜μ§€ μ•Šμ€ μ‚¬μš©μž μš”μ²­: {}@@@@@", dto);
29+
return new BaseResponse<>(BaseResponseStatus.UNAUTHORIZED, "@@@@@둜그인 정보가 μ—†μŠ΅λ‹ˆλ‹€.@@@@@");
3030
}
3131

3232
String email = oAuth2User.getEmail(); // ν΄λΌμ΄μ–ΈνŠΈ 이메일 μΆ”μΆœ
3333
try {
3434
IntakeOption intakeOption = userPillService.saveUserPill(dto, email);
35-
log.info("μ‚¬μš©μž {}의 μ•½ 볡용 정보 μ €μž₯ 성곡: {}", email, intakeOption.getName());
35+
log.info("@@@@@[UserPillController]μ‚¬μš©μž {}의 μ•½ 볡용 정보 μ €μž₯ 성곡: {}@@@@@", email, intakeOption.getName());
3636
UserPillResponse response = new UserPillResponse(intakeOption.getName(), dto.getStartDate());
3737
return new BaseResponse<>(BaseResponseStatus.OK, response);
3838
} catch (IllegalArgumentException e) {
39-
log.error("잘λͺ»λœ μš”μ²­ 데이터: {}, error={}", dto, e.getMessage());
39+
log.error("@@@@@[UserPillController]잘λͺ»λœ μš”μ²­ 데이터: {}, error={}@@@@@", dto, e.getMessage());
4040
return new BaseResponse<>(BaseResponseStatus.BAD_REQUEST, e.getMessage());
4141
} catch(Exception e) {
42-
log.error("μ„œλ²„ 였λ₯˜: {}", e.getMessage());
43-
return new BaseResponse<>(BaseResponseStatus.INTERNAL_SERVER_ERROR, "μ•Œ 수 μ—†λŠ” μ„œλ²„ 였λ₯˜κ°€ λ°œμƒν–ˆμŠ΅λ‹ˆλ‹€.");
42+
log.error("@@@@@[UserPillController]μ„œλ²„ 였λ₯˜: {}@@@@@", e.getMessage());
43+
return new BaseResponse<>(BaseResponseStatus.INTERNAL_SERVER_ERROR);
4444
}
4545
}
4646

4747
@PatchMapping("user-pill/intake-info")
4848
public BaseResponse<UserPillResponse> updateUserPill(@AuthenticationPrincipal CustomOAuth2User oAuth2User, @RequestBody UserPillRequest dto) {
4949
if (oAuth2User == null) {
50-
log.error("μΈμ¦λ˜μ§€ μ•Šμ€ μ‚¬μš©μž μš”μ²­: {}", dto);
50+
log.error("@@@@@[UserPillController]μΈμ¦λ˜μ§€ μ•Šμ€ μ‚¬μš©μž μš”μ²­: {}@@@@@", dto);
5151
return new BaseResponse<>(BaseResponseStatus.UNAUTHORIZED);
5252
}
5353
String email = oAuth2User.getEmail(); // ν΄λΌμ΄μ–ΈνŠΈ 이메일 μΆ”μΆœ
5454
try {
5555
IntakeOption intakeNewOption = userPillService.updateUserPill(dto, email);
5656
UserPillResponse response = new UserPillResponse(dto.getOption(), dto.getStartDate());
57-
log.info("μ‚¬μš©μž {}의 μ•½ 볡용 정보 μ—…λ°μ΄νŠΈ 성곡: {}", email, intakeNewOption.getName());
57+
log.info("@@@@@[UserPillController]μ‚¬μš©μž {}의 μ•½ 볡용 정보 μ—…λ°μ΄νŠΈ 성곡: {}@@@@@", email, intakeNewOption.getName());
5858
return new BaseResponse<UserPillResponse>(BaseResponseStatus.OK, response);
5959
} catch(IllegalArgumentException e){
60-
log.warn("[UserPillController] μ•½ 볡용 정보 μ—…λ°μ΄νŠΈ μ‹€νŒ¨(μž…λ ₯κ°’): user={}, error={}", email, e.getMessage());
60+
log.warn("@@@@@[UserPillController] μ•½ 볡용 정보 μ—…λ°μ΄νŠΈ μ‹€νŒ¨(μž…λ ₯κ°’): user={}, error={}@@@@@", email, e.getMessage());
6161
return new BaseResponse<>(BaseResponseStatus.BAD_REQUEST, e.getMessage());
6262
} catch (Exception e) {
63-
log.error("[UserPillController] μ•½ 볡용 정보 μ—…λ°μ΄νŠΈ μ‹€νŒ¨(μ„œλ²„μ˜€λ₯˜): user={}, error={}", email, e.getMessage());
64-
return new BaseResponse<>(BaseResponseStatus.INTERNAL_SERVER_ERROR, null);
63+
log.error("@@@@@[UserPillController] μ•½ 볡용 정보 μ—…λ°μ΄νŠΈ μ‹€νŒ¨(μ„œλ²„μ˜€λ₯˜): user={}, error={}@@@@@", email, e.getMessage());
64+
return new BaseResponse<>(BaseResponseStatus.INTERNAL_SERVER_ERROR);
6565
}
6666

6767
}
6868

6969
@GetMapping("/user-pill/remain")
7070
public BaseResponse<UserPillRemainResponse> getCurrentRemain(@AuthenticationPrincipal CustomOAuth2User oAuth2User) {
7171
if (oAuth2User == null) {
72-
log.warn("[UserPillController] μž”λŸ‰ 쑰회: μΈμ¦λ˜μ§€ μ•Šμ€ μ‚¬μš©μž μš”μ²­");
73-
return new BaseResponse<>(BaseResponseStatus.UNAUTHORIZED, null);
72+
log.warn("@@@@@[UserPillController] μž”λŸ‰ 쑰회: μΈμ¦λ˜μ§€ μ•Šμ€ μ‚¬μš©μž μš”μ²­@@@@@");
73+
return new BaseResponse<>(BaseResponseStatus.UNAUTHORIZED);
7474
}
7575
String email = oAuth2User.getEmail();
7676
try {
7777
UserPillRemainResponse response = userPillService.getCurrentRemain(email);
78-
log.info("[UserPillController] μž”λŸ‰ 쑰회 성곡");
78+
log.info("@@@@@[UserPillController] μž”λŸ‰ 쑰회 성곡@@@@@");
7979
return new BaseResponse<>(BaseResponseStatus.OK, response);
8080
} catch(IllegalArgumentException e) {
81-
log.warn("[UserPillController] μž”λŸ‰ 쑰회 μ‹€νŒ¨(μž…λ ₯κ°’): user={}, error={}", email, e.getMessage());
82-
return new BaseResponse<>(BaseResponseStatus.NOT_FOUND, null);
81+
log.warn("@@@@@[UserPillController] μž”λŸ‰ 쑰회 μ‹€νŒ¨(μž…λ ₯κ°’): user={}, error={}@@@@@", email, e.getMessage());
82+
return new BaseResponse<>(BaseResponseStatus.NOT_FOUND);
8383
} catch(Exception e) {
84-
log.error("[UserPillController] μž”λŸ‰ 쑰회 μ‹€νŒ¨(μ„œλ²„μ˜€λ₯˜): user={}, error={}", email, e.getMessage());
85-
return new BaseResponse<>(BaseResponseStatus.INTERNAL_SERVER_ERROR, null);
84+
log.error("@@@@@[UserPillController] μž”λŸ‰ 쑰회 μ‹€νŒ¨(μ„œλ²„μ˜€λ₯˜): user={}, error={}@@@@@", email, e.getMessage());
85+
return new BaseResponse<>(BaseResponseStatus.INTERNAL_SERVER_ERROR);
8686
}
8787
}
8888

8989
@GetMapping("/user-pill/minutes-left")
9090
public BaseResponse<TodayPillResponse> getMinutesLeft(@AuthenticationPrincipal CustomOAuth2User oAuth2User) {
9191
if (oAuth2User == null) {
92-
log.warn("[UserPillController] minutes-left: μΈμ¦λ˜μ§€ μ•Šμ€ μ‚¬μš©μž μš”μ²­");
93-
return new BaseResponse<>(BaseResponseStatus.UNAUTHORIZED, null);
92+
log.warn("@@@@@[UserPillController] minutes-left: μΈμ¦λ˜μ§€ μ•Šμ€ μ‚¬μš©μž μš”μ²­@@@@@");
93+
return new BaseResponse<>(BaseResponseStatus.UNAUTHORIZED);
9494
}
9595
String email = oAuth2User.getEmail();
9696
try {
9797
TodayPillResponse response = userPillService.getPillTimeLeft(email);
98-
log.info("[UserPillController] minutes-left 쑰회 성곡");
98+
log.info("@@@@@[UserPillController] minutes-left 쑰회 성곡@@@@@");
9999
return new BaseResponse<>(BaseResponseStatus.OK, response);
100100
} catch(IllegalArgumentException e) {
101-
log.warn("[UserPillController] minutes-left 쑰회 μ‹€νŒ¨");
102-
return new BaseResponse<>(BaseResponseStatus.NOT_FOUND, null);
101+
log.warn("@@@@@[UserPillController] minutes-left 쑰회 μ‹€νŒ¨@@@@@");
102+
return new BaseResponse<>(BaseResponseStatus.NOT_FOUND);
103103
} catch(Exception e) {
104-
log.error("[UserPillController] minutes-left 쑰회 μ‹€νŒ¨(μ„œλ²„μ˜€λ₯˜)");
105-
return new BaseResponse<>(BaseResponseStatus.INTERNAL_SERVER_ERROR, null);
104+
log.error("@@@@@[UserPillController] minutes-left 쑰회 μ‹€νŒ¨(μ„œλ²„μ˜€λ₯˜)@@@@@");
105+
return new BaseResponse<>(BaseResponseStatus.INTERNAL_SERVER_ERROR);
106106
}
107107
}
108108
}

β€Žbackend/src/main/java/com/together/backend/domain/pill/service/UserPillService.javaβ€Ž

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ public class UserPillService {
4848
private User getUserByEmail(String email) {
4949
return userRepository.findByEmail(email)
5050
.orElseThrow(() -> {
51-
log.warn("[UserPillService] μ΄λ©”μΌλ‘œ μœ μ € 쑰회 μ‹€νŒ¨: {}", email);
52-
return new IllegalArgumentException("ν•΄λ‹Ή 이메일 μ‚¬μš©μžλ₯Ό 찾을 수 μ—†μŠ΅λ‹ˆλ‹€.");
51+
log.warn("@@@@@[UserPillService] μ΄λ©”μΌλ‘œ μœ μ € 쑰회 μ‹€νŒ¨: {}@@@@@", email);
52+
return new IllegalArgumentException("ν•΄λ‹Ή 이메일 μ‚¬μš©μžλ₯Ό 찾을 수 μ—†μŠ΅λ‹ˆλ‹€: " +email);
5353
});
5454
}
5555

@@ -58,7 +58,7 @@ private IntakeOption parseOption(String option) {
5858
try {
5959
return IntakeOption.valueOf(option);
6060
} catch (Exception e) {
61-
log.warn("[UserPillService] IntakeOption νŒŒμ‹± μ‹€νŒ¨: {}", option);
61+
log.warn("@@@@@[UserPillService] IntakeOption νŒŒμ‹± μ‹€νŒ¨: {}@@@@@", option);
6262
throw new IllegalArgumentException("μ§€μ›ν•˜μ§€ μ•ŠλŠ” μ˜΅μ…˜μž…λ‹ˆλ‹€: " + option);
6363
}
6464
}
@@ -68,7 +68,7 @@ private LocalDate parseStartDate(String dateStr) {
6868
try {
6969
return LocalDate.parse(dateStr);
7070
} catch (DateTimeParseException e) {
71-
log.warn("[UserPillService] λ‚ μ§œ νŒŒμ‹± μ‹€νŒ¨: {}", dateStr);
71+
log.warn("@@@@@[UserPillService] λ‚ μ§œ νŒŒμ‹± μ‹€νŒ¨: {}@@@@@", dateStr);
7272
throw new IllegalArgumentException("λ‚ μ§œ ν˜•μ‹μ΄ μ˜¬λ°”λ₯΄μ§€ μ•ŠμŠ΅λ‹ˆλ‹€: " + dateStr);
7373
}
7474
}
@@ -83,13 +83,13 @@ public IntakeOption saveUserPill(UserPillRequest dto, String email) {
8383
for (UserPill up : existing) {
8484
intakeRecordRepository.deleteByUserPill(up);
8585
userPillRepository.delete(up);
86-
log.info("[UserPillService] κΈ°μ‘΄ UserPill 및 기둝 μ‚­μ œ: user={}. userPillID=[]", email, up.getUserPillId());
86+
log.info("@@@@@[UserPillService] κΈ°μ‘΄ UserPill 및 기둝 μ‚­μ œ: user={}. userPillID={}@@@@@", email, up.getUserPillId());
8787
}
8888

8989
// dtoμ—μ„œ option을 가져와 IntakeOption으둜 λ³€ν™˜
9090
IntakeOption option = parseOption(dto.getOption());
9191
IntakeInfo intakeInfo = intakeInfoRepository.save(IntakeInfo.builder().option(option).build());
92-
log.info("[UserPillService] IntakeInfo μ €μž₯: {}", intakeInfo);
92+
log.info("@@@@@[UserPillService] IntakeInfo μ €μž₯: {}@@@@@", intakeInfo);
9393

9494
// μ‹œμž‘ λ‚ μ§œ νŒŒμ‹±
9595
LocalDate startDate = parseStartDate(dto.getStartDate());
@@ -114,11 +114,11 @@ public IntakeOption saveUserPill(UserPillRequest dto, String email) {
114114
.build();
115115

116116
userPillRepository.save(userPill);
117-
log.info("[UserPillService] UserPill μ €μž₯ 성곡: {}", userPill);
117+
log.info("@@@@@[UserPillService] UserPill μ €μž₯ 성곡: {}@@@@@", userPill);
118118

119119
// 초기 기둝 μΈμŠ€ν„΄μŠ€ 생성
120120
intakeRecordInitService.createInitialRecords(startDate, option, userPill);
121-
log.info("[UserPillService] IntakeRecord μ΄ˆκΈ°ν™” μ™„λ£Œ");
121+
log.info("@@@@@[UserPillService] IntakeRecord μ΄ˆκΈ°ν™” μ™„λ£Œ@@@@@");
122122
return option;
123123
}
124124

@@ -127,7 +127,7 @@ public IntakeOption updateUserPill(UserPillRequest dto, String email) {
127127
User user = getUserByEmail(email);
128128
// 기쑴 UserPill 쑰회
129129
UserPill userPill = userPillRepository.findByUser(user) .orElseThrow(() -> {
130-
log.warn("[UserPillService] μ•½ 볡용 정보 μ—†μŒ: user={}", email);
130+
log.warn("@@@@@[UserPillService] μ•½ 볡용 정보 μ—†μŒ: user={}@@@@@", email);
131131
return new IllegalArgumentException("μ•½ 볡용 정보가 μ—†μŠ΅λ‹ˆλ‹€: " + email);
132132
});
133133

@@ -136,7 +136,7 @@ public IntakeOption updateUserPill(UserPillRequest dto, String email) {
136136
IntakeInfo intakeInfo = userPill.getIntakeInfo();
137137
intakeInfo.setOption(newOption);
138138
intakeInfoRepository.save(intakeInfo);
139-
log.info("[UserPillService] IntakeInfo μ—…λ°μ΄νŠΈ 성곡: {}", intakeInfo);
139+
log.info("@@@@@[UserPillService] IntakeInfo μ—…λ°μ΄νŠΈ 성곡: {}@@@@@", intakeInfo);
140140

141141
LocalDate newStartDate = parseStartDate(dto.getStartDate());
142142
userPill.setStartDate(newStartDate);
@@ -155,18 +155,18 @@ public IntakeOption updateUserPill(UserPillRequest dto, String email) {
155155
userPill.setNextPurchaseAlert(nextPurchaseAlert);
156156

157157
userPillRepository.save(userPill);
158-
log.info("μ‚¬μš©μž {}의 μ•½ 볡용 정보 μ—…λ°μ΄νŠΈ μ™„λ£Œ: option={}, startDate={}", email, newOption, dto.getStartDate());
158+
log.info("@@@@@μ‚¬μš©μž {}의 μ•½ 볡용 정보 μ—…λ°μ΄νŠΈ μ™„λ£Œ: option={}, startDate={}@@@@@", email, newOption, dto.getStartDate());
159159

160160
// 1. κΈ°μ‘΄ IntakeRecord λͺ¨λ‘ μ‚­μ œ
161161
intakeRecordRepository.deleteByUserPill(userPill);
162-
log.info("[UserPillService] κΈ°μ‘΄ IntakeRecord μ‚­μ œ");
162+
log.info("@@@@@[UserPillService] κΈ°μ‘΄ IntakeRecord μ‚­μ œ@@@@@");
163163
// 2. μƒˆλ‘œμš΄ IntakeRecord 생성
164164
intakeRecordInitService.createInitialRecords(
165165
userPill.getStartDate(),
166166
newOption,
167167
userPill
168168
);
169-
log.info("[UserPillService] μƒˆλ‘œμš΄ IntakeRecord 생성");
169+
log.info("@@@@@[UserPillService] μƒˆλ‘œμš΄ IntakeRecord 생성@@@@@");
170170
return newOption;
171171
}
172172

@@ -177,14 +177,14 @@ public UserPillRemainResponse getCurrentRemain(String email) {
177177
.orElseThrow(() -> new IllegalArgumentException("μ‚¬μš©μžλ₯Ό 찾을 수 μ—†μŠ΅λ‹ˆλ‹€: " + email));
178178
UserPill userPill = userPillRepository.findByUser(user)
179179
.orElseThrow(() -> {
180-
log.warn("[UserPillService] μž”λŸ‰ 쑰회: μ•½ 볡용 정보 μ—†μŒ: user={}", email);
180+
log.warn("@@@@@[UserPillService] μž”λŸ‰ 쑰회: μ•½ 볡용 정보 μ—†μŒ: user={}@@@@@", email);
181181
return new IllegalArgumentException("μ•½ 볡용 정보가 μ—†μŠ΅λ‹ˆλ‹€: " + email);
182182
});
183183

184-
log.info("[UserPillService] μž”λŸ‰ 쑰회 성곡: user={}, remain={}", email, userPill.getCurrentRemain());
184+
log.info("@@@@@[UserPillService] μž”λŸ‰ 쑰회 성곡: user={}, remain={}@@@@@", email, userPill.getCurrentRemain());
185185
return new UserPillRemainResponse(userPill.getCurrentRemain());
186186
} catch (Exception e) {
187-
log.error("[UserPillService] μž”λŸ‰ 쑰회 쀑 μ˜ˆμ™Έ: user={}, error={}", email, e.getMessage());
187+
log.error("@@@@@[UserPillService] μž”λŸ‰ 쑰회 쀑 μ˜ˆμ™Έ: user={}, error={}@@@@@", email, e.getMessage());
188188
throw e;
189189
}
190190
}
@@ -196,7 +196,7 @@ public TodayPillResponse getPillTimeLeft(String email) {
196196

197197
UserPill userPill = userPillRepository.findByUser(user)
198198
.orElseThrow(() -> {
199-
log.warn("[UserPillService] minutes-left: μ•½ 볡용 정보 μ—†μŒ: user={}", email);
199+
log.warn("@@@@@[UserPillService] minutes-left: μ•½ 볡용 정보 μ—†μŒ: user={}@@@@@", email);
200200
return new IllegalArgumentException("μ•½ 볡용 정보가 μ—†μŠ΅λ‹ˆλ‹€: " + email);
201201
});
202202

@@ -209,7 +209,7 @@ public TodayPillResponse getPillTimeLeft(String email) {
209209
Optional<NotificationSettings> notiOpt = notificationSettingsRepository.findByUserAndType(user, NotificationType.PILL_INTAKE);
210210

211211
if (notiOpt.isEmpty() || notiOpt.get().getNotificationTime() == null) {
212-
log.warn("[UserPillService] minutes-left: μ•Œλ¦Ό μ„€μ • μ—†μŒ or μ‹œκ°„ λ―Έμ„€μ •: user={}", email);
212+
log.warn("@@@@@[UserPillService] minutes-left: μ•Œλ¦Ό μ„€μ • μ—†μŒ or μ‹œκ°„ λ―Έμ„€μ •: user={}@@@@@", email);
213213
return new TodayPillResponse(isTaken, null);
214214
}
215215

@@ -221,15 +221,15 @@ public TodayPillResponse getPillTimeLeft(String email) {
221221

222222
// (이미 λ¨Ήμ—ˆκ±°λ‚˜ μ‹œκ°„μ΄ μ§€λ‚¬μœΌλ©΄ 0)
223223
if (isTaken || minutesLeft < 0) {
224-
log.info("[UserPillService] minutes-left: 이미 볡용 or μ‹œκ°„ 지남: user={}, isTaken={}, minutesLeft={}", email, isTaken, minutesLeft);
224+
log.info("@@@@@[UserPillService] minutes-left: 이미 볡용 or μ‹œκ°„ 지남: user={}, isTaken={}, minutesLeft={}@@@@@", email, isTaken, minutesLeft);
225225
minutesLeft = 0;
226226
} else {
227-
log.info("[UserPillService] minutes-left: user={}, isTaken={}, minutesLeft={}", email, isTaken, minutesLeft);
227+
log.info("@@@@@[UserPillService] minutes-left: user={}, isTaken={}, minutesLeft={}@@@@@", email, isTaken, minutesLeft);
228228
}
229229

230230
return new TodayPillResponse(isTaken, minutesLeft);
231231
} catch(Exception e) {
232-
log.error("[UserPIllService] minutes-left 쑰회 쀑 μ˜ˆμ™Έ: user={}, error={}", email, e.getMessage());
232+
log.error("@@@@@[UserPIllService] minutes-left 쑰회 쀑 μ˜ˆμ™Έ: user={}, error={}@@@@@", email, e.getMessage());
233233
throw e;
234234
}
235235
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,24 @@
11
package com.together.backend.domain.sharing.model.response;
22

3+
import com.together.backend.domain.sharing.model.Sharing;
4+
import com.together.backend.domain.user.model.entity.User;
35
import lombok.AllArgsConstructor;
6+
import lombok.Builder;
47
import lombok.Getter;
58

69
import java.time.LocalDateTime;
710

811
@Getter
12+
@Builder
913
@AllArgsConstructor
1014
public class ConfirmResponse {
1115
private boolean isConfirmed;
1216
private LocalDateTime confirmedAt;
17+
18+
public static ConfirmResponse from(Sharing sharing) {
19+
return ConfirmResponse.builder()
20+
.isConfirmed(sharing.isConfirmed())
21+
.confirmedAt(sharing.getConfirmedAt())
22+
.build();
23+
}
1324
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,25 @@
11
package com.together.backend.domain.sharing.model.response;
22

3+
import com.together.backend.domain.sharing.model.Sharing;
34
import lombok.AllArgsConstructor;
5+
import lombok.Builder;
46
import lombok.Getter;
57

68
import java.time.LocalDateTime;
79

810
@Getter
911
@AllArgsConstructor
12+
@Builder
1013
public class SaveUrlResponse {
1114
private String sharedUrl;
1215
private boolean isShared;
1316
private LocalDateTime sharedAt;
17+
18+
public static SaveUrlResponse from(Sharing sharing) {
19+
return SaveUrlResponse.builder()
20+
.sharedUrl(sharing.getSharedUrl())
21+
.isShared(sharing.isShared())
22+
.isShared(sharing.isShared())
23+
.build();
24+
}
1425
}

β€Žbackend/src/main/java/com/together/backend/domain/sharing/service/SharingService.javaβ€Ž

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ public class SharingService {
2424
private final CoupleRepository coupleRepository;
2525
private final NotificationService notificationService;
2626

27+
@Transactional
2728
public SaveUrlResponse saveUrl(String email, String url) {
2829

2930
User user = userRepository.findByEmail(email).orElseThrow(() -> new IllegalArgumentException("μ‚¬μš©μžλ₯Ό 찾을 수 μ—†μŠ΅λ‹ˆλ‹€: " + email));
@@ -34,7 +35,7 @@ public SaveUrlResponse saveUrl(String email, String url) {
3435

3536
Sharing saved = sharingRepository.save(sharing);
3637

37-
return new SaveUrlResponse(saved.getSharedUrl(), saved.isShared(), saved.getSharedAt());
38+
return SaveUrlResponse.from(saved);
3839
}
3940

4041
@Transactional
@@ -70,6 +71,6 @@ public ConfirmResponse confirm(String inviterEmail, Long accepterId) {
7071
accepter.getNickname() + "λ‹˜μ΄ νŒŒνŠΈλ„ˆ μš”μ²­μ„ μˆ˜λ½ν–ˆμŠ΅λ‹ˆλ‹€!"
7172
);
7273

73-
return new ConfirmResponse(sharing.isConfirmed(), sharing.getConfirmedAt());
74+
return ConfirmResponse.from(sharing);
7475
}
7576
}

0 commit comments

Comments
Β (0)