mirror of
https://github.com/won-ktds/smarketing-backend.git
synced 2026-06-12 20:39:09 +00:00
fix redis config
This commit is contained in:
+6
-5
@@ -42,15 +42,16 @@ public class StoreController {
|
||||
/**
|
||||
* 매장 정보 조회
|
||||
*
|
||||
* @param storeId 조회할 매장 ID
|
||||
* //@param userId 조회할 매장 ID
|
||||
* @return 매장 정보
|
||||
*/
|
||||
@Operation(summary = "매장 조회", description = "매장 ID로 매장 정보를 조회합니다.")
|
||||
@Operation(summary = "매장 조회", description = "유저 ID로 매장 정보를 조회합니다.")
|
||||
@GetMapping
|
||||
public ResponseEntity<ApiResponse<StoreResponse>> getStore(
|
||||
@Parameter(description = "매장 ID", required = true)
|
||||
@RequestParam String storeId) {
|
||||
StoreResponse response = storeService.getStore(storeId);
|
||||
// @Parameter(description = "유저 ID", required = true)
|
||||
// @RequestParam String userId
|
||||
) {
|
||||
StoreResponse response = storeService.getStore();
|
||||
return ResponseEntity.ok(ApiResponse.success(response));
|
||||
}
|
||||
|
||||
|
||||
@@ -30,8 +30,8 @@ public class Store {
|
||||
@Column(name = "store_id")
|
||||
private Long id;
|
||||
|
||||
@Column(name = "member_id", nullable = false)
|
||||
private Long memberId;
|
||||
@Column(name = "user_id", nullable = false)
|
||||
private String userId;
|
||||
|
||||
@Column(name = "store_name", nullable = false, length = 100)
|
||||
private String storeName;
|
||||
|
||||
+4
-4
@@ -16,18 +16,18 @@ public interface StoreRepository extends JpaRepository<Store, Long> {
|
||||
/**
|
||||
* 회원 ID로 매장 조회
|
||||
*
|
||||
* @param memberId 회원 ID
|
||||
* @param userId 회원 ID
|
||||
* @return 매장 정보 (Optional)
|
||||
*/
|
||||
Optional<Store> findByMemberId(Long memberId);
|
||||
Optional<Store> findByUserId(String userId);
|
||||
|
||||
/**
|
||||
* 회원의 매장 존재 여부 확인
|
||||
*
|
||||
* @param memberId 회원 ID
|
||||
* @param userId 회원 ID
|
||||
* @return 존재 여부
|
||||
*/
|
||||
boolean existsByMemberId(Long memberId);
|
||||
boolean existsByUserId(String userId);
|
||||
|
||||
/**
|
||||
* 매장명으로 매장 조회
|
||||
|
||||
+2
-2
@@ -28,10 +28,10 @@ public interface StoreService {
|
||||
/**
|
||||
* 매장 정보 조회 (매장 ID)
|
||||
*
|
||||
* @param storeId 매장 ID
|
||||
* //@param userId 매장 ID
|
||||
* @return 매장 정보
|
||||
*/
|
||||
StoreResponse getStore(String storeId);
|
||||
StoreResponse getStore();
|
||||
|
||||
/**
|
||||
* 매장 정보 수정
|
||||
|
||||
+13
-11
@@ -7,6 +7,8 @@ import com.won.smarketing.store.dto.StoreResponse;
|
||||
import com.won.smarketing.store.dto.StoreUpdateRequest;
|
||||
import com.won.smarketing.store.entity.Store;
|
||||
import com.won.smarketing.store.repository.StoreRepository;
|
||||
import jakarta.xml.bind.annotation.XmlType;
|
||||
import lombok.Builder;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.security.core.context.SecurityContextHolder;
|
||||
@@ -34,19 +36,19 @@ public class StoreServiceImpl implements StoreService {
|
||||
@Override
|
||||
@Transactional
|
||||
public StoreResponse register(StoreCreateRequest request) {
|
||||
String currentUserId = getCurrentUserId();
|
||||
Long memberId = Long.valueOf(currentUserId); // 실제로는 Member ID 조회 필요
|
||||
String memberId = getCurrentUserId();
|
||||
// Long memberId = Long.valueOf(currentUserId); // 실제로는 Member ID 조회 필요
|
||||
|
||||
log.info("매장 등록 시작: {} (회원: {})", request.getStoreName(), memberId);
|
||||
|
||||
// 회원당 하나의 매장만 등록 가능
|
||||
if (storeRepository.existsByMemberId(memberId)) {
|
||||
if (storeRepository.existsByUserId(memberId)) {
|
||||
throw new BusinessException(ErrorCode.STORE_ALREADY_EXISTS);
|
||||
}
|
||||
|
||||
// 매장 엔티티 생성 및 저장
|
||||
Store store = Store.builder()
|
||||
.memberId(memberId)
|
||||
.userId(memberId)
|
||||
.storeName(request.getStoreName())
|
||||
.businessType(request.getBusinessType())
|
||||
.address(request.getAddress())
|
||||
@@ -71,10 +73,10 @@ public class StoreServiceImpl implements StoreService {
|
||||
*/
|
||||
@Override
|
||||
public StoreResponse getMyStore() {
|
||||
String currentUserId = getCurrentUserId();
|
||||
Long memberId = Long.valueOf(currentUserId);
|
||||
String memberId = getCurrentUserId();
|
||||
// Long memberId = Long.valueOf(currentUserId);
|
||||
|
||||
Store store = storeRepository.findByMemberId(memberId)
|
||||
Store store = storeRepository.findByUserId(memberId)
|
||||
.orElseThrow(() -> new BusinessException(ErrorCode.STORE_NOT_FOUND));
|
||||
|
||||
return toStoreResponse(store);
|
||||
@@ -83,14 +85,14 @@ public class StoreServiceImpl implements StoreService {
|
||||
/**
|
||||
* 매장 정보 조회 (매장 ID)
|
||||
*
|
||||
* @param storeId 매장 ID
|
||||
* //@param storeId 매장 ID
|
||||
* @return 매장 정보
|
||||
*/
|
||||
@Override
|
||||
public StoreResponse getStore(String storeId) {
|
||||
public StoreResponse getStore() {
|
||||
try {
|
||||
Long id = Long.valueOf(storeId);
|
||||
Store store = storeRepository.findById(id)
|
||||
String userId = getCurrentUserId();
|
||||
Store store = storeRepository.findByUserId(userId)
|
||||
.orElseThrow(() -> new BusinessException(ErrorCode.STORE_NOT_FOUND));
|
||||
|
||||
return toStoreResponse(store);
|
||||
|
||||
Reference in New Issue
Block a user