Skip to content
Merged
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.sopt.app.common.config;

public enum OperationConfigCategory {
FLOATING_BUTTON
FLOATING_BUTTON,
REVIEW_FORM
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ public class WebSecurityConfig {
"/api/v2/user/main",
"/api/v2/home/app-service",
"/api/v2/home/floating-button",
"/api/v2/home/review-form"
};

private final JwtExceptionFilter jwtExceptionFilter;
Expand Down
20 changes: 18 additions & 2 deletions src/main/java/org/sopt/app/facade/HomeFacade.java
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ private boolean isServiceVisibleToUser(AppServiceInfo appServiceInfo, User user)
public List<RecentPostsResponse> getRecentPosts(User user) {
return playgroundAuthService.getRecentPostsWithMemberInfo(user.getPlaygroundToken());
}
public List<EmploymentPostResponse> getHomeEmploymentPost(User user) {

public List<EmploymentPostResponse> getHomeEmploymentPost(User user) {
return playgroundAuthService.getPlaygroundEmploymentPostWithMemberInfo(user.getPlaygroundToken());
}

Expand Down Expand Up @@ -139,4 +139,20 @@ public FloatingButtonResponse getFloatingButtonInfo(User user) {
);

}

@Transactional(readOnly = true)
public ReviewFormResponse getReviewFormInfo(User user) {
boolean isActive = true;
if (user == null) isActive = false;
Map<String, String> operationConfigMap = operationConfigService.getOperationConfigByOperationConfigType(OperationConfigCategory.REVIEW_FORM).stream()
.collect(Collectors.toMap(OperationConfig::getKey, OperationConfig::getValue));

return ReviewFormResponse.of(
operationConfigMap.get("title"),
operationConfigMap.get("subTitle"),
operationConfigMap.get("actionButtonName"),
operationConfigMap.get("linkUrl"),
isActive
);
}
}
15 changes: 15 additions & 0 deletions src/main/java/org/sopt/app/presentation/home/HomeController.java
Original file line number Diff line number Diff line change
Expand Up @@ -131,4 +131,19 @@ public ResponseEntity<FloatingButtonResponse> getFloatingButtonInfo(
homeFacade.getFloatingButtonInfo(user)
);
}

@Operation(summary = "후기 폼 정보 조회")
@ApiResponses({
@ApiResponse(responseCode = "200", description = "success"),
@ApiResponse(responseCode = "401", description = "token error", content = @Content),
@ApiResponse(responseCode = "500", description = "server error", content = @Content)
})
@GetMapping("/review-form")
public ResponseEntity<ReviewFormResponse> getReviewForm(
@AuthenticationPrincipal User user
) {
return ResponseEntity.ok(
homeFacade.getReviewFormInfo(user)
);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package org.sopt.app.presentation.home.response;

import lombok.Builder;
import lombok.Getter;

@Getter
@Builder
public class ReviewFormResponse {
private String title;
private String subTitle;
private String actionButtonName;
private String linkUrl;
private Boolean isActive;

public static ReviewFormResponse of(String title, String subTitle,
String actionButtonName, String linkUrl, Boolean isActive) {
return ReviewFormResponse.builder()
.title(title)
.subTitle(subTitle)
.actionButtonName(actionButtonName)
.linkUrl(linkUrl)
.isActive(isActive)
.build();
}
}