Skip to content

Conversation

@HyemIin
Copy link
Member

@HyemIin HyemIin commented Jul 21, 2025

작업 요약

  • redis에 예약 상태 key 추가
  • 특정 userId 호출 로직 구현
  • 예약 상태 CALLING으로 변경 시, TTL 10분으로 변경

Issue Link

문제점 및 어려움

  • 입장완료 시 redis에서 삭제할지, 냅둘지?(어차피 TTL 10분이기 때문)

해결 방안

Reference

Summary by CodeRabbit

  • 신규 기능

    • 관리자가 대기 중인 사용자를 10분간 호출할 수 있는 PATCH 엔드포인트가 추가되었습니다.
    • 관리자의 호출 결과를 포함하는 응답 구조가 추가되었습니다.
  • 버그 수정

    • 사용자 대기 상태 조회 및 관리 기능이 개선되었습니다.
  • 리팩터

    • 사용자 대기 관련 Redis 저장소 클래스 및 서비스 명칭이 변경되고, 관련 메서드가 일관성 있게 통합되었습니다.
  • 문서화

    • API 응답에 대한 예시 및 설명이 보강되었습니다.

- redis에 예약 상태 key 추가
- 특정 userId 호출 로직 구현
- 예약 상태 CALLING으로 변경 시, TTL 10분으로 변경
@HyemIin HyemIin self-assigned this Jul 21, 2025
@coderabbitai
Copy link

coderabbitai bot commented Jul 21, 2025

Walkthrough

관리자 API에 대기 호출 기능이 추가되었습니다. 새로운 PATCH 엔드포인트가 도입되어, 관리자가 특정 매장과 사용자의 대기 상태를 10분간 "호출중"으로 변경할 수 있습니다. 이를 위해 Redis 저장소와 DTO, 서비스, 키 유틸리티, 사용자 API의 관련 클래스에 메서드 및 필드가 추가·수정되었습니다.

Changes

파일/경로 요약 변경 내용 요약
.../reservation/controller/ReservationController.java PATCH /admin/calling/redis/{storeId} 엔드포인트 및 callWaiting 메서드 추가
.../reservation/dto/CallingWaitingResponseDto.java 대기 호출 응답용 DTO 신규 추가 (storeId, userId, status, calledAt, rank, partySize 등)
.../reservation/repository/WaitingRedisRepository.java 대기 상태 저장/조회 메서드(setWaitingStatus, getWaitingStatus) 추가 및 TTL 조정 로직 포함
.../reservation/service/ReservationService.java callWaiting 메서드 추가: 권한 체크, 상태 검증, Redis 상태 변경, DTO 반환
.../reservation/repository/WaitingUserRedisRepository.java 클래스명 변경, 대기 상태 저장/조회 메서드 추가, TTL 설정 및 주석 개선
.../reservation/service/ReservationService.java (user-api) WaitingRedisRepositoryWaitingUserRedisRepository로 전면 교체 및 관련 메서드 호출 변경
.../common/util/RedisKeyUtils.java 대기 상태 키 프리픽스 상수 및 생성 메서드 추가

Sequence Diagram(s)

sequenceDiagram
    participant Admin as 관리자(요청자)
    participant Controller as ReservationController
    participant Service as ReservationService
    participant RedisRepo as WaitingRedisRepository
    participant DTO as CallingWaitingResponseDto

    Admin->>Controller: PATCH /admin/calling/redis/{storeId}?userId={userId}
    Controller->>Service: callWaiting(storeId, userId, memberDetails)
    Service->>RedisRepo: getWaitingStatus(storeId, userId)
    RedisRepo-->>Service: "WAITING" or other status
    Service-->>Service: 상태 검증/예외처리
    Service->>RedisRepo: setWaitingStatus(storeId, userId, "CALLING")
    Service-->>DTO: CallingWaitingResponseDto 생성
    Service-->>Controller: CallingWaitingResponseDto 반환
    Controller-->>Admin: API 성공 응답 반환
Loading

Estimated code review effort

3 (30–60분)

Suggested reviewers

  • Jjiggu

📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 600c24d and a99ce89.

📒 Files selected for processing (3)
  • nowait-app-admin-api/src/main/java/com/nowait/applicationadmin/reservation/repository/WaitingRedisRepository.java (2 hunks)
  • nowait-app-admin-api/src/main/java/com/nowait/applicationadmin/reservation/service/ReservationService.java (3 hunks)
  • nowait-app-user-api/src/main/java/com/nowait/applicationuser/reservation/repository/WaitingUserRedisRepository.java (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (3)
  • nowait-app-user-api/src/main/java/com/nowait/applicationuser/reservation/repository/WaitingUserRedisRepository.java
  • nowait-app-admin-api/src/main/java/com/nowait/applicationadmin/reservation/service/ReservationService.java
  • nowait-app-admin-api/src/main/java/com/nowait/applicationadmin/reservation/repository/WaitingRedisRepository.java
✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@github-actions github-actions bot requested a review from Jjiggu July 21, 2025 08:53
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 6

🧹 Nitpick comments (1)
nowait-app-admin-api/src/main/java/com/nowait/applicationadmin/reservation/service/ReservationService.java (1)

100-100: TODO 주석에 대한 구현 계획을 명확히 해주세요.

CALLING에서 입장완료로의 상태 전환 로직 구현이 필요합니다. Redis 삭제와 RDB 저장 전략에 대한 결정이 필요합니다.

해당 기능 구현에 도움이 필요하시면 구체적인 구현 방안을 제안해드릴 수 있습니다.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a2abed2 and 600c24d.

📒 Files selected for processing (7)
  • nowait-app-admin-api/src/main/java/com/nowait/applicationadmin/reservation/controller/ReservationController.java (2 hunks)
  • nowait-app-admin-api/src/main/java/com/nowait/applicationadmin/reservation/dto/CallingWaitingResponseDto.java (1 hunks)
  • nowait-app-admin-api/src/main/java/com/nowait/applicationadmin/reservation/repository/WaitingRedisRepository.java (2 hunks)
  • nowait-app-admin-api/src/main/java/com/nowait/applicationadmin/reservation/service/ReservationService.java (3 hunks)
  • nowait-app-user-api/src/main/java/com/nowait/applicationuser/reservation/repository/WaitingUserRedisRepository.java (2 hunks)
  • nowait-app-user-api/src/main/java/com/nowait/applicationuser/reservation/service/ReservationService.java (8 hunks)
  • nowait-domain/domain-redis/src/main/java/com/nowait/domaincoreredis/common/util/RedisKeyUtils.java (2 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (3)
nowait-app-admin-api/src/main/java/com/nowait/applicationadmin/reservation/repository/WaitingRedisRepository.java (1)
nowait-domain/domain-redis/src/main/java/com/nowait/domaincoreredis/common/util/RedisKeyUtils.java (1)
  • RedisKeyUtils (5-45)
nowait-app-user-api/src/main/java/com/nowait/applicationuser/reservation/repository/WaitingUserRedisRepository.java (1)
nowait-domain/domain-redis/src/main/java/com/nowait/domaincoreredis/common/util/RedisKeyUtils.java (1)
  • RedisKeyUtils (5-45)
nowait-app-admin-api/src/main/java/com/nowait/applicationadmin/reservation/service/ReservationService.java (1)
nowait-app-user-api/src/main/java/com/nowait/applicationuser/reservation/service/ReservationService.java (1)
  • Service (39-192)
🔇 Additional comments (7)
nowait-domain/domain-redis/src/main/java/com/nowait/domaincoreredis/common/util/RedisKeyUtils.java (1)

19-19: 변경사항이 기존 코드 패턴과 일치합니다.

새로운 Redis 키 접두사와 getter 메서드가 기존 코드 스타일과 일관성 있게 구현되었습니다.

Also applies to: 44-44

nowait-app-admin-api/src/main/java/com/nowait/applicationadmin/reservation/controller/ReservationController.java (2)

11-11: 필요한 import가 올바르게 추가되었습니다.

새로운 기능을 위한 import 구문들이 적절히 추가되었습니다.

Also applies to: 15-15


66-80: REST 호출 엔드포인트 검토 완료: userId 타입 일관성 확인됨

모든 예약 대기 호출 흐름(Controller → Service → Redis Repository)에서 userIdString으로 일관되게 사용하고 있습니다. 별도의 타입 변경이나 추가 조치가 필요하지 않습니다.

nowait-app-user-api/src/main/java/com/nowait/applicationuser/reservation/service/ReservationService.java (2)

20-20: 리포지토리 네이밍 변경이 적절히 적용되었습니다.

WaitingUserRedisRepository로의 네이밍 변경이 일관성 있게 적용되었습니다.

Also applies to: 46-46


68-68: 모든 리포지토리 메서드 호출이 올바르게 업데이트되었습니다.

새로운 리포지토리 인터페이스를 사용하도록 모든 메서드 호출이 일관성 있게 변경되었으며, getWaitingStatus 메서드 추가로 사용자에게 실시간 상태를 제공할 수 있게 되었습니다.

Also applies to: 73-73, 86-87, 100-100, 109-109, 128-130, 143-143

nowait-app-user-api/src/main/java/com/nowait/applicationuser/reservation/repository/WaitingUserRedisRepository.java (1)

84-89: getWaitingStatus 메서드 구현이 올바릅니다

상태값 조회 메서드가 적절하게 구현되었습니다. null 체크와 String 변환 로직이 올바르게 처리되어 있습니다.

nowait-app-admin-api/src/main/java/com/nowait/applicationadmin/reservation/repository/WaitingRedisRepository.java (1)

38-43: getWaitingStatus 메서드가 적절히 구현되었습니다

상태값 조회 로직이 올바르게 구현되어 있으며, null 처리도 적절합니다.

Comment on lines +1 to +35
package com.nowait.applicationadmin.reservation.dto;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;

import java.time.LocalDateTime;

@Getter
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Schema(description = "관리자 호출(호출 상태 변경) 응답 DTO")
public class CallingWaitingResponseDto {
@Schema(description = "매장 ID", example = "7")
private Long storeId;

@Schema(description = "유저 ID", example = "123")
private String userId;

@Schema(description = "대기 상태", example = "CALLING")
private String status;

@Schema(description = "호출 시각", example = "2025-07-21T17:01:00")
private LocalDateTime calledAt;

@Schema(description = "대기 순번", example = "3")
private Integer rank;

@Schema(description = "파티 인원", example = "4")
private Integer partySize;


}
Copy link

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

DTO 구조가 올바르게 설계되었습니다.

Lombok 어노테이션과 Swagger 문서화가 적절히 적용되었습니다. 하지만 서비스 레이어에서 rankpartySize 필드가 채워지지 않고 있습니다.

서비스 메서드에서 누락된 필드들이 올바르게 설정되는지 확인해보세요:


🏁 Script executed:

#!/bin/bash
# CallingWaitingResponseDto 빌더에서 설정되는 필드 확인
rg -A 10 "CallingWaitingResponseDto\.builder"

Length of output: 1441


rank 및 partySize 필드 서비스 레이어 설정 필요

서비스 메서드의 CallingWaitingResponseDto.builder() 호출부에서 rankpartySize 값이 누락되어 있습니다. 아래 위치를 확인 후, 적절한 값으로 설정해 주세요.

  • 파일:
    nowait-app-admin-api/src/main/java/com/nowait/applicationadmin/reservation/service/ReservationService.java
  • 영역:
    CallingWaitingResponseDto.builder() 호출 직후
  • 예시 수정
    return CallingWaitingResponseDto.builder()
        .storeId(storeId)
        .userId(userId)
        .status("CALLING")
        .calledAt(calledAt)
        .rank(reservation.getRank())           // 추가
        .partySize(reservation.getPartySize()) // 추가
        .build();
🤖 Prompt for AI Agents
In
nowait-app-admin-api/src/main/java/com/nowait/applicationadmin/reservation/service/ReservationService.java
around the CallingWaitingResponseDto.builder() call, the fields rank and
partySize are missing from the builder. Fix this by adding
.rank(reservation.getRank()) and .partySize(reservation.getPartySize()) to the
builder chain before calling build(), ensuring these values are properly set in
the response DTO.

Comment on lines 24 to 36
// 상태값 저장 및 변경
public void setWaitingStatus(Long storeId, String userId, String status) {
String queueKey = RedisKeyUtils.buildWaitingKeyPrefix() + storeId;
String partyKey = RedisKeyUtils.buildWaitingPartySizeKeyPrefix() + storeId;
String statusKey = RedisKeyUtils.buildWaitingStatusKeyPrefix() + storeId;
redisTemplate.opsForHash().put(statusKey, userId, status);
// WAITING -> CALLING 으로 변경 시 TTL 12h에서 10m로 변경
if (status.equals("CALLING")) {
redisTemplate.expire(queueKey, Duration.ofMinutes(10));
redisTemplate.expire(partyKey, Duration.ofMinutes(10));
redisTemplate.expire(statusKey, Duration.ofMinutes(10));
}
}
Copy link

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

CALLING 상태 변경 시 TTL 조정 로직 검토 필요

"CALLING" 상태로 변경할 때 모든 관련 키의 TTL을 10분으로 단축하는 로직은 좋지만, 몇 가지 고려사항이 있습니다.

다음 사항들을 확인해주세요:

  1. 하드코딩된 문자열 "CALLING" 대신 상수 사용을 고려하세요
  2. TTL 변경이 기존 대기열의 다른 사용자들에게 영향을 주지 않는지 확인이 필요합니다

개선 제안:

+	private static final String STATUS_CALLING = "CALLING";
+	private static final Duration CALLING_TTL = Duration.ofMinutes(10);
 
 	// 상태값 저장 및 변경
 	public void setWaitingStatus(Long storeId, String userId, String status) {
 		String queueKey = RedisKeyUtils.buildWaitingKeyPrefix() + storeId;
 		String partyKey = RedisKeyUtils.buildWaitingPartySizeKeyPrefix() + storeId;
 		String statusKey = RedisKeyUtils.buildWaitingStatusKeyPrefix() + storeId;
 		redisTemplate.opsForHash().put(statusKey, userId, status);
 		// WAITING -> CALLING 으로 변경 시 TTL 12h에서 10m로 변경
-		if (status.equals("CALLING")) {
+		if (STATUS_CALLING.equals(status)) {
-			redisTemplate.expire(queueKey, Duration.ofMinutes(10));
-			redisTemplate.expire(partyKey, Duration.ofMinutes(10));
-			redisTemplate.expire(statusKey, Duration.ofMinutes(10));
+			redisTemplate.expire(queueKey, CALLING_TTL);
+			redisTemplate.expire(partyKey, CALLING_TTL);
+			redisTemplate.expire(statusKey, CALLING_TTL);
 		}
 	}

🏁 Script executed:

#!/bin/bash
# CALLING 상태 관련 상수나 enum이 정의되어 있는지 확인
rg -A 3 -B 3 "CALLING|WAITING" --type java

Length of output: 19839


CALLING 상태 변경 시 TTL 조정 및 상수화 적용 필요

다음 사항을 반영해주세요:

  • ReservationStatus enum 활용
    • 하드코딩된 "CALLING" 대신 ReservationStatus.CALLING.name() 혹은 메서드 시그니처를 ReservationStatus status 로 변경 고려
  • TTL 값 상수화
    Duration.ofMinutes(10)private static final Duration CALLING_TTL = Duration.ofMinutes(10); 로 분리
  • Redis 키 전체에 대한 expire 적용 주의
    queueKey, partyKey, statusKey 모두 같은 store 단위 키에 적용되어, 한 사용자 호출 시 같은 스토어의 모든 대기 데이터 TTL이 10분으로 변경됩니다.
    • 의도치 않은 대기열 만료를 방지하기 위해 per-user TTL 전략(개별 키 분리, Sorted Set 활용 등) 검토 필요

예시 변경안:

+ private static final Duration CALLING_TTL = Duration.ofMinutes(10);

  // 상태값 저장 및 변경
  public void setWaitingStatus(Long storeId, String userId, String status) {
      String queueKey  = RedisKeyUtils.buildWaitingKeyPrefix()       + storeId;
      String partyKey  = RedisKeyUtils.buildWaitingPartySizeKeyPrefix() + storeId;
      String statusKey = RedisKeyUtils.buildWaitingStatusKeyPrefix() + storeId;
      redisTemplate.opsForHash().put(statusKey, userId, status);
      // WAITING -> CALLING 으로 변경 시 TTL 12h에서 10m로 변경
-     if (status.equals("CALLING")) {
+     if (ReservationStatus.CALLING.name().equals(status)) {
          redisTemplate.expire(queueKey,  CALLING_TTL);
          redisTemplate.expire(partyKey,  CALLING_TTL);
          redisTemplate.expire(statusKey, CALLING_TTL);
      }
  }
🤖 Prompt for AI Agents
In
nowait-app-admin-api/src/main/java/com/nowait/applicationadmin/reservation/repository/WaitingRedisRepository.java
around lines 24 to 36, replace the hardcoded "CALLING" string with the
ReservationStatus enum by changing the method signature to accept
ReservationStatus status or using ReservationStatus.CALLING.name(). Extract the
TTL value Duration.ofMinutes(10) into a private static final constant like
CALLING_TTL. Additionally, revise the TTL expiration logic to avoid setting the
expire on the entire store-level keys (queueKey, partyKey, statusKey) since this
affects all users in the store; instead, implement a per-user TTL strategy by
separating keys per user or using a Sorted Set to manage expirations
individually.

Comment on lines 80 to 99
@Transactional
public CallingWaitingResponseDto callWaiting(Long storeId, String userId, MemberDetails memberDetails) {
User user = userRepository.findById(memberDetails.getId()).orElseThrow(UserNotFoundException::new);
if (!Role.SUPER_ADMIN.equals(user.getRole()) && !user.getStoreId().equals(storeId)) {
throw new ReservationViewUnauthorizedException();
}
String status = waitingRedisRepository.getWaitingStatus(storeId, userId);
System.out.println(status);
if (!"WAITING".equals(status)) {
throw new IllegalStateException("이미 호출되었거나 없는 예약입니다.");
}
waitingRedisRepository.setWaitingStatus(storeId, userId, "CALLING");
LocalDateTime calledAt = LocalDateTime.now();
return CallingWaitingResponseDto.builder()
.storeId(storeId)
.userId(userId)
.status("CALLING")
.calledAt(calledAt)
.build();
}
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

메서드 로직은 올바르지만 몇 가지 개선이 필요합니다.

전반적인 구현 로직은 적절하나 다음 사항들을 개선해주세요:

  1. System.out.println 디버그 출력을 제거하고 적절한 로깅으로 교체
  2. 응답 DTO에서 rankpartySize 필드가 설정되지 않음
  3. Redis 전용 작업에 @Transactional이 필요한지 검토 필요
-		System.out.println(status);
+		// Redis에서 rank와 partySize 정보도 가져와서 응답에 포함
+		Long rank = waitingRedisRepository.getRank(storeId, userId);
+		Integer partySize = waitingRedisRepository.getPartySize(storeId, userId);
+		
 		if (!"WAITING".equals(status)) {
 			throw new IllegalStateException("이미 호출되었거나 없는 예약입니다.");
 		}
@@ -96,6 +99,8 @@
 		return CallingWaitingResponseDto.builder()
 			.storeId(storeId)
 			.userId(userId)
 			.status("CALLING")
 			.calledAt(calledAt)
+			.rank(rank != null ? rank.intValue() + 1 : null)
+			.partySize(partySize)
 			.build();
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
@Transactional
public CallingWaitingResponseDto callWaiting(Long storeId, String userId, MemberDetails memberDetails) {
User user = userRepository.findById(memberDetails.getId()).orElseThrow(UserNotFoundException::new);
if (!Role.SUPER_ADMIN.equals(user.getRole()) && !user.getStoreId().equals(storeId)) {
throw new ReservationViewUnauthorizedException();
}
String status = waitingRedisRepository.getWaitingStatus(storeId, userId);
System.out.println(status);
if (!"WAITING".equals(status)) {
throw new IllegalStateException("이미 호출되었거나 없는 예약입니다.");
}
waitingRedisRepository.setWaitingStatus(storeId, userId, "CALLING");
LocalDateTime calledAt = LocalDateTime.now();
return CallingWaitingResponseDto.builder()
.storeId(storeId)
.userId(userId)
.status("CALLING")
.calledAt(calledAt)
.build();
}
@Transactional
public CallingWaitingResponseDto callWaiting(Long storeId, String userId, MemberDetails memberDetails) {
User user = userRepository.findById(memberDetails.getId()).orElseThrow(UserNotFoundException::new);
if (!Role.SUPER_ADMIN.equals(user.getRole()) && !user.getStoreId().equals(storeId)) {
throw new ReservationViewUnauthorizedException();
}
String status = waitingRedisRepository.getWaitingStatus(storeId, userId);
- System.out.println(status);
+ // Redis에서 rank와 partySize 정보도 가져와서 응답에 포함
+ Long rank = waitingRedisRepository.getRank(storeId, userId);
+ Integer partySize = waitingRedisRepository.getPartySize(storeId, userId);
+
if (!"WAITING".equals(status)) {
throw new IllegalStateException("이미 호출되었거나 없는 예약입니다.");
}
waitingRedisRepository.setWaitingStatus(storeId, userId, "CALLING");
LocalDateTime calledAt = LocalDateTime.now();
return CallingWaitingResponseDto.builder()
.storeId(storeId)
.userId(userId)
.status("CALLING")
.calledAt(calledAt)
+ .rank(rank != null ? rank.intValue() + 1 : null)
+ .partySize(partySize)
.build();
}
🤖 Prompt for AI Agents
In
nowait-app-admin-api/src/main/java/com/nowait/applicationadmin/reservation/service/ReservationService.java
around lines 80 to 99, replace the System.out.println debug output with a proper
logger call to follow best practices. Add the missing rank and partySize fields
to the CallingWaitingResponseDto before returning it, ensuring these values are
retrieved appropriately from the reservation or waiting data. Finally, review
whether the @Transactional annotation is necessary for this Redis-related method
and remove it if it does not manage any database transactions to avoid
unnecessary overhead.

- redis에 예약 상태 key 추가
- 특정 userId 호출 로직 구현
- 예약 상태 CALLING으로 변경 시, TTL 10분으로 변경
@HyemIin HyemIin merged commit 41fc5c0 into develop Jul 21, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants