Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
730485c
fix: data์˜ serviceID ํƒ€์ž… ๋ณ€๊ฒฝ ๋ฐ ์นดํ…Œ๊ณ ๋ฆฌ ์ˆ˜์ •
bumstone Apr 10, 2025
903b4e6
fix: ๊ด€๋ฆฌ์ž ๊ถŒํ•œ ์ˆ˜์ •, ๋„๋ฉ”์ธ ๊ฒฝ๋กœ ์ˆ˜์ •
bumstone Apr 16, 2025
9d78e40
Merge branch 'dev' of https://github.com/EWSNproject/HyetaekOn-BE intโ€ฆ
bumstone Apr 16, 2025
cfc6b41
Merge branch 'main' of https://github.com/EWSNproject/HyetaekOn-BE inโ€ฆ
bumstone Apr 16, 2025
0c537a4
fix: post ์‚ฌ์šฉ ์„œ๋น„์Šค id Long -> String ํƒ€์ž… ๋ณ€ํ™˜
bumstone Apr 17, 2025
e5a66c1
Merge pull request #35 from EWSNproject/fix/#19-public_data
bumstone Apr 17, 2025
4b9e0fa
fix: ๊ณต๊ณต๋ฐ์ดํ„ฐ ๋งคํ•‘ ์˜ค๋ฅ˜
bumstone Apr 18, 2025
39eb0d7
fix: ๊ณต๊ณต์„œ๋น„์Šค ์ „์ฒด ์กฐํšŒ ์ •๋ ฌ ๋ฐฉ์‹๊ณผ ์„œ๋น„์Šค ๋ถ„์•ผ ๋ฐ˜ํ™˜ ๋งคํ•‘ ์ˆ˜์ •
bumstone Apr 18, 2025
6322db6
Merge pull request #40 from EWSNproject/fix/#39-public_data
bumstone Apr 18, 2025
e4ee87e
refactor: post ์—”ํ‹ฐํ‹ฐ ๊ฐœ์„ 
bumstone Apr 19, 2025
bcc84f4
feat: post ์ „์ฒด๋ชฉ๋ก ์กฐํšŒ, postType๋ณ„ ๋ชฉ๋ก ์กฐํžˆ
bumstone Apr 19, 2025
b02b6e1
Merge branch 'fix/#39-public_data' of https://github.com/EWSNproject/โ€ฆ
bumstone Apr 19, 2025
03fbcf8
feat: ๊ฒŒ์‹œ๊ธ€ ์ถ”์ฒœ ๊ธฐ๋Šฅ ๊ตฌํ˜„
bumstone Apr 19, 2025
5506338
style: ์‚ฌ์šฉํ•˜์ง€ ์•Š๋Š” ์ฝ”๋“œ ์ œ๊ฑฐ
bumstone Apr 19, 2025
07c495b
refactor: ๊ฒŒ์‹œ๊ธ€ ์ „์ฒด, type ๋ชฉ๋ก ์กฐํšŒ ํŽ˜์ด์ง• + ์ถ”์ฒœ์—ฌ๋ถ€ ํ™•์ธ, ๊ฒŒ์‹œ๊ธ€ ์ƒ์„ฑ ๋ฐ ์—…๋ฐ์ดํŠธ Dto ์ƒ์„ฑ
bumstone Apr 19, 2025
cb6d653
refactor: ๊ฒŒ์‹œ๊ธ€ ์ƒ์„ฑ, ์—…๋ฐ์ดํŠธ, ์‚ญ์ œ ๋ฐฉ์‹ ์ด๋ฏธ์ง€ ์—…๋กœ๋“œ, ์‚ญ์ œ ์ถ”๊ฐ€, soft Delete๋ฐฉ์‹๋„์ž…, requesโ€ฆ
bumstone Apr 26, 2025
52c950f
Merge pull request #43 from EWSNproject/refactor/#38-post
bumstone Apr 26, 2025
5495469
feat: ์ž์‹ ์ด ์ž‘์„ฑํ•œ ๊ฒŒ์‹œ๊ธ€ ๋ชฉ๋ก ์กฐํšŒ, ์ถ”์ฒœํ•œ ๊ฒŒ์‹œ๊ธ€ ๋ชฉ๋ก ์กฐํšŒ ๊ตฌํ˜„
bumstone Apr 26, 2025
7e81c81
feat: post security path ์ถ”๊ฐ€
bumstone Apr 26, 2025
034ceda
feat: post ๋ชฉ๋ก ์กฐํšŒ Security Path endpoint ๊ตฌ๋ถ„, post ๋„๋ฉ”์ธ ๊ฒฝ๋กœ ์ถ”๊ฐ€
bumstone Apr 26, 2025
168c045
feat: postType ํ•œ๊ธ€๋ช… ํŒŒ๋ผ๋ฏธํ„ฐ ์‚ฌ์šฉ
bumstone Apr 26, 2025
0c52355
feat: post ์ƒ์„ฑ ์‹œ, ์ €์žฅ ์‹œ์ ์— ํ˜„์žฌ ์‹œ๊ฐ„์œผ๋กœ ์„ค์ •
bumstone Apr 26, 2025
b7e4c24
Merge branch 'refactor/#38-post' of https://github.com/EWSNproject/Hyโ€ฆ
bumstone Apr 27, 2025
c606f32
feat: ๊ฒŒ์‹œ๊ธ€ ๋ชฉ๋ก ์กฐํšŒ ์—”๋“œํฌ์ธํŠธ ๋ณ€๊ฒฝ ํ›„ ์ ์šฉ
bumstone Apr 28, 2025
0d8190e
feat: ๊ณต๊ณต์„œ๋น„์Šค ๋ชฉ๋ก ์กฐํšŒ ๋งคํ•‘ ๋ฐ query ์˜ค๋ฅ˜ ์ˆ˜์ •
bumstone Apr 28, 2025
590efee
feat: ๊ณต๊ณต๋ฐ์ดํ„ฐ ๋ฐ ๊ณต๊ณต์„œ๋น„์Šค ์ผ์ • null๊ฐ’ ํ•„ํ„ฐ๋ง
bumstone Apr 29, 2025
e2d8dea
feat: ๊ณต๊ณต๋ฐ์ดํ„ฐ ํ˜ธ์ถœ ์‹œ mongodb ์ €์žฅ ์„ค์ •
bumstone Apr 29, 2025
d07e09c
refactor: mongodbํ•„๋“œ ์ˆ˜์ •, ๊ณต๊ณต๋ฐ์ดํ„ฐ ํ˜ธ์ถœ ์‹œ mongodb ๋ณ€ํ™˜ ๋ฐ์ดํ„ฐ ์ €์žฅ
bumstone Apr 29, 2025
86f4e34
post์ „์ฒด์ ์œผ๋กœ ์ˆ˜์ •
uk0k Apr 29, 2025
2ab9369
Merge pull request #47 from EWSNproject/bug/#44-publicService
bumstone Apr 29, 2025
1a7ff0f
feat: ๊ณต๊ณต์„œ๋น„์Šค ํ•„ํ„ฐ๋ง
bumstone Apr 29, 2025
d2e38f2
Merge pull request #48 from EWSNproject/bug/#44-publicService
bumstone Apr 29, 2025
f35eb65
feat: ๊ณต๊ณต์„œ๋น„์Šค ์‚ฌ์šฉ์ž ๋งž์ถคํ˜• ๊ฒ€์ƒ‰ ๊ธฐ๋Šฅ, ์ž๋™์™„์„ฑ ๊ตฌํ˜„
bumstone Apr 30, 2025
610507d
feat: ๊ณต๊ณต์„œ๋น„์Šค ์บ์‹ฑ ์„ค์ •
bumstone Apr 30, 2025
f35144c
feat: ์‚ฌ์šฉ์ž ์ˆ˜์ต ๋ฐ ์ง์—… ์ •๋ณด์— ๋”ฐ๋ฅธ incomelevel ์„ ์ •
bumstone Apr 30, 2025
248f025
feat: securityPath ๋“ฑ๋ก
bumstone Apr 30, 2025
12e8a29
refactor: mongodb ์ค‘๋ณต ์ œ๊ฑฐ ๋ฐ ์—…์„œํŠธ๋ฐฉ์‹ ๋™์ž‘
bumstone Apr 30, 2025
fd5cd35
refactor: mongodb ์ค‘๋ณต ์ œ๊ฑฐ ๋ฐ ์—…์„œํŠธ๋ฐฉ์‹ ๋™์ž‘
bumstone Apr 30, 2025
552b2e4
refactor: mongodb ์ค‘๋ณต ์ œ๊ฑฐ ๋ฐ ์œ ๋‹ˆํฌ ์ธ๋ฑ์Šค ์žฌ์„ค์ •
bumstone May 1, 2025
44893e7
refactor: mongodb ์ ‘์† ์‹œ๊ฐ„ ์—ฐ์žฅ, ๊ฒŒ์‹œ๊ธ€ ํ•„๋“œ ์ˆ˜์ •
bumstone May 1, 2025
698498e
Merge pull request #52 from EWSNproject/feat/#49-service_search
bumstone May 1, 2025
ed69244
style: UserInterest ํŒจํ‚ค์ง€๋ช… ์Šค๋„ค์ดํฌ ์ผ€์ด์Šค๋กœ ์ˆ˜์ •
bumstone May 1, 2025
b946e0e
feat: redis๋ฅผ ํ™œ์šฉํ•œ ์œ ์ €๋ณ„ ๊ฒ€์ƒ‰๊ธฐ๋ก ์ƒ์„ฑ, ์‚ญ์ œ ๊ตฌํ˜„
bumstone May 1, 2025
610ea32
rafactor: userId ๋ถˆํ•„์š”ํ•œ ๊ฒ€์ฆ ์ œ๊ฑฐ ๋ฐ refresh-expired ๋ณ€๊ฒฝ
bumstone May 1, 2025
92988b0
fix: MongoDB Atlas Search์˜ $search ๋ฌธ๋ฒ•์— ์œ ํšจํ•œ ์—ฐ์‚ฐ์ž๋กœ ์ˆ˜์ •
bumstone May 1, 2025
4e7a652
Merge pull request #55 from EWSNproject/feat/#54-search_history
bumstone May 1, 2025
b03d1b2
feat: ์‚ฌ์šฉ์ž ๋งž์ถค ์„œ๋น„์Šค ์ถ”์ฒœ
bumstone May 1, 2025
1be961d
PostController annotation ์ˆ˜์ •
uk0k May 2, 2025
37133fa
Merge branch 'fix/#36-post' into dev
uk0k May 2, 2025
4f8e01d
Merge pull request #56 from EWSNproject/feat/#53-recommend_service
bumstone May 3, 2025
94a6c6e
fix: ๋ถ๋งˆํฌ ๊ณต๊ณต์„œ๋น„์Šค ์ „์ฒด ๋ชฉ๋ก ์กฐํšŒ ๋ฐ˜์˜
bumstone May 3, 2025
4208e60
refactor: ์œ ์ € ์‹ ๊ณ  ์‚ฌ์œ  jsonํƒ€์ž… ์ˆ˜์ •
bumstone May 4, 2025
a32e3d4
feat: ์œ ์ € ์‹ ๊ณ  ๋กœ์ง ๋ฐ ์‹ ๊ณ  ์ฒ˜๋ฆฌ ์ƒํƒœ enum ์ ์šฉ, ๊ด€๋ฆฌ์ž ์‹ ๊ณ  ์Šน์ธ, ๊ฑฐ๋ถ€ ๋กœ์ง ์ถ”๊ฐ€
bumstone May 4, 2025
23644b1
style: ์‚ฌ์šฉํ•˜์ง€ ์•Š๋Š” ๋ถ€๋ถ„ ์ œ๊ฑฐ
bumstone May 4, 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
10 changes: 7 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,13 @@ dependencies {
runtimeOnly 'com.mysql:mysql-connector-j'

// MongoDB
/*implementation 'org.springframework.boot:spring-boot-starter-data-mongodb'
implementation 'org.mongodb:mongodb-driver-sync'
implementation 'org.mongodb:mongodb-driver-core'*/
implementation 'org.springframework.boot:spring-boot-starter-data-mongodb'
// implementation 'org.mongodb:mongodb-driver-sync'
// implementation 'org.mongodb:mongodb-driver-core'

// Caffeine
implementation 'org.springframework.boot:spring-boot-starter-cache'
implementation 'com.github.ben-manes.caffeine:caffeine'

// redis
implementation 'org.springframework.boot:spring-boot-starter-data-redis'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.data.jpa.repository.config.EnableJpaAuditing;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.data.mongodb.repository.config.EnableMongoRepositories;

@EnableJpaAuditing
@SpringBootApplication
@EnableScheduling
@EnableMongoRepositories
public class HyetaekonApplication {

public static void main(String[] args) {
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public class BookMarkController {
// ๋ถ๋งˆํฌ ์ถ”๊ฐ€
@PostMapping
public ResponseEntity<Void> addBookmark(
@PathVariable("serviceId") Long serviceId,
@PathVariable("serviceId") String serviceId,
@AuthenticationPrincipal CustomUserDetails customUserDetails
) {
bookmarkService.addBookmark(serviceId, customUserDetails.getId());
Expand All @@ -29,7 +29,7 @@ public ResponseEntity<Void> addBookmark(
// ๋ถ๋งˆํฌ ์ œ๊ฑฐ
@DeleteMapping
public ResponseEntity<Void> removeBookmark(
@PathVariable("serviceId") Long serviceId,
@PathVariable("serviceId") String serviceId,
@AuthenticationPrincipal CustomUserDetails customUserDetails
) {
bookmarkService.removeBookmark(serviceId, customUserDetails.getId());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
@Repository
public interface BookmarkRepository extends JpaRepository<Bookmark, Long> {

boolean existsByUserIdAndPublicServiceId(Long userId, Long serviceId);
boolean existsByUserIdAndPublicServiceId(Long userId, String serviceId);

Optional<Bookmark> findByUserIdAndPublicServiceId(Long userId, Long serviceId);
Optional<Bookmark> findByUserIdAndPublicServiceId(Long userId, String serviceId);

/*@Query("SELECT b FROM Bookmark b " +
"JOIN FETCH b.publicService ps " +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import com.hyetaekon.hyetaekon.common.exception.GlobalException;
import com.hyetaekon.hyetaekon.publicservice.entity.PublicService;
import com.hyetaekon.hyetaekon.publicservice.repository.PublicServiceRepository;
import com.hyetaekon.hyetaekon.publicservice.service.PublicServiceHandler;
import com.hyetaekon.hyetaekon.user.entity.User;
import com.hyetaekon.hyetaekon.user.repository.UserRepository;
import jakarta.transaction.Transactional;
Expand All @@ -20,8 +21,9 @@ public class BookmarkService {
private final BookmarkRepository bookmarkRepository;
private final UserRepository userRepository;
private final PublicServiceRepository publicServiceRepository;
private final PublicServiceHandler publicServiceHandler;

public void addBookmark(Long serviceId, Long userId) {
public void addBookmark(String serviceId, Long userId) {
User user = userRepository.findById(userId)
.orElseThrow(() -> new GlobalException(BOOKMARK_USER_NOT_FOUND));

Expand All @@ -42,10 +44,11 @@ public void addBookmark(Long serviceId, Long userId) {

// ๋ถ๋งˆํฌ ์ˆ˜ ์ฆ๊ฐ€
publicService.increaseBookmarkCount();
publicServiceRepository.save(publicService);
}

@Transactional
public void removeBookmark(Long serviceId, Long userId) {
public void removeBookmark(String serviceId, Long userId) {
Bookmark bookmark = bookmarkRepository.findByUserIdAndPublicServiceId(userId, serviceId)
.orElseThrow(() -> new GlobalException(BOOKMARK_NOT_FOUND));

Expand All @@ -54,5 +57,6 @@ public void removeBookmark(Long serviceId, Long userId) {
// ๋ถ๋งˆํฌ ์ˆ˜ ๊ฐ์†Œ
PublicService publicService = bookmark.getPublicService();
publicService.decreaseBookmarkCount();
publicServiceRepository.save(publicService);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package com.hyetaekon.hyetaekon.common.config;

import com.github.benmanes.caffeine.cache.Caffeine;
import org.springframework.cache.CacheManager;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.cache.caffeine.CaffeineCacheManager;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import com.hyetaekon.hyetaekon.publicservice.entity.mongodb.CacheType;

import java.time.Duration;
import java.util.Arrays;

@Configuration
@EnableCaching
public class CacheConfig {
@Bean
public CacheManager cacheManager() {
CaffeineCacheManager cacheManager = new CaffeineCacheManager();

// ๊ฐ ์บ์‹œ ํƒ€์ž…์— ๋Œ€ํ•œ ์„ค์ • ๋“ฑ๋ก
Arrays.stream(CacheType.values())
.forEach(cacheType -> {
cacheManager.registerCustomCache(cacheType.getCacheName(),
Caffeine.newBuilder()
.recordStats() // ์บ์‹œ ํ†ต๊ณ„ ๊ธฐ๋ก
.expireAfterWrite(Duration.ofHours(cacheType.getExpiredAfterWrite())) // ํ•ญ๋ชฉ ๋งŒ๋ฃŒ ์‹œ๊ฐ„
.maximumSize(cacheType.getMaximumSize()) // ์ตœ๋Œ€ ํฌ๊ธฐ
.build()
);
});

return cacheManager;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import lombok.RequiredArgsConstructor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.HttpMethod;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.method.configuration.EnableMethodSecurity;
Expand Down Expand Up @@ -49,8 +50,9 @@ public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
// ๊ฒฝ๋กœ๋ณ„ ์ธ๊ฐ€ ์ž‘์—…
http
.authorizeHttpRequests((auth) -> auth
.requestMatchers("/api/posts/type", "/api/posts/type/**", "/api/posts/search").permitAll()
.requestMatchers(SecurityPath.ADMIN_ENDPOINTS).hasRole("ADMIN")
.requestMatchers(SecurityPath.USER_ENDPOINTS).hasRole("USER")
.requestMatchers(SecurityPath.USER_ENDPOINTS).hasAnyRole("USER", "ADMIN")
.requestMatchers(SecurityPath.PUBLIC_ENDPOINTS).permitAll()
.anyRequest().permitAll()
);
Expand All @@ -72,8 +74,8 @@ public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
public CorsConfigurationSource corsConfigurationSource() {
org.springframework.web.cors.CorsConfiguration configuration = new org.springframework.web.cors.CorsConfiguration();
configuration.addAllowedOrigin("http://localhost:3000"); // ๊ฐœ๋ฐœ ํ™˜๊ฒฝ
configuration.addAllowedOrigin("https://hyetaek-on.site"); // ํ˜œํƒ์˜จ ๋„๋ฉ”์ธ
configuration.addAllowedOrigin("https://www.hyetaek-on.site");
configuration.addAllowedOrigin("https://hyetaek-on.co.kr"); // ํ˜œํƒ์˜จ ๋„๋ฉ”์ธ
configuration.addAllowedOrigin("https://www.hyetaek-on.co.kr");
configuration.addAllowedMethod("*"); // ๋ชจ๋“  HTTP ๋ฉ”์„œ๋“œ ํ—ˆ์šฉ
configuration.addAllowedHeader("*"); // ๋ชจ๋“  ํ—ค๋” ํ—ˆ์šฉ
configuration.setAllowedHeaders(java.util.List.of("Authorization", "Content-Type"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,26 +11,33 @@ public class SecurityPath {
"/api/users/check-duplicate",
"/",
"/api/services",
"/api/services/popular",
"/api/services/category/*",
"/api/services/detail/*",
"/api/public-data/serviceList/test"
"/api/public-data/serviceList/test",
"/api/mongo/services/search",
"/api/mongo/services/search/autocomplete"
};


// hasRole("USER")
public static final String[] USER_ENDPOINTS = {
"/api/users/me/**",
"/api/users/me",
"/api/users/me/**",
"/api/logout",
"/api/services/popular",
"/api/services/*/bookmark",
"/api/interests",
"/api/interests/me"
"/api/interests/me",
"/api/posts",
"/api/posts/*",
"/api/search/history",
"/api/search/history/*",
"/api/mongo/services/matched",
"/api/users/reports"
};

// hasRole("ADMIN")
public static final String[] ADMIN_ENDPOINTS = {
"/api/admin/users/**",
"/api/admin/**",
"/api/public-data/serviceDetailList",
"/api/public-data/supportConditionsList",
"/api/public-data/serviceList"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package com.hyetaekon.hyetaekon.common.config.redis;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.repository.configuration.EnableRedisRepositories;
import org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer;
import org.springframework.data.redis.serializer.StringRedisSerializer;

@Configuration
@EnableRedisRepositories(basePackages = "com.hyetaekon.hyetaekon.publicservice.repository.redis")
public class SearchHistoryConfig {

@Bean
public RedisTemplate<String, Object> searchHistoryRedisTemplate(RedisTemplate<String, Object> redisTemplate) {
// ํ‚ค์™€ ๊ฐ’์˜ ์ง๋ ฌํ™” ๋ฐฉ์‹ ์ง€์ •
redisTemplate.setKeySerializer(new StringRedisSerializer());
redisTemplate.setValueSerializer(new Jackson2JsonRedisSerializer<>(Object.class));
redisTemplate.setHashKeySerializer(new StringRedisSerializer());
redisTemplate.setHashValueSerializer(new Jackson2JsonRedisSerializer<>(Object.class));

return redisTemplate;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
import com.hyetaekon.hyetaekon.publicservice.entity.ServiceCategory;
import jakarta.persistence.AttributeConverter;
import jakarta.persistence.Converter;
import lombok.extern.slf4j.Slf4j;

@Slf4j
@Converter(autoApply = true) // autoApply๋ฅผ true๋กœ ์„ค์ •ํ•˜๋ฉด @Convert์—†์ด ํ•ด๋‹น ํƒ€์ž…์— ๋Œ€ํ•ด ์ž๋™์œผ๋กœ ๋ณ€ํ™˜
public class ServiceCategoryConverter implements AttributeConverter<ServiceCategory, String> {

Expand All @@ -17,12 +19,20 @@ public String convertToDatabaseColumn(ServiceCategory serviceCategory) {

@Override
public ServiceCategory convertToEntityAttribute(String dbData) {
if (dbData == null) {
return null;
}

for (ServiceCategory serviceCategory : ServiceCategory.values()) {
if (serviceCategory.getType().equals(dbData)) {
return serviceCategory;
}
}
throw new GlobalException(ErrorCode.SERVICE_CATEGORY_NOT_FOUND);
// throw new GlobalException(ErrorCode.SERVICE_CATEGORY_NOT_FOUND);

// ์ผ์น˜ํ•˜๋Š” ์นดํ…Œ๊ณ ๋ฆฌ๊ฐ€ ์—†์„ ๊ฒฝ์šฐ ๋กœ๊ทธ๋ฅผ ๋‚จ๊ธฐ๊ณ  ๊ธฐ๋ณธ๊ฐ’ ๋ฐ˜ํ™˜
log.warn("Unknown service category found: '{}'. Using 'OTHER' category instead.", dbData);
return ServiceCategory.OTHER;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,12 @@ public enum ErrorCode {
INVALID_CREDENTIALS(HttpStatus.UNAUTHORIZED, "AUTH-006", "์œ ํšจํ•˜์ง€ ์•Š์€ ์‚ฌ์šฉ์ž ์ด๋ฆ„ ๋˜๋Š” ๋น„๋ฐ€๋ฒˆํ˜ธ์ž…๋‹ˆ๋‹ค."),
INVALID_SECRET_KEY(HttpStatus.UNAUTHORIZED, "AUTH-007", "์œ ํšจํ•˜์ง€ ์•Š์€ ๋น„๋ฐ€ ํ‚ค์ž…๋‹ˆ๋‹ค."),
DELETE_USER_DENIED(HttpStatus.FORBIDDEN, "AUTH-008", "ํšŒ์› ํƒˆํ‡ด๊ฐ€ ๊ฑฐ๋ถ€๋˜์—ˆ์Šต๋‹ˆ๋‹ค."),
ROLE_NOT_FOUND(HttpStatus.FORBIDDEN, "AUTH-009", "๊ถŒํ•œ ์ •๋ณด๊ฐ€ ์—†์Šต๋‹ˆ๋‹ค."),
BLACKLIST_TOKEN(HttpStatus.UNAUTHORIZED, "AUTH-010", "์‚ฌ์šฉํ•  ์ˆ˜ ์—†๋Š” ์•ก์„ธ์Šค ํ† ํฐ์ž…๋‹ˆ๋‹ค."),
CANNOT_REPORT_SELF(HttpStatus.BAD_REQUEST, "AUTH-009","์ž๊ธฐ ์ž์‹ ์„ ์‹ ๊ณ ํ•  ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค."),
ROLE_NOT_FOUND(HttpStatus.FORBIDDEN, "AUTH-010", "๊ถŒํ•œ ์ •๋ณด๊ฐ€ ์—†์Šต๋‹ˆ๋‹ค."),
BLACKLIST_TOKEN(HttpStatus.UNAUTHORIZED, "AUTH-011", "์‚ฌ์šฉํ•  ์ˆ˜ ์—†๋Š” ์•ก์„ธ์Šค ํ† ํฐ์ž…๋‹ˆ๋‹ค."),
REPORT_NOT_FOUND(HttpStatus.NOT_FOUND, "AUTH-012", "ํ•ด๋‹น ์‹ ๊ณ  ๋‚ด์—ญ์„ ์ฐพ์„ ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค."),
REPORT_ALREADY_PROCESSED(HttpStatus.BAD_REQUEST, "AUTH-013", "์ด๋ฏธ ์ฒ˜๋ฆฌ๋œ ์‹ ๊ณ ์ž…๋‹ˆ๋‹ค."),
INVALID_REPORT_REQUEST(HttpStatus.BAD_REQUEST, "AUTH-014","์ž˜๋ชป๋œ ์‹ ๊ณ  ์š”์ฒญ์ž…๋‹ˆ๋‹ค."),

// ๊ณ„์ • ๊ด€๋ จ
DUPLICATED_REAL_ID(HttpStatus.CONFLICT, "ACCOUNT-001", "์ด๋ฏธ ์กด์žฌํ•˜๋Š” ์•„์ด๋””์ž…๋‹ˆ๋‹ค."),
Expand All @@ -40,15 +44,19 @@ public enum ErrorCode {
// ์ข‹์•„์š”
RECOMMEND_ALREADY_EXISTS(HttpStatus.CONFLICT, "RECOMMEND-001", "์ด๋ฏธ ์ข‹์•„์š”๋ฅผ ๋ˆ„๋ฅธ ๊ฒŒ์‹œ๊ธ€์ž…๋‹ˆ๋‹ค."),
RECOMMEND_NOT_FOUND(HttpStatus.NOT_FOUND, "RECOMMEND-002", "์ข‹์•„์š” ์ •๋ณด๋ฅผ ์ฐพ์„ ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค."),
POST_NOT_FOUND(HttpStatus.NOT_FOUND, "POST-001", "ํ•ด๋‹น ๊ฒŒ์‹œ๊ธ€์„ ์ฐพ์„ ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค."),
RECOMMEND_USER_NOT_FOUND(HttpStatus.NOT_FOUND, "RECOMMEND-003", "์ถ”์ฒœํ•œ ์œ ์ €๋ฅผ ์ฐพ์„ ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค."),

// ๊ฒŒ์‹œ๊ธ€
POST_NOT_FOUND_BY_ID(HttpStatus.NOT_FOUND,"POST-001", "ํ•ด๋‹น ์•„์ด๋””์˜ ๊ฒŒ์‹œ๊ธ€์„ ์ฐพ์„ ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค"),

// ๊ด€์‹ฌ์‚ฌ ์„ ํƒ ์ œํ•œ
INTEREST_LIMIT_EXCEEDED(HttpStatus.BAD_REQUEST, "INTEREST-001", "๊ด€์‹ฌ์‚ฌ๋Š” ์ตœ๋Œ€ 6๊ฐœ๊นŒ์ง€๋งŒ ๋“ฑ๋ก ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค."),
INVALID_INTEREST(HttpStatus.BAD_REQUEST, "INTEREST-002", "์œ ํšจํ•˜์ง€ ์•Š์€ ๊ด€์‹ฌ์‚ฌ์ž…๋‹ˆ๋‹ค."),

// ๊ณต๊ณต์„œ๋น„์Šค
// ์œ ํšจ JACODE ํ™•์ธ
INVALID_ENUM_CODE(HttpStatus.BAD_REQUEST, "ENUM-001", "์œ ํšจํ•˜์ง€ ์•Š์€ ์ฝ”๋“œ ๊ฐ’์ž…๋‹ˆ๋‹ค."),
INVALID_ENUM_CODE(HttpStatus.BAD_REQUEST, "SERVICE-001", "์œ ํšจํ•˜์ง€ ์•Š์€ ์ฝ”๋“œ ๊ฐ’์ž…๋‹ˆ๋‹ค."),
INCOMPLETE_SERVICE_DETAIL(HttpStatus.BAD_REQUEST, "SERVICE-002","์„œ๋น„์Šค ์ƒ์„ธ ์ •๋ณด๊ฐ€ ๋ถˆ์™„์ „ํ•ฉ๋‹ˆ๋‹ค."),

SERVICE_CATEGORY_NOT_FOUND(HttpStatus.NOT_FOUND, "SERVICE-001", "ํ•ด๋‹น ์„œ๋น„์Šค ๋ถ„์•ผ๋ฅผ ์ฐพ์„ ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค."),
SERVICE_NOT_FOUND_BY_ID(HttpStatus.NOT_FOUND,"SERVICE-002", "ํ•ด๋‹น ์•„์ด๋””์˜ ์„œ๋น„์Šค๋ฅผ ์ฐพ์„ ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,27 +41,27 @@ public ResponseEntity<String> createAndStoreServiceList() {
/**
* ๊ณต๊ณต์„œ๋น„์Šค ์ƒ์„ธ์ •๋ณด ์ „์ฒด ๋™๊ธฐํ™” (ํŽ˜์ด์ง• ์ฒ˜๋ฆฌ)
*/
@PostMapping("/serviceDetailList")
@PostMapping("/serviceDetail")
public ResponseEntity<String> createAndStoreServiceDetailList() {
validator.validateAndHandleException(() -> {
// ์ „์ฒด ์ƒ์„ธ์ •๋ณด ๋™๊ธฐํ™” (ํŽ˜์ด์ง• ์ฒ˜๋ฆฌ)
publicServiceDataService.syncPublicServiceDetailData(SERVICE_DETAIL_LIST);
publicServiceDataService.syncPublicServiceDetailData(SERVICE_DETAIL);
return null;
}, SERVICE_DETAIL_LIST);
}, SERVICE_DETAIL);

return ResponseEntity.status(HttpStatus.OK).body("๊ณต๊ณต์„œ๋น„์Šค ์ƒ์„ธ์ •๋ณด ๋ฐ์ดํ„ฐ ๋™๊ธฐํ™” ์™„๋ฃŒ");
}

/**
* ๊ณต๊ณต์„œ๋น„์Šค ์ง€์›์กฐ๊ฑด ์ „์ฒด ๋™๊ธฐํ™” (ํŽ˜์ด์ง• ์ฒ˜๋ฆฌ)
*/
@PostMapping("/supportConditionsList")
@PostMapping("/supportConditions")
public ResponseEntity<String> createAndStoreSupportConditionsList() {
validator.validateAndHandleException(() -> {
// ์ „์ฒด ์ง€์›์กฐ๊ฑด ๋™๊ธฐํ™” (ํŽ˜์ด์ง• ์ฒ˜๋ฆฌ)
publicServiceDataService.syncPublicServiceConditionsData(SERVICE_CONDITIONS_LIST);
publicServiceDataService.syncPublicServiceConditionsData(SERVICE_CONDITIONS);
return null;
}, SERVICE_CONDITIONS_LIST);
}, SERVICE_CONDITIONS);

return ResponseEntity.status(HttpStatus.OK).body("๊ณต๊ณต์„œ๋น„์Šค ์ง€์›์กฐ๊ฑด ๋ฐ์ดํ„ฐ ๋™๊ธฐํ™” ์™„๋ฃŒ");
}
Expand All @@ -85,4 +85,18 @@ public ResponseEntity<List<PublicServiceDataDto.Data>> getServiceListByPage(

return ResponseEntity.status(HttpStatus.OK).body(result);
}

// ํ†ตํ•ฉ ๋™๊ธฐํ™”
@PostMapping("/sync-all")
public ResponseEntity<String> syncAllPublicServiceData() {
// ์ˆœ์ฐจ์ ์œผ๋กœ ์‹คํ–‰
createAndStoreServiceList();
createAndStoreServiceDetailList();
createAndStoreSupportConditionsList();

// ๋ฏธ์‚ฌ์šฉ ๋ฐ์ดํ„ฐ ์ •๋ฆฌ
publicServiceDataService.cleanupObsoleteServices();

return ResponseEntity.status(HttpStatus.OK).body("๋ชจ๋“  ๊ณต๊ณต์„œ๋น„์Šค ๋ฐ์ดํ„ฐ ๋™๊ธฐํ™” ์™„๋ฃŒ");
}
}
Loading