Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,12 @@ dependencies {
implementation("org.modelmapper:modelmapper:3.1.1")

// (1) hospital-interface λͺ¨λ“ˆ
implementation "com.doubleo.grpc:hospital-interface:0.3.2"
implementation "com.doubleo.grpc:patient-interface:0.3.2"
implementation "com.doubleo.grpc:member-interface:0.3.2"
implementation "com.doubleo.grpc:log-interface:0.3.2"
implementation "com.doubleo.grpc:acapy-interface:0.3.2"
implementation "com.doubleo.grpc:pass-interface:0.3.2"
implementation "com.doubleo.grpc:hospital-interface:0.3.3"
implementation "com.doubleo.grpc:patient-interface:0.3.3"
implementation "com.doubleo.grpc:member-interface:0.3.3"
implementation "com.doubleo.grpc:log-interface:0.3.3"
implementation "com.doubleo.grpc:acapy-interface:0.3.3"
implementation "com.doubleo.grpc:pass-interface:0.3.3"

// (2) gRPC λŸ°νƒ€μž„
implementation "io.grpc:grpc-netty:1.63.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ public enum PassErrorCode implements BaseErrorCode {
PATIENT_ID_REQUIRED_FOR_GUARDIAN(HttpStatus.BAD_REQUEST, "patient idκ°€ ν•„μš”ν•©λ‹ˆλ‹€."),
PASS_NOT_FOUND(HttpStatus.NOT_FOUND, "passλ₯Ό 찾을 수 μ—†μŠ΅λ‹ˆλ‹€."),
VISIT_CATEGORY_REQUIRED_FOR_PASS(HttpStatus.BAD_REQUEST, "visit categoryκ°€ μ˜¬λ°”λ₯΄μ§€ μ•ŠμŠ΅λ‹ˆλ‹€."),
VC_ISSUE_FAILED(HttpStatus.INTERNAL_SERVER_ERROR, "VC λ°œκΈ‰μ— μ‹€νŒ¨ν–ˆμŠ΅λ‹ˆλ‹€.");
VC_ISSUE_FAILED(HttpStatus.INTERNAL_SERVER_ERROR, "VC λ°œκΈ‰μ— μ‹€νŒ¨ν–ˆμŠ΅λ‹ˆλ‹€."),
CONNECTION_ID_NOT_ASSIGNED(HttpStatus.CONFLICT, "connectionIdκ°€ 아직 ν• λ‹Ήλ˜μ§€ μ•Šμ•˜μŠ΅λ‹ˆλ‹€.");

private final HttpStatus httpStatus;
private final String message;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,4 +141,40 @@ public void updateConnectionState(
responseObserver.onNext(response);
responseObserver.onCompleted();
}

@Override
public void getConnectionIdByPassId(
GetConnectionIdByPassIdRequest request,
StreamObserver<GetConnectionIdByPassIdResponse> responseObserver) {
String tenantId = request.getTenantId();
long passId = request.getPassId();

try {
Pass pass =
passRepository
.findById(passId)
.orElseThrow(() -> new CommonException(PassErrorCode.PASS_NOT_FOUND));
Comment on lines +153 to +156
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P4: 클래슀 λ‚΄μ—μ„œ 반볡적으둜 μ‚¬μš©λ˜λŠ” μ—”ν‹°ν‹° 쑰회 λ‘œμ§μ€ λ³„λ„μ˜ util λ©”μ†Œλ“œλ‘œ 뢄리해 μ½”λ“œ 쀑볡을 μ œκ±°ν•˜λŠ” 것도 μ’‹μ•„λ³΄μž…λ‹ˆλ‹€:)


String connectionId = pass.getDidConnectionId();
if (connectionId == null) {
throw new CommonException(PassErrorCode.CONNECTION_ID_NOT_ASSIGNED);
}

GetConnectionIdByPassIdResponse response =
GetConnectionIdByPassIdResponse.newBuilder()
.setConnectionId(connectionId)
.build();

responseObserver.onNext(response);
responseObserver.onCompleted();

} catch (Exception e) {
log.error(
"[{}] connectionId 쑰회 μ‹€νŒ¨ - passId: {}, error: {}",
tenantId,
passId,
e.getMessage());
responseObserver.onError(e);
}
}
}