Skip to content

Commit

Permalink
Feat: db 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
orieasy1 committed Nov 23, 2024
1 parent fb7243b commit b58f0c9
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 51 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@

import java.util.UUID;

import static org.apache.commons.io.FilenameUtils.getExtension;

@RequiredArgsConstructor
@Transactional
@Service
Expand Down Expand Up @@ -51,7 +53,7 @@ public OptionImageResponse uploadOptionImage(Long menuId, Long optionId, Multipa
throw new MenuException(MenuErrorCode.INVALID_OPTION_FOR_MENU);
}

String fileName = UUID.randomUUID() + imageFile.getOriginalFilename();
String fileName = "menu_" + menuId + "_" + getExtension(imageFile.getOriginalFilename());
// 파일데이터와 파일명 넘겨서 S3에 저장
String imageUrl = s3Service.uploadFile(imageFile, fileName);

Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/application.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
spring:
profiles:
active: dev
active: prod
springdoc:
packages-to-scan: com.jojoidu.book.easy
default-consumes-media-type: application/json;charset=UTF-8
Expand Down
76 changes: 27 additions & 49 deletions src/main/resources/data.sql
Original file line number Diff line number Diff line change
Expand Up @@ -51,55 +51,33 @@ VALUES
('FOOD', '후렌치후라이', '감자튀김',NOW(),NOW());

-- 메뉴 삽입
INSERT INTO menu (menu_id, store_id, category, menu_name, menu_price)
VALUES (1, 1, '시즌메뉴', '방어 사시미', 40000);
INSERT INTO menu (menu_id, store_id, category, menu_name, menu_price)
VALUES (2, 1, '시즌메뉴', '굴탕면', 21000);
INSERT INTO menu (menu_id, store_id, category, menu_name, menu_price)
VALUES (3, 1, '시즌메뉴', '고구마맛탕', 12000);
INSERT INTO menu (menu_id, store_id, category, menu_name, menu_price)
VALUES (4, 1, '런치세트', '초밥 정식', 12000);
INSERT INTO menu (menu_id, store_id, category, menu_name, menu_price)
VALUES (5, 1, '런치세트', '우동 정식', 11000);
INSERT INTO menu (menu_id, store_id, category, menu_name, menu_price)
VALUES (6, 1, '메인', '모듬꼬치', 18000);
INSERT INTO menu (menu_id, store_id, category, menu_name, menu_price)
VALUES (7, 1, '메인', '짬뽕탕 (면 포함)', 16000);
INSERT INTO menu (menu_id, store_id, category, menu_name, menu_price)
VALUES (8, 1, '사이드', '닭튀김', 8000);
INSERT INTO menu (menu_id, store_id, category, menu_name, menu_price)
VALUES (9, 2, '커피', '아메리카노', 1700);
INSERT INTO menu (menu_id, store_id, category, menu_name, menu_price)
VALUES (10, 2, '커피', '콜드브루', 2800);
INSERT INTO menu (menu_id, store_id, category, menu_name, menu_price)
VALUES (11, 2, '논커피', '아이스티', 2100);
INSERT INTO menu (menu_id, store_id, category, menu_name, menu_price)
VALUES (12, 2, '디저트', '소금빵', 5100);
INSERT INTO menu (menu_id, store_id, category, menu_name, menu_price)
VALUES (13, 2, '디저트', '크림치즈베이글', 6000);
INSERT INTO menu (menu_id, store_id, category, menu_name, menu_price)
VALUES (14, 2, '시즌메뉴', '딸기주스', 6000);
INSERT INTO menu (menu_id, store_id, category, menu_name, menu_price)
VALUES (15, 2, '시즌메뉴', '딸기라떼', 7000);
INSERT INTO menu (menu_id, store_id, category, menu_name, menu_price)
VALUES (16, 2, '시즌메뉴', '꿀밤라떼', 7500);
INSERT INTO menu (menu_id, store_id, category, menu_name, menu_price)
VALUES (17, 3, '햄버거', '비프치즈버거', 6500);
INSERT INTO menu (menu_id, store_id, category, menu_name, menu_price)
VALUES (18, 3, '햄버거', '치킨마일드버거', 7200);
INSERT INTO menu (menu_id, store_id, category, menu_name, menu_price)
VALUES (19, 3, '햄버거', '핫포크버거', 6000);
INSERT INTO menu (menu_id, store_id, category, menu_name, menu_price)
VALUES (20, 3, '사이드', '감자튀김', 1500);
INSERT INTO menu (menu_id, store_id, category, menu_name, menu_price)
VALUES (21, 3, '사이드', '치즈스틱', 1500);
INSERT INTO menu (menu_id, store_id, category, menu_name, menu_price)
VALUES (22, 3, '사이드', '스윗소스', 300);
INSERT INTO menu (menu_id, store_id, category, menu_name, menu_price)
VALUES (23, 3, '음료', '콜라', 1500);
INSERT INTO menu (menu_id, store_id, category, menu_name, menu_price)
VALUES (24, 3, '사이드', '사이다', 1500);INSERT INTO menu (menu_id, store_id, category, menu_name, menu_price)
VALUES (25, 3, '디저트', '아이스크림', 1200);
INSERT INTO menu (menu_id, store_id, category, menu_name, menu_price, image_url)
VALUES
(1, 1, '시즌메뉴', '방어 사시미', 40000, NULL),
(2, 1, '시즌메뉴', '굴탕면', 21000, NULL),
(3, 1, '시즌메뉴', '고구마맛탕', 12000, NULL),
(4, 1, '런치세트', '초밥 정식', 12000, NULL),
(5, 1, '런치세트', '우동 정식', 11000, NULL),
(6, 1, '메인', '모듬꼬치', 18000, NULL),
(7, 1, '메인', '짬뽕탕 (면 포함)', 16000, NULL),
(8, 1, '사이드', '닭튀김', 8000, NULL),
(9, 2, '커피', '아메리카노', 1700, NULL),
(10, 2, '커피', '콜드브루', 2800, NULL),
(11, 2, '논커피', '아이스티', 2100, NULL),
(12, 2, '디저트', '소금빵', 5100, NULL),
(13, 2, '디저트', '크림치즈베이글', 6000, NULL),
(14, 2, '시즌메뉴', '딸기주스', 6000, NULL),
(15, 2, '시즌메뉴', '딸기라떼', 7000, NULL),
(16, 2, '시즌메뉴', '꿀밤라떼', 7500, NULL),
(17, 3, '햄버거', '비프치즈버거', 6500, NULL),
(18, 3, '햄버거', '치킨마일드버거', 7200, NULL),
(19, 3, '햄버거', '핫포크버거', 6000, NULL),
(20, 3, '사이드', '감자튀김', 1500, NULL),
(21, 3, '사이드', '치즈스틱', 1500, NULL),
(22, 3, '사이드', '스윗소스', 300, NULL),
(23, 3, '음료', '콜라', 1500),
(24, 3, '사이드', '사이다', 1500),
(25, 3, '디저트', '아이스크림', 1200);


-- 메뉴 ID가 2이라고 가정 (menu_id = 2)
Expand Down

0 comments on commit b58f0c9

Please sign in to comment.