diff --git a/client/src/apis/product.js b/client/src/apis/product.js
index 3c0a135f..e5135825 100644
--- a/client/src/apis/product.js
+++ b/client/src/apis/product.js
@@ -49,7 +49,7 @@ export const updateProduct = async (productId, productData) => {
};
// 상품 삭제
-export const DeleteProduct = async productId => {
+export const deleteProduct = async productId => {
try {
const res = await publicAxios.delete(`/v1/vendor/product/${productId}`);
return res;
diff --git a/client/src/components/vendor/modal/ProductModal.jsx b/client/src/components/vendor/modal/ProductModal.jsx
index b5878637..e15a9711 100644
--- a/client/src/components/vendor/modal/ProductModal.jsx
+++ b/client/src/components/vendor/modal/ProductModal.jsx
@@ -1,6 +1,6 @@
import { useEffect, useState } from 'react';
import BaseModal from '@/components/common/BaseModal';
-import { createProduct } from '@/apis/product';
+import { createProduct, deleteProduct, updateProduct } from '@/apis/product';
import InputWeb from '@/components/common/inputs/InputWeb';
const ProductModal = ({
@@ -15,6 +15,20 @@ const ProductModal = ({
const [productMemo, setProductMemo] = useState('');
const [contractNumber, setContractNumber] = useState('');
+ // 모달이 열릴 때마다 초기 상태 설정
+ useEffect(() => {
+ if (modalTitle === '상품 등록') {
+ setProductName(''); // 빈값
+ setProductPrice('');
+ setProductMemo('');
+ } else if (modalTitle === '상품 상세 정보' && productDetailData) {
+ setProductName(productDetailData.productName); // 기존 데이터값
+ setProductPrice(productDetailData.productPrice);
+ setProductMemo(productDetailData.productMemo);
+ }
+ }, [isShowModal, modalTitle, productDetailData]);
+
+ // 상품 등록 이벤트핸들러
const handleCreateProduct = async () => {
const productData = {
productName,
@@ -24,37 +38,45 @@ const ProductModal = ({
try {
await createProduct(productData);
- // alert('상품을 등록했습니다.');
- setIsShowModal(false);
+ alert('상품을 등록했습니다.');
+ setIsShowModal(false); // 상품 등록 후 모달 닫기
refreshProductList(); // 등록 후 상품 목록 리렌더링
} catch (err) {
alert('상품 등록에 실패했습니다.');
- console.error('axiosProductDetail => ', err.response.data);
+ console.error('axiosProductCreate => ', err.response.data);
}
};
- // 공백입력 막기
- const handleKeyDown = e => {
- e.key === ' ' && e.preventDefault();
- };
+ // 상품 수정 이벤트핸들러
+ const handleUpdateProduct = async productId => {
+ const productData = {
+ productPrice,
+ productMemo,
+ };
- // 모달이 열릴 때마다 초기 상태 설정
- useEffect(() => {
- if (modalTitle === '상품 등록') {
- setProductName(''); // 빈값
- setProductPrice('');
- setProductMemo('');
- } else if (modalTitle === '상품 상세 정보' && productDetailData) {
- setProductName(productDetailData.productName); // 기존 데이터값
- setProductPrice(productDetailData.productPrice);
- setProductMemo(productDetailData.productMemo);
+ try {
+ await updateProduct(productDetailData.productId, productData);
+ alert('상품을 수정했습니다.');
+ setIsShowModal(false);
+ refreshProductList();
+ } catch (err) {
+ alert('상품 수정에 실패했습니다.');
+ console.error('axiosProductUpdate => ', err.response.data);
}
- }, [isShowModal, modalTitle, productDetailData]);
+ };
- const handleDelete = () => {
- const isConfirmed = window.confirm('정말 삭제하시겠습니까?');
+ const handleDeleteProduct = async () => {
+ const isConfirmed = window.confirm('정말 삭제하시겠습니까?'); // 고도화 필요
if (isConfirmed) {
- setIsShowModal(false);
+ try {
+ await deleteProduct(productDetailData.productId);
+ alert('상품을 삭제했습니다.');
+ setIsShowModal(false);
+ refreshProductList();
+ } catch (err) {
+ alert('상품 삭제에 실패했습니다.');
+ console.error('axiosProductDelete => ', err.response.data);
+ }
}
};
@@ -155,10 +177,12 @@ const ProductModal = ({
-
);
diff --git a/server/src/main/java/kr/or/kosa/cmsplusmain/domain/messaging/controller/MessagingController.java b/server/src/main/java/kr/or/kosa/cmsplusmain/domain/messaging/controller/MessagingController.java
index 87ef3ecc..e7e04241 100644
--- a/server/src/main/java/kr/or/kosa/cmsplusmain/domain/messaging/controller/MessagingController.java
+++ b/server/src/main/java/kr/or/kosa/cmsplusmain/domain/messaging/controller/MessagingController.java
@@ -1,43 +1,43 @@
-package kr.or.kosa.cmsplusmain.domain.messaging.controller;
-
-import org.springframework.http.HttpStatus;
-import org.springframework.http.ResponseEntity;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-import kr.or.kosa.cmsplusmain.domain.messaging.dto.SmsVerifyDto;
-import kr.or.kosa.cmsplusmain.domain.messaging.service.SmsService;
-import lombok.RequiredArgsConstructor;
-
-@RestController
-@RequiredArgsConstructor
-@RequestMapping("/api/v1/vendor/auth")
-public class MessagingController {
-
- private final SmsService smsService;
-
- // SMS 인증번호 요청
- @PostMapping("/sms/sending")
- public ResponseEntity sendSms(@RequestBody SmsVerifyDto smsVerifyDto) {
- try {
- smsService.sendSmsCode(smsVerifyDto);
- return ResponseEntity.ok("[SMS] 인증코드 전송 성공");
- } catch (Exception e) {
- return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(e.getMessage());
- }
- }
-
- // SMS 인증번호 검사
- @PostMapping("/sms/verification")
- public ResponseEntity SmsVerification(@RequestBody SmsVerifyDto smsVerifyDto) {
- try {
- smsService.verifySmsCode(smsVerifyDto);
- return ResponseEntity.ok("[SMS] 인증 성공");
- } catch (Exception e) {
- return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(e.getMessage());
- }
- }
-
-}
+//package kr.or.kosa.cmsplusmain.domain.messaging.controller;
+//
+//import org.springframework.http.HttpStatus;
+//import org.springframework.http.ResponseEntity;
+//import org.springframework.web.bind.annotation.PostMapping;
+//import org.springframework.web.bind.annotation.RequestBody;
+//import org.springframework.web.bind.annotation.RequestMapping;
+//import org.springframework.web.bind.annotation.RestController;
+//
+//import kr.or.kosa.cmsplusmain.domain.messaging.dto.SmsVerifyDto;
+//import kr.or.kosa.cmsplusmain.domain.messaging.service.SmsService;
+//import lombok.RequiredArgsConstructor;
+//
+//@RestController
+//@RequiredArgsConstructor
+//@RequestMapping("/api/v1/vendor/auth")
+//public class MessagingController {
+//
+// private final SmsService smsService;
+//
+// // SMS 인증번호 요청
+// @PostMapping("/sms/sending")
+// public ResponseEntity sendSms(@RequestBody SmsVerifyDto smsVerifyDto) {
+// try {
+// smsService.sendSmsCode(smsVerifyDto);
+// return ResponseEntity.ok("[SMS] 인증코드 전송 성공");
+// } catch (Exception e) {
+// return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(e.getMessage());
+// }
+// }
+//
+// // SMS 인증번호 검사
+// @PostMapping("/sms/verification")
+// public ResponseEntity SmsVerification(@RequestBody SmsVerifyDto smsVerifyDto) {
+// try {
+// smsService.verifySmsCode(smsVerifyDto);
+// return ResponseEntity.ok("[SMS] 인증 성공");
+// } catch (Exception e) {
+// return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(e.getMessage());
+// }
+// }
+//
+//}
diff --git a/server/src/main/java/kr/or/kosa/cmsplusmain/domain/messaging/repository/SmsRepository.java b/server/src/main/java/kr/or/kosa/cmsplusmain/domain/messaging/repository/SmsRepository.java
index a3dc5d29..dd02ee02 100644
--- a/server/src/main/java/kr/or/kosa/cmsplusmain/domain/messaging/repository/SmsRepository.java
+++ b/server/src/main/java/kr/or/kosa/cmsplusmain/domain/messaging/repository/SmsRepository.java
@@ -1,37 +1,37 @@
-package kr.or.kosa.cmsplusmain.domain.messaging.repository;
-
-import java.time.Duration;
-
-import org.springframework.data.redis.core.StringRedisTemplate;
-import org.springframework.stereotype.Repository;
-
-import lombok.RequiredArgsConstructor;
-
-@Repository
-@RequiredArgsConstructor
-public class SmsRepository {
-
- // Redis 데이터 설정
- private final String PREFIX = "SMS-"; // 저장되는 키 값은 "SMS-01011111111" 형태
- private final int LIMIT_TIME = 5 * 60; // 300초(5분)동안 캐싱
-
- private final StringRedisTemplate redisTemplate;
-
- public void createSmsVerification(String phone, String certificationNumber) {
- redisTemplate.opsForValue()
- .set(PREFIX + phone, certificationNumber, Duration.ofSeconds(LIMIT_TIME));
- }
-
- public String getSmsVerification(String phone) {
- return redisTemplate.opsForValue().get(PREFIX + phone);
- }
-
- public void removeSmsCertification(String phone) {
- redisTemplate.delete(PREFIX + phone);
- }
-
- public boolean hasKey(String phone) {
- return redisTemplate.hasKey(PREFIX + phone);
- }
-
-}
+//package kr.or.kosa.cmsplusmain.domain.messaging.repository;
+//
+//import java.time.Duration;
+//
+//import org.springframework.data.redis.core.StringRedisTemplate;
+//import org.springframework.stereotype.Repository;
+//
+//import lombok.RequiredArgsConstructor;
+//
+//@Repository
+//@RequiredArgsConstructor
+//public class SmsRepository {
+//
+// // Redis 데이터 설정
+// private final String PREFIX = "SMS-"; // 저장되는 키 값은 "SMS-01011111111" 형태
+// private final int LIMIT_TIME = 5 * 60; // 300초(5분)동안 캐싱
+//
+// private final StringRedisTemplate redisTemplate;
+//
+// public void createSmsVerification(String phone, String certificationNumber) {
+// redisTemplate.opsForValue()
+// .set(PREFIX + phone, certificationNumber, Duration.ofSeconds(LIMIT_TIME));
+// }
+//
+// public String getSmsVerification(String phone) {
+// return redisTemplate.opsForValue().get(PREFIX + phone);
+// }
+//
+// public void removeSmsCertification(String phone) {
+// redisTemplate.delete(PREFIX + phone);
+// }
+//
+// public boolean hasKey(String phone) {
+// return redisTemplate.hasKey(PREFIX + phone);
+// }
+//
+//}
diff --git a/server/src/main/java/kr/or/kosa/cmsplusmain/domain/messaging/service/SmsServiceImpl.java b/server/src/main/java/kr/or/kosa/cmsplusmain/domain/messaging/service/SmsServiceImpl.java
index 5c37a0f5..a5e00370 100644
--- a/server/src/main/java/kr/or/kosa/cmsplusmain/domain/messaging/service/SmsServiceImpl.java
+++ b/server/src/main/java/kr/or/kosa/cmsplusmain/domain/messaging/service/SmsServiceImpl.java
@@ -1,40 +1,40 @@
-package kr.or.kosa.cmsplusmain.domain.messaging.service;
-
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-
-import kr.or.kosa.cmsplusmain.domain.messaging.dto.SmsVerifyDto;
-import kr.or.kosa.cmsplusmain.domain.messaging.repository.SmsRepository;
-import kr.or.kosa.cmsplusmain.util.SmsUtil;
-import lombok.RequiredArgsConstructor;
-
-@Service
-@Transactional
-@RequiredArgsConstructor
-public class SmsServiceImpl implements SmsService {
-
- private final SmsUtil smsUtil;
- private final SmsRepository smsRepository;
-
- public void sendSmsCode(SmsVerifyDto smsVerifyDto) {
- String to = smsVerifyDto.getPhone();
- int randomNumber = (int)(Math.random() * 9000) + 1000;
- String certificationNumber = String.valueOf(randomNumber);
- smsUtil.sendSms(to, certificationNumber);
- smsRepository.createSmsVerification(to, certificationNumber);
- }
-
- public void verifySmsCode(SmsVerifyDto smsVerifyDto) {
- if (!isVerify(smsVerifyDto)) {
- throw new IllegalArgumentException("[SMS] 인증번호 불일치");
- }
- smsRepository.removeSmsCertification(smsVerifyDto.getPhone());
- }
-
- public boolean isVerify(SmsVerifyDto smsVerifyDto) {
- return smsRepository.hasKey(smsVerifyDto.getPhone()) &&
- smsRepository.getSmsVerification(smsVerifyDto.getPhone())
- .equals(smsVerifyDto.getSmsVerifyCode());
- }
-
-}
+//package kr.or.kosa.cmsplusmain.domain.messaging.service;
+//
+//import org.springframework.stereotype.Service;
+//import org.springframework.transaction.annotation.Transactional;
+//
+//import kr.or.kosa.cmsplusmain.domain.messaging.dto.SmsVerifyDto;
+//import kr.or.kosa.cmsplusmain.domain.messaging.repository.SmsRepository;
+//import kr.or.kosa.cmsplusmain.util.SmsUtil;
+//import lombok.RequiredArgsConstructor;
+//
+//@Service
+//@Transactional
+//@RequiredArgsConstructor
+//public class SmsServiceImpl implements SmsService {
+//
+// private final SmsUtil smsUtil;
+// private final SmsRepository smsRepository;
+//
+// public void sendSmsCode(SmsVerifyDto smsVerifyDto) {
+// String to = smsVerifyDto.getPhone();
+// int randomNumber = (int)(Math.random() * 9000) + 1000;
+// String certificationNumber = String.valueOf(randomNumber);
+// smsUtil.sendSms(to, certificationNumber);
+// smsRepository.createSmsVerification(to, certificationNumber);
+// }
+//
+// public void verifySmsCode(SmsVerifyDto smsVerifyDto) {
+// if (!isVerify(smsVerifyDto)) {
+// throw new IllegalArgumentException("[SMS] 인증번호 불일치");
+// }
+// smsRepository.removeSmsCertification(smsVerifyDto.getPhone());
+// }
+//
+// public boolean isVerify(SmsVerifyDto smsVerifyDto) {
+// return smsRepository.hasKey(smsVerifyDto.getPhone()) &&
+// smsRepository.getSmsVerification(smsVerifyDto.getPhone())
+// .equals(smsVerifyDto.getSmsVerifyCode());
+// }
+//
+//}
diff --git a/server/src/main/java/kr/or/kosa/cmsplusmain/domain/payment/entity/method/CardPaymentMethod.java b/server/src/main/java/kr/or/kosa/cmsplusmain/domain/payment/entity/method/CardPaymentMethod.java
index 8e4b98b3..ba3ccb13 100644
--- a/server/src/main/java/kr/or/kosa/cmsplusmain/domain/payment/entity/method/CardPaymentMethod.java
+++ b/server/src/main/java/kr/or/kosa/cmsplusmain/domain/payment/entity/method/CardPaymentMethod.java
@@ -27,11 +27,12 @@ public class CardPaymentMethod extends PaymentMethodInfo {
private String cardNumber;
@Comment("카드 유효기간 월")
- @Column(name = "card_info_validity_month", nullable = false)
+ @Column(name = "card_info_validity_month", nullable = true)
+// @NotNull
private int cardMonth;
@Comment("카드 유효기간 년")
- @Column(name = "card_info_validity_year", nullable = false)
+ @Column(name = "card_info_validity_year", nullable = true)
private int cardYear;
@Comment("카드 소유주명")
diff --git a/server/src/main/java/kr/or/kosa/cmsplusmain/domain/product/dto/ProductSearch.java b/server/src/main/java/kr/or/kosa/cmsplusmain/domain/product/dto/ProductSearch.java
deleted file mode 100644
index a746727d..00000000
--- a/server/src/main/java/kr/or/kosa/cmsplusmain/domain/product/dto/ProductSearch.java
+++ /dev/null
@@ -1,23 +0,0 @@
-package kr.or.kosa.cmsplusmain.domain.product.dto;
-
-import lombok.Getter;
-import lombok.Setter;
-
-import java.time.LocalDate;
-
-@Getter
-@Setter // 세터 필요
-public class ProductSearch { // final 금지(@RequestParam으로 받는게 아님)
-
- /****** 검색 가능 항목 *******/
- private String productName;
- private String productMemo;
-
- /****** 날짜 선택 항목 *******/
- private LocalDate productCreatedDate;
-
- /****** 숫자 이하 항목 *******/
- private Integer productPrice;
- private Integer contractNumber;
-
-}
diff --git a/server/src/main/java/kr/or/kosa/cmsplusmain/domain/product/dto/ProductUpdateReq.java b/server/src/main/java/kr/or/kosa/cmsplusmain/domain/product/dto/ProductUpdateReq.java
index 3d02d4d4..5452019a 100644
--- a/server/src/main/java/kr/or/kosa/cmsplusmain/domain/product/dto/ProductUpdateReq.java
+++ b/server/src/main/java/kr/or/kosa/cmsplusmain/domain/product/dto/ProductUpdateReq.java
@@ -1,8 +1,8 @@
package kr.or.kosa.cmsplusmain.domain.product.dto;
import jakarta.validation.constraints.NotNull;
+import kr.or.kosa.cmsplusmain.domain.base.validator.Memo;
import kr.or.kosa.cmsplusmain.domain.product.entity.Product;
-import kr.or.kosa.cmsplusmain.domain.product.validator.ProductMemo;
import kr.or.kosa.cmsplusmain.domain.product.validator.ProductPrice;
import kr.or.kosa.cmsplusmain.domain.vendor.entity.Vendor;
import lombok.Getter;
@@ -14,7 +14,7 @@ public class ProductUpdateReq {
@ProductPrice
private int productPrice;
- @ProductMemo
+ @Memo
private String productMemo;
public Product toEntity(Vendor vendor) {
diff --git a/server/src/main/java/kr/or/kosa/cmsplusmain/util/SmsUtil.java b/server/src/main/java/kr/or/kosa/cmsplusmain/util/SmsUtil.java
index 4962b261..075dcb5f 100644
--- a/server/src/main/java/kr/or/kosa/cmsplusmain/util/SmsUtil.java
+++ b/server/src/main/java/kr/or/kosa/cmsplusmain/util/SmsUtil.java
@@ -1,44 +1,44 @@
-package kr.or.kosa.cmsplusmain.util;
-
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.stereotype.Component;
-
-import net.nurigo.sdk.NurigoApp;
-import net.nurigo.sdk.message.model.Message;
-import net.nurigo.sdk.message.request.SingleMessageSendingRequest;
-import net.nurigo.sdk.message.response.SingleMessageSentResponse;
-import net.nurigo.sdk.message.service.DefaultMessageService;
-
-import jakarta.annotation.PostConstruct;
-
-@Component
-public class SmsUtil { //util로 뺴도 됨
-
- @Value("${coolsms.sender-number}")
- private String senderNumber;
-
- @Value("${coolsms.api-key}")
- private String apiKey;
-
- @Value("${coolsms.api-secret}")
- private String apiSecret;
-
- DefaultMessageService messageService;
-
- @PostConstruct
- public void init() {
- this.messageService = NurigoApp.INSTANCE.initialize(apiKey, apiSecret, "https://api.coolsms.co.kr");
- }
-
- public SingleMessageSentResponse sendSms(String to, String verificationCode) {
- Message message = new Message();
- message.setFrom(senderNumber);
- message.setTo(to);
- message.setText("[CMS+] 본인 확인 인증번호는 " + verificationCode + "입니다.");
-
- SingleMessageSentResponse response = this.messageService.sendOne(new SingleMessageSendingRequest(message));
- System.out.println(response);
- return response;
- }
-
-}
\ No newline at end of file
+//package kr.or.kosa.cmsplusmain.util;
+//
+//import org.springframework.beans.factory.annotation.Value;
+//import org.springframework.stereotype.Component;
+//
+//import net.nurigo.sdk.NurigoApp;
+//import net.nurigo.sdk.message.model.Message;
+//import net.nurigo.sdk.message.request.SingleMessageSendingRequest;
+//import net.nurigo.sdk.message.response.SingleMessageSentResponse;
+//import net.nurigo.sdk.message.service.DefaultMessageService;
+//
+//import jakarta.annotation.PostConstruct;
+//
+//@Component
+//public class SmsUtil { //util로 뺴도 됨
+//
+// @Value("${coolsms.sender-number}")
+// private String senderNumber;
+//
+// @Value("${coolsms.api-key}")
+// private String apiKey;
+//
+// @Value("${coolsms.api-secret}")
+// private String apiSecret;
+//
+// DefaultMessageService messageService;
+//
+// @PostConstruct
+// public void init() {
+// this.messageService = NurigoApp.INSTANCE.initialize(apiKey, apiSecret, "https://api.coolsms.co.kr");
+// }
+//
+// public SingleMessageSentResponse sendSms(String to, String verificationCode) {
+// Message message = new Message();
+// message.setFrom(senderNumber);
+// message.setTo(to);
+// message.setText("[CMS+] 본인 확인 인증번호는 " + verificationCode + "입니다.");
+//
+// SingleMessageSentResponse response = this.messageService.sendOne(new SingleMessageSendingRequest(message));
+// System.out.println(response);
+// return response;
+// }
+//
+//}
\ No newline at end of file
diff --git a/server/src/main/resources/application.yml b/server/src/main/resources/application.yml
index efd1627c..ffa1b801 100644
--- a/server/src/main/resources/application.yml
+++ b/server/src/main/resources/application.yml
@@ -35,12 +35,6 @@ logging:
level:
org.hibernate.orm.jdbc.bind: trace
-
-coolsms:
- api-key: NCS6FSXZJNQ2W4VB
- api-secret: PW7L7IUM5REUVNL0HYKANDIL7XSLBRHK
- sender-number: 01026270378
-
cloud:
aws:
s3: