Skip to content

Commit

Permalink
[OING-339] feat: 확장된 가족 초대 링크 기능을 구현하기 위한 View API Spec 우선 구현 및 응답 모킹 (
Browse files Browse the repository at this point in the history
  • Loading branch information
Kwon770 authored and Ji-soo708 committed Jun 21, 2024
1 parent 36b6b11 commit 8cbb346
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 11 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ public record FamilyInviteDeepLinkResponse(
@Schema(description = "전체 가족 구성원 수", example = "5")
Integer familyMembersCount,


@Schema(description = "초대자 이름", example = "김철수")
String inviterName,

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import com.oing.service.FamilyBridge;
import com.oing.service.MemberBridge;
import com.oing.service.PostBridge;
import com.oing.restapi.MeApi;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Controller;

Expand All @@ -22,10 +23,10 @@ public class FamilyInviteViewController implements FamilyInviteViewApi {
private final FamilyBridge familyBridge;
private final PostBridge postBridge;
private final MemberController memberController;
private final MeApi meApi;

@Override
public FamilyInviteDeepLinkResponse getFamilyInviteLinkDetails(String linkId, String loginMemberId) {

boolean isRequesterJoinedFamily = true;
MemberResponse me = memberController.getMemberNullable(loginMemberId);
if (me.familyId() == null) {
Expand Down
35 changes: 35 additions & 0 deletions gateway/src/main/java/com/oing/restapi/FamilyInviteViewApi.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package com.oing.restapi;

import com.oing.dto.response.FamilyInviteDeepLinkResponse;
import com.oing.util.security.LoginMemberId;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Tag(name = "가족초대 페이지 뷰 기반 API", description = "웹뷰와 앱에서 가족초대와 관련된 페이지 기반으로 작성된 View API입니다.")
@RestController
@RequestMapping("/v1/view/family-invite")
public interface FamilyInviteViewApi {

@Operation(
summary = "가족 초대 링크 정보 조회 (딥링크 웹뷰 + 가족 가입 앱 겸용)",
description = """
linkId를 통해 해당 가족 초대 링크의 세부 정보들을 조회합니다.
토큰 미첨부 시 : 가족 초대 링크 상세 정보 조회 (딥링크 웹뷰 페이지용)
토큰 첨부 시 : 요청자 입장에서의 가족 초대 링크 정보 조회 (가족 가입 프로세스 앱 페이지용)"""
)
@GetMapping("/{linkId}")
FamilyInviteDeepLinkResponse getFamilyInviteLinkDetails(
@PathVariable
@Parameter(description = "링크 ID", example = "bef039df")
String linkId,

@LoginMemberId
@Parameter(hidden = true)
String loginMemberId
);
}
12 changes: 12 additions & 0 deletions gateway/src/main/java/com/oing/service/DeepLinkService.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,16 @@ public DeepLink getDeepLink(String linkId) {
.findById(linkId)
.orElseThrow(LinkNotValidException::new);
}

public DeepLink getFamilyInviteLink(String linkId) {
DeepLink deepLink = deepLinkRepository
.findById(linkId)
.orElseThrow(LinkNotValidException::new);

if (!deepLink.getType().equals(DeepLinkType.FAMILY_REGISTRATION)) {
throw new LinkNotValidException();
}

return deepLink;
}
}

0 comments on commit 8cbb346

Please sign in to comment.