Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
ba1ff79
:recycle: rewardName β†’ reward ν•„λ“œλͺ… μˆ˜μ •
shinchaerin79 Aug 21, 2025
e18ed46
:recycle: μ „ν™”λ²ˆν˜Έ νŒ¨ν„΄ μˆ˜μ • (슀마트콜 번호 ν—ˆμš©)
shinchaerin79 Aug 21, 2025
2f448d0
:recycle: Store Response에 authCode μΆ”κ°€
shinchaerin79 Aug 21, 2025
78f2041
:sparkles: νŠΉμ • 메뉴 μ‚­μ œ API κ΅¬ν˜„
shinchaerin79 Aug 21, 2025
027bf9c
Merge branch 'refactor/store-phoneNumber' of https://github.com/Dan-C…
shinchaerin79 Aug 21, 2025
de30c2b
:bug: κ°€κ²Œ 전체 쑰회 μ‹œ 메뉴 λͺ©λ‘ 쑰회 μ‹€νŒ¨ 버그 μˆ˜μ •
shinchaerin79 Aug 21, 2025
9727add
Merge pull request #132 from Dan-Chu/refactor/openai-mission-response…
naooung Aug 22, 2025
1ba7cb1
Merge pull request #134 from Dan-Chu/refactor/store-phoneNumber
naooung Aug 22, 2025
8e26437
Merge pull request #138 from Dan-Chu/feature/menu-delete
naooung Aug 22, 2025
8fb936f
Merge pull request #136 from Dan-Chu/refactor/store-response-authcode
shinchaerin79 Aug 22, 2025
857805a
Merge pull request #140 from Dan-Chu/fix/store-get-menus
shinchaerin79 Aug 22, 2025
1a7a0f5
:sparkles: content[i].store ꡬ쑰λ₯Ό λ§žμΆ”κΈ° μœ„ν•΄ StoreListItemResponse DTO μΆ”κ°€
shinchaerin79 Aug 22, 2025
1357241
:recycle: κ°€κ²Œ λͺ©λ‘ νŽ˜μ΄μ§• 응닡 ꡬ쑰 μˆ˜μ •
shinchaerin79 Aug 22, 2025
487fce3
Merge pull request #144 from Dan-Chu/refactor/store-paging-response
naooung Aug 22, 2025
9953a0f
:wrench: μ„œλΈŒλͺ¨λ“ˆ monitoring μ„€μ •κ°’ μΆ”κ°€
naooung Aug 22, 2025
2557e86
:wrench: SecurityConfig prometheus μ ‘κ·Ό ν—ˆμš©
naooung Aug 22, 2025
4227cfe
:heavy_plus_sign: monitoring κ΄€λ ¨ μ˜μ‘΄μ„± μΆ”κ°€
naooung Aug 22, 2025
bcf79d7
:sparkles: prometheus.yml μ„œλ²„ 볡사 κ³Όμ • μΆ”κ°€
naooung Aug 22, 2025
ddbde07
:sparkles: Prometheus & Grafana ꡬ좕
naooung Aug 22, 2025
5ebda8f
Merge pull request #146 from Dan-Chu/feature/monitoring
naooung Aug 22, 2025
f1356c6
:wrench: μ„œλΈŒλͺ¨λ“ˆ AccessToken 만료 μ‹œκ°„ λ³€κ²½
naooung Aug 23, 2025
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
4 changes: 2 additions & 2 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,14 @@ jobs:
token: ${{ secrets.GIT_ACTION_TOKEN }}
submodules: true

- name: Copy docker-compose.yml to Server
- name: Copy compose & prometheus.yml to Server
uses: appleboy/scp-action@master
with:
host: ${{ secrets.SSH_HOST }}
port: ${{ secrets.SSH_PORT }}
username: ${{ secrets.SSH_USERNAME }}
key: ${{ secrets.SSH_PRIVATE_KEY }}
source: "docker-compose.yml"
source: "docker-compose.yml,prometheus.yml"
target: "~/app"

- name: Deploy on server
Expand Down
4 changes: 4 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ dependencies {
// Flyway
implementation 'org.flywaydb:flyway-core'
implementation 'org.flywaydb:flyway-mysql'

// Grafana & Prometheus
implementation 'org.springframework.boot:spring-boot-starter-actuator'
implementation 'io.micrometer:micrometer-registry-prometheus'
}

tasks.named('test') {
Expand Down
66 changes: 63 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ services:
depends_on:
- app
- dozzle
- grafana
- prometheus
networks:
- danchu-network
restart: unless-stopped
Expand All @@ -74,9 +76,66 @@ services:
image: amir20/dozzle:latest
container_name: dozzle
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro # 둜그 접근을 μœ„ν•œ 도컀 μ†ŒμΌ“ 마운트
- /var/run/docker.sock:/var/run/docker.sock:ro # 둜그 접근을 μœ„ν•œ 도컀 μ†ŒμΌ“ 마운트
networks:
- danchu-network
- danchu-network
restart: unless-stopped

grafana:
image: grafana/grafana
container_name: grafana
environment:
- GF_SERVER_ROOT_URL=https://grafana.danchu.site/
- GF_SECURITY_ADMIN_PASSWORD=${GRAFANA_ADMIN_PASSWORD}
- GF_USERS_ALLOW_SIGN_UP=false
volumes:
- grafana-storage:/var/lib/grafana
networks:
- danchu-network
restart: unless-stopped

prometheus:
image: prom/prometheus:latest
container_name: prometheus
volumes:
- ./prometheus.yml:/etc/prometheus/prometheus.yml:ro
networks:
- danchu-network
restart: unless-stopped

node-exporter:
image: prom/node-exporter
container_name: node-exporter
command:
- '--path.rootfs=/host'
volumes:
- '/:/host:ro,rslave'
networks:
- danchu-network
restart: unless-stopped

mysqld-exporter:
image: prom/mysqld-exporter:v0.14.0
container_name: mysqld-exporter
environment:
- DATA_SOURCE_NAME=exporter:${MYSQL_EXPORTER_PASSWORD}@(mysql:3306)/danchu
depends_on:
mysql:
condition: service_healthy
networks:
- danchu-network
restart: unless-stopped

redis-exporter:
image: oliver006/redis_exporter:v1.67.0
container_name: redis-exporter
environment:
- REDIS_ADDR=redis:6379
depends_on:
redis:
condition: service_healthy
networks:
- danchu-network
restart: unless-stopped

networks:
Expand All @@ -85,4 +144,5 @@ networks:

volumes:
mysql-data:
redis-data:
redis-data:
grafana-storage:
49 changes: 49 additions & 0 deletions prometheus.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
global:
scrape_interval: 5s
evaluation_interval: 5s
scrape_timeout: 4s

scrape_configs:
# Prometheus
- job_name: 'prometheus'
static_configs:
- targets: ['prometheus:9090']
labels:
application: prometheus
service: prometheus

# Spring Boot
- job_name: 'danchu'
metrics_path: /actuator/prometheus
static_configs:
- targets: ['app:8080']
labels:
application: danchu
service: app
component: spring-boot

# node-exporter
- job_name: 'node-exporter'
static_configs:
- targets: ['node-exporter:9100']
labels:
application: danchu
service: node-exporter

# MySQL
- job_name: 'mysql'
static_configs:
- targets: ['mysqld-exporter:9104']
labels:
application: danchu
service: mysql
component: exporter

# Redis
- job_name: 'redis'
static_configs:
- targets: ['redis-exporter:9121']
labels:
application: danchu
service: redis
component: exporter
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
Expand Down Expand Up @@ -69,4 +70,13 @@ public ResponseEntity<BaseResponse<List<MenuResponse>>> getMenus(@PathVariable L
List<MenuResponse> responses = menuService.getMenus(storeId);
return ResponseEntity.ok(BaseResponse.success("메뉴 전체 μ‘°νšŒμ— μ„±κ³΅ν–ˆμŠ΅λ‹ˆλ‹€.", responses));
}

@Operation(summary = "νŠΉμ • 메뉴 μ‚­μ œ", description = "storeId와 menuId둜 νŠΉμ • 메뉴λ₯Ό μ‚­μ œν•©λ‹ˆλ‹€.")
@DeleteMapping("/{menuId}")
public ResponseEntity<BaseResponse> deleteMenu(
@Parameter(description = "κ°€κ²Œ ID", example = "1") @PathVariable Long storeId,
@Parameter(description = "메뉴 ID", example = "3") @PathVariable Long menuId) {
menuService.deleteMenu(storeId, menuId);
return ResponseEntity.ok(BaseResponse.success("메뉴 μ‚­μ œμ— μ„±κ³΅ν–ˆμŠ΅λ‹ˆλ‹€."));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -86,4 +86,43 @@ public List<MenuResponse> getMenus(Long storeId) {
.map(menuMapper::toResponse) // priceFormatted 포함됨
.toList();
}

/**
* νŠΉμ • 메뉴 μ‚­μ œ
*
* @param storeId λŒ€μƒ κ°€κ²Œ ID
* @param menuId μ‚­μ œν•  메뉴 ID
* @throws CustomException {@code STORE_NOT_FOUND} - κ°€κ²Œκ°€ μ‘΄μž¬ν•˜μ§€ μ•ŠλŠ” 경우
* @throws CustomException {@code MENU_NOT_FOUND} - ν•΄λ‹Ή κ°€κ²Œμ— 메뉴가 μ‘΄μž¬ν•˜μ§€ μ•ŠλŠ” 경우
*/
public void deleteMenu(Long storeId, Long menuId) {
// κ°€κ²Œ 쑴재 확인
if (!storeRepository.existsById(storeId)) {
throw new CustomException(
com.likelion.danchu.domain.store.exception.StoreErrorCode.STORE_NOT_FOUND);
}

// 메뉴 쑰회 (storeId 일치 μ—¬λΆ€ 검증)
Menu menu =
menuRepository
.findById(menuId)
.orElseThrow(() -> new CustomException(MenuErrorCode.MENU_NOT_FOUND));

if (!menu.getStore().getId().equals(storeId)) {
throw new CustomException(MenuErrorCode.MENU_NOT_FOUND); // λ‹€λ₯Έ κ°€κ²Œμ˜ 메뉴λ₯Ό 잘λͺ» μš”μ²­ν•œ 경우
}

// S3 이미지 μ‚­μ œ (μžˆμ„ 경우)
String url = menu.getImageUrl(); // μ—”ν‹°ν‹° ν•„λ“œλͺ… 맞좰 μ‚¬μš©
if (url != null && !url.isBlank()) {
try {
s3Service.deleteByUrl(url);
} catch (Exception ignored) {
// 이미지 μ‚­μ œ μ‹€νŒ¨λŠ” λ¬΄μ‹œν•˜κ³  메뉴 μ‚­μ œ μ§„ν–‰
}
}

// 메뉴 μ‚­μ œ
menuRepository.delete(menu);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public class MissionRecommendResponse {
private String title;

@Schema(description = "λ―Έμ…˜ 보상(이름/μ„€λͺ…)", example = "사이닀 1μž”")
private String rewardName;
private String reward;

@Schema(description = "κ°€κ²Œ 이름", example = "λ™λ°©μ†μΉΌκ΅­μˆ˜")
private String storeName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ private MissionRecommendResponse toDto(Mission m) {
return MissionRecommendResponse.builder()
.missionId(m.getId())
.title(m.getTitle())
.rewardName(m.getReward())
.reward(m.getReward())
.storeName(s != null ? s.getName() : null)
.build();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import com.likelion.danchu.domain.store.dto.request.StoreRequest;
import com.likelion.danchu.domain.store.dto.response.PageableResponse;
import com.likelion.danchu.domain.store.dto.response.StoreDistanceResponse;
import com.likelion.danchu.domain.store.dto.response.StoreListItemResponse;
import com.likelion.danchu.domain.store.dto.response.StoreResponse;
import com.likelion.danchu.domain.store.exception.StoreErrorCode;
import com.likelion.danchu.domain.store.service.StoreHashtagService;
Expand Down Expand Up @@ -56,7 +57,7 @@ public class StoreController {
- κ°€κ²Œ 이름: **1자 이상, 10자 이내**
- μ£Όμ†Œ: **1자 이상, 50자 이내**
- κ°€κ²Œ μ†Œκ°œ: **1자 이상, 200자 이내**
- μ „ν™”λ²ˆν˜Έ: **010-1234-5678** λ˜λŠ” **02-345-6789** ν˜•μ‹
- μ „ν™”λ²ˆν˜Έ: **010-1234-5678** / **02-345-6789** / **0507-1418-3557** ν˜•μ‹
- μ˜€ν”ˆ/마감 μ‹œκ°„: **HH:mm** ν˜•μ‹ (예: 09:00, 21:00)
- 인증 μ½”λ“œ: **숫자 4자리 (예: 0123)**
- 이미지 파일: **multipart/form-data** ν˜•μ‹
Expand Down Expand Up @@ -98,10 +99,11 @@ public ResponseEntity<BaseResponse<StoreResponse>> createStore(
- size : νŽ˜μ΄μ§€ λ‹Ή 보여쀄 κ°€κ²Œ μˆ˜μž…λ‹ˆλ‹€. (κΈ°λ³Έκ°’: 3)
""")
@GetMapping
public ResponseEntity<BaseResponse<PageableResponse<StoreResponse>>> getPaginatedStores(
public ResponseEntity<BaseResponse<PageableResponse<StoreListItemResponse>>> getPaginatedStores(
@RequestParam(defaultValue = "0") int page, @RequestParam(defaultValue = "3") int size) {

PageableResponse<StoreResponse> storeResponses = storeService.getPaginatedStores(page, size);
PageableResponse<StoreListItemResponse> storeResponses =
storeService.getPaginatedStores(page, size);
return ResponseEntity.ok(BaseResponse.success("κ°€κ²Œ νŽ˜μ΄μ§• μ‘°νšŒμ— μ„±κ³΅ν–ˆμŠ΅λ‹ˆλ‹€.", storeResponses));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ public class StoreRequest {

@NotBlank(message = "μ „ν™”λ²ˆν˜ΈλŠ” ν•„μˆ˜μž…λ‹ˆλ‹€.")
@Pattern(
regexp = "^\\d{2,3}-\\d{3,4}-\\d{4}$",
message = "μ „ν™”λ²ˆν˜ΈλŠ” ν˜•μ‹μ— 맞게 μž…λ ₯ν•΄μ£Όμ„Έμš”. (예: 010-1234-5678 / 02-345-6789)")
regexp = "^(?:\\d{2,3}-\\d{3,4}-\\d{4}|050\\d-\\d{3,4}-\\d{4})$",
message = "μ „ν™”λ²ˆν˜ΈλŠ” ν˜•μ‹μ— 맞게 μž…λ ₯ν•΄μ£Όμ„Έμš”. (예: 010-1234-5678 / 02-345-6789 / 0507-1418-3557)")
@Schema(description = "μ „ν™”λ²ˆν˜Έ", example = "010-1234-5678")
private String phoneNumber;

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package com.likelion.danchu.domain.store.dto.response;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;

@Getter
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Schema(title = "StoreListItemResponse", description = "λͺ©λ‘ μ•„μ΄ν…œ(κ°€κ²Œ 정보λ₯Ό store둜 λž˜ν•‘)")
public class StoreListItemResponse {

@Schema(description = "κ°€κ²Œ 정보", requiredMode = Schema.RequiredMode.REQUIRED)
private StoreResponse store;
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ public class StoreResponse {
@Schema(description = "마감 μ‹œκ°„ (HH:mm)", example = "21:00")
private String closeTime;

@Schema(description = "κ°€κ²Œ 인증 μ½”λ“œ")
private String authCode;

@Schema(description = "λŒ€ν‘œ 이미지 URL", example = "https://s3.amazonaws.com/bucket/image.jpg")
private String mainImageUrl;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import com.likelion.danchu.domain.hashtag.dto.response.HashtagResponse;
import com.likelion.danchu.domain.menu.dto.response.MenuResponse;
import com.likelion.danchu.domain.store.dto.request.StoreRequest;
import com.likelion.danchu.domain.store.dto.response.StoreListItemResponse;
import com.likelion.danchu.domain.store.dto.response.StoreResponse;
import com.likelion.danchu.domain.store.entity.Store;

Expand Down Expand Up @@ -58,6 +59,7 @@ public StoreResponse toResponse(
.phoneNumber(store.getPhoneNumber())
.openTime(store.getOpenTime())
.closeTime(store.getCloseTime())
.authCode(store.getAuthCode())
.mainImageUrl(store.getMainImageUrl())
.hashtags(hashtags != null ? hashtags : List.of()) // null λ°©μ–΄
.isOpen(isOpen)
Expand All @@ -72,4 +74,18 @@ public StoreResponse toResponse(Store store, List<HashtagResponse> hashtags) {
public StoreResponse toResponse(Store store) {
return toResponse(store, List.of(), List.of());
}

// StoreResponseλ₯Ό store둜 감싼 λͺ©λ‘ μ•„μ΄ν…œμœΌλ‘œ λ³€ν™˜
public StoreListItemResponse toListItem(
Store store, List<HashtagResponse> hashtags, List<MenuResponse> menus) {
return StoreListItemResponse.builder().store(toResponse(store, hashtags, menus)).build();
}

public StoreListItemResponse toListItem(Store store, List<HashtagResponse> hashtags) {
return StoreListItemResponse.builder().store(toResponse(store, hashtags)).build();
}

public StoreListItemResponse toListItem(Store store) {
return StoreListItemResponse.builder().store(toResponse(store)).build();
}
}
Loading