diff --git a/.github/workflows/showpot-dev-cd.yml b/.github/workflows/showpot-dev-cd.yml index e4e68e80..a844e8a0 100644 --- a/.github/workflows/showpot-dev-cd.yml +++ b/.github/workflows/showpot-dev-cd.yml @@ -44,6 +44,7 @@ jobs: spotify.client-id: ${{ secrets.SPOTIFY_CLIENT_ID }} spotify.client-secret: ${{ secrets.SPOTIFY_CLIENT_SECRET }} alarm.api-url: ${{ secrets.ALARM_SERVER_API_URL }} + file.root-url: ${{ secrets.FILE_ROOT_API_URL_DEV }} - name: Build with Gradle Wrapper run: ./gradlew clean build -Dspring.profiles.active=dev diff --git a/.github/workflows/showpot-prod-cd.yml b/.github/workflows/showpot-prod-cd.yml index 8322eb38..12bf0c62 100644 --- a/.github/workflows/showpot-prod-cd.yml +++ b/.github/workflows/showpot-prod-cd.yml @@ -48,6 +48,7 @@ jobs: spotify.client-id: ${{ secrets.SPOTIFY_CLIENT_ID }} spotify.client-secret: ${{ secrets.SPOTIFY_CLIENT_SECRET }} alarm.api-url: ${{ secrets.ALARM_SERVER_API_URL_PROD }} + file.root-url: ${{ secrets.FILE_ROOT_API_URL_PROD }} - name: Build with Gradle Wrapper run: ./gradlew clean build -Dspring.profiles.active=prod diff --git a/app/api/common-api/src/main/java/org/example/config/SecurityConfig.java b/app/api/common-api/src/main/java/org/example/config/SecurityConfig.java index eefe4fa2..fd5cc763 100644 --- a/app/api/common-api/src/main/java/org/example/config/SecurityConfig.java +++ b/app/api/common-api/src/main/java/org/example/config/SecurityConfig.java @@ -115,7 +115,8 @@ private RequestMatcher getMatcherForAnyone() { antMatcher(HttpMethod.GET, "/api/v1/shows/search/**"), antMatcher(HttpMethod.GET, "/api/v1/artists/filter"), antMatcher(HttpMethod.GET, "/api/v1/artists/filter-total-count"), - antMatcher(HttpMethod.GET, "/api/v1/artists/unsubscriptions") + antMatcher(HttpMethod.GET, "/api/v1/artists/unsubscriptions"), + antMatcher(HttpMethod.GET, "/api/v1/files/profile-image/{id}") ); } diff --git a/app/api/user-api/src/main/java/org/example/config/UserApiConfig.java b/app/api/user-api/src/main/java/org/example/config/UserApiConfig.java index 244e3482..101411a2 100644 --- a/app/api/user-api/src/main/java/org/example/config/UserApiConfig.java +++ b/app/api/user-api/src/main/java/org/example/config/UserApiConfig.java @@ -1,14 +1,17 @@ package org.example.config; +import org.example.file.property.FileRootUrlProperty; import org.example.property.AlarmServerProperty; import org.springframework.boot.context.properties.EnableConfigurationProperties; +import org.springframework.cache.annotation.EnableCaching; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Import; @Configuration @Import(UserDomainConfig.class) -@EnableConfigurationProperties(AlarmServerProperty.class) +@EnableConfigurationProperties({AlarmServerProperty.class, FileRootUrlProperty.class}) +@EnableCaching @ComponentScan(basePackages = "org.example") public class UserApiConfig { diff --git a/app/api/user-api/src/main/java/org/example/file/component/FileComponent.java b/app/api/user-api/src/main/java/org/example/file/component/FileComponent.java new file mode 100644 index 00000000..715602cd --- /dev/null +++ b/app/api/user-api/src/main/java/org/example/file/component/FileComponent.java @@ -0,0 +1,11 @@ +package org.example.file.component; + +import java.util.Optional; +import org.springframework.core.io.Resource; + +public interface FileComponent { + + Optional getImageUrl(int id); + + Resource getProfileResource(int id); +} diff --git a/app/api/user-api/src/main/java/org/example/file/component/FileLocalComponent.java b/app/api/user-api/src/main/java/org/example/file/component/FileLocalComponent.java new file mode 100644 index 00000000..298305bb --- /dev/null +++ b/app/api/user-api/src/main/java/org/example/file/component/FileLocalComponent.java @@ -0,0 +1,57 @@ +package org.example.file.component; + +import java.util.Objects; +import java.util.Optional; +import lombok.RequiredArgsConstructor; +import org.example.file.property.FileRootUrlProperty; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.core.io.Resource; +import org.springframework.core.io.UrlResource; +import org.springframework.stereotype.Service; + +@Service +@RequiredArgsConstructor +public class FileLocalComponent implements FileComponent { + + private final FileRootUrlProperty fileRootUrlProperty; + private static final String IMAGE_URL_TEMPLATE = "/profile-image/"; + private static final String IMAGE_RESOURCE_LOCATION = "static/image/profileImage"; + private static final String IMAGE_EXTENSION = ".png"; + + /** + * 이미지 ID를 받아서 URL을 반환하는 메서드 + * + * @param id 이미지 ID (1 ~ 16) + * @return 이미지 URL + */ + @Override + public Optional getImageUrl(int id) { + // ID가 범위를 벗어난 경우 빈 값을 반환 + if (id < 1 || id > 16) { + return Optional.empty(); + } + + return Optional.of(fileRootUrlProperty.rootUrl() + IMAGE_URL_TEMPLATE + id); + } + + @Override + @Cacheable(value = "profileImages", key = "#id") + public Resource getProfileResource(int id) { + Resource resource; + try { + String resourcePath = IMAGE_RESOURCE_LOCATION + id + IMAGE_EXTENSION; + resource = new UrlResource( + Objects.requireNonNull(getClass().getClassLoader().getResource(resourcePath)) + .toURI()); + if (!resource.exists() && !resource.isReadable()) { + throw new IllegalArgumentException(); + } + } catch (Exception e) { + throw new IllegalArgumentException(e); + } + + return resource; + } + + +} diff --git a/app/api/user-api/src/main/java/org/example/file/controller/FileController.java b/app/api/user-api/src/main/java/org/example/file/controller/FileController.java new file mode 100644 index 00000000..e6ece123 --- /dev/null +++ b/app/api/user-api/src/main/java/org/example/file/controller/FileController.java @@ -0,0 +1,34 @@ +package org.example.file.controller; + +import lombok.RequiredArgsConstructor; +import org.example.file.component.FileLocalComponent; +import org.springframework.core.io.Resource; +import org.springframework.http.ContentDisposition; +import org.springframework.http.HttpHeaders; +import org.springframework.http.MediaType; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +@RestController +@RequiredArgsConstructor +@RequestMapping("/api/v1/files") +public class FileController { + + private final FileLocalComponent fileLocalComponent; + + @GetMapping("/profile-image/{id}") + public ResponseEntity getUserProfileImage(@PathVariable int id) { + Resource resource = fileLocalComponent.getProfileResource(id); + + return ResponseEntity.ok() + .contentType(MediaType.IMAGE_PNG) + .header( + HttpHeaders.CONTENT_DISPOSITION, + ContentDisposition.inline().filename(resource.getFilename()).toString()) + .body(resource); + } + +} \ No newline at end of file diff --git a/app/api/user-api/src/main/java/org/example/file/property/FileRootUrlProperty.java b/app/api/user-api/src/main/java/org/example/file/property/FileRootUrlProperty.java new file mode 100644 index 00000000..f04cd691 --- /dev/null +++ b/app/api/user-api/src/main/java/org/example/file/property/FileRootUrlProperty.java @@ -0,0 +1,10 @@ +package org.example.file.property; + +import org.springframework.boot.context.properties.ConfigurationProperties; + +@ConfigurationProperties(prefix = "file") +public record FileRootUrlProperty( + String rootUrl +) { + +} diff --git a/app/api/user-api/src/main/java/org/example/client/AlarmClientManager.java b/app/api/user-api/src/main/java/org/example/user/client/AlarmClientManager.java similarity index 93% rename from app/api/user-api/src/main/java/org/example/client/AlarmClientManager.java rename to app/api/user-api/src/main/java/org/example/user/client/AlarmClientManager.java index 7dcc4310..14ebfb48 100644 --- a/app/api/user-api/src/main/java/org/example/client/AlarmClientManager.java +++ b/app/api/user-api/src/main/java/org/example/user/client/AlarmClientManager.java @@ -1,4 +1,4 @@ -package org.example.client; +package org.example.user.client; import java.time.LocalDateTime; import java.util.UUID; @@ -6,8 +6,8 @@ import lombok.extern.slf4j.Slf4j; import org.example.metric.InternalApiMonitored; import org.example.property.AlarmServerProperty; -import org.example.service.dto.response.NotificationExistServiceResponse; -import org.example.service.dto.response.NotificationPaginationResponse; +import org.example.user.service.dto.response.NotificationExistServiceResponse; +import org.example.user.service.dto.response.NotificationPaginationResponse; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Component; diff --git a/app/api/user-api/src/main/java/org/example/controller/AdminController.java b/app/api/user-api/src/main/java/org/example/user/controller/AdminController.java similarity index 87% rename from app/api/user-api/src/main/java/org/example/controller/AdminController.java rename to app/api/user-api/src/main/java/org/example/user/controller/AdminController.java index 4e8f6c2b..5278a863 100644 --- a/app/api/user-api/src/main/java/org/example/controller/AdminController.java +++ b/app/api/user-api/src/main/java/org/example/user/controller/AdminController.java @@ -1,10 +1,10 @@ -package org.example.controller; +package org.example.user.controller; import jakarta.validation.Valid; import lombok.RequiredArgsConstructor; -import org.example.controller.dto.request.AdminLoginApiRequest; -import org.example.service.AdminService; +import org.example.user.controller.dto.request.AdminLoginApiRequest; +import org.example.user.service.AdminService; import org.springframework.http.HttpStatus; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.GetMapping; diff --git a/app/api/user-api/src/main/java/org/example/controller/UserAlarmController.java b/app/api/user-api/src/main/java/org/example/user/controller/UserAlarmController.java similarity index 91% rename from app/api/user-api/src/main/java/org/example/controller/UserAlarmController.java rename to app/api/user-api/src/main/java/org/example/user/controller/UserAlarmController.java index 7905fdfc..5f438b47 100644 --- a/app/api/user-api/src/main/java/org/example/controller/UserAlarmController.java +++ b/app/api/user-api/src/main/java/org/example/user/controller/UserAlarmController.java @@ -1,4 +1,4 @@ -package org.example.controller; +package org.example.user.controller; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; @@ -6,12 +6,12 @@ import java.time.LocalDateTime; import java.util.UUID; import lombok.RequiredArgsConstructor; -import org.example.controller.dto.param.SimpleNotificationApiParam; -import org.example.controller.dto.response.NotificationExistApiResponse; import org.example.dto.response.PaginationApiResponse; import org.example.dto.response.SuccessResponse; import org.example.security.dto.AuthenticatedInfo; -import org.example.service.UserAlarmService; +import org.example.user.controller.dto.param.SimpleNotificationApiParam; +import org.example.user.controller.dto.response.NotificationExistApiResponse; +import org.example.user.service.UserAlarmService; import org.springframework.http.HttpStatus; import org.springframework.security.core.annotation.AuthenticationPrincipal; import org.springframework.web.bind.annotation.GetMapping; diff --git a/app/api/user-api/src/main/java/org/example/controller/UserController.java b/app/api/user-api/src/main/java/org/example/user/controller/UserController.java similarity index 81% rename from app/api/user-api/src/main/java/org/example/controller/UserController.java rename to app/api/user-api/src/main/java/org/example/user/controller/UserController.java index f28b9235..82fc8ea7 100644 --- a/app/api/user-api/src/main/java/org/example/controller/UserController.java +++ b/app/api/user-api/src/main/java/org/example/user/controller/UserController.java @@ -1,4 +1,4 @@ -package org.example.controller; +package org.example.user.controller; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; @@ -7,15 +7,15 @@ import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.validation.Valid; import lombok.RequiredArgsConstructor; -import org.example.controller.dto.request.LoginApiRequest; -import org.example.controller.dto.response.LoginApiResponse; -import org.example.controller.dto.response.ReissueApiResponse; -import org.example.controller.dto.response.UserProfileApiResponse; import org.example.dto.response.SuccessResponse; import org.example.dto.response.SuccessResponse.Empty; import org.example.security.dto.AuthenticatedInfo; import org.example.security.dto.TokenParam; -import org.example.service.UserService; +import org.example.user.controller.dto.request.LoginApiRequest; +import org.example.user.controller.dto.response.LoginApiResponse; +import org.example.user.controller.dto.response.ReissueApiResponse; +import org.example.user.controller.dto.response.UserProfileApiResponse; +import org.example.user.service.UserService; import org.springframework.http.HttpStatus; import org.springframework.security.core.annotation.AuthenticationPrincipal; import org.springframework.web.bind.annotation.GetMapping; @@ -40,9 +40,9 @@ public SuccessResponse signUp(@Valid @RequestBody LoginApiRequ TokenParam token = userService.login(request.toServiceType()); return SuccessResponse.ok(LoginApiResponse.builder() - .accessToken(token.accessToken()) - .refreshToken(token.refreshToken()) - .build()); + .accessToken(token.accessToken()) + .refreshToken(token.refreshToken()) + .build()); } @ResponseStatus(HttpStatus.OK) @@ -81,11 +81,11 @@ public SuccessResponse withdraw( summary = "토큰 재발급", parameters = { @Parameter( - in = ParameterIn.HEADER, - name = "Refresh", - description = "리프레시 토큰", + in = ParameterIn.HEADER, + name = "Refresh", + description = "리프레시 토큰", required = true) - } + } ) public SuccessResponse reissue( @AuthenticationPrincipal AuthenticatedInfo info @@ -93,9 +93,9 @@ public SuccessResponse reissue( TokenParam reissueToken = userService.reissue(info.userId(), info.refreshToken()); return SuccessResponse.ok(ReissueApiResponse.builder() - .accessToken(reissueToken.accessToken()) - .refreshToken(reissueToken.refreshToken()) - .build()); + .accessToken(reissueToken.accessToken()) + .refreshToken(reissueToken.refreshToken()) + .build()); } @ResponseStatus(HttpStatus.OK) diff --git a/app/api/user-api/src/main/java/org/example/controller/dto/param/SimpleNotificationApiParam.java b/app/api/user-api/src/main/java/org/example/user/controller/dto/param/SimpleNotificationApiParam.java similarity index 85% rename from app/api/user-api/src/main/java/org/example/controller/dto/param/SimpleNotificationApiParam.java rename to app/api/user-api/src/main/java/org/example/user/controller/dto/param/SimpleNotificationApiParam.java index 129ca5e8..1977da18 100644 --- a/app/api/user-api/src/main/java/org/example/controller/dto/param/SimpleNotificationApiParam.java +++ b/app/api/user-api/src/main/java/org/example/user/controller/dto/param/SimpleNotificationApiParam.java @@ -1,9 +1,9 @@ -package org.example.controller.dto.param; +package org.example.user.controller.dto.param; import io.swagger.v3.oas.annotations.media.Schema; import java.util.UUID; import lombok.Builder; -import org.example.service.dto.response.NotificationServiceResponse.NotificationInfoWithImageResponse; +import org.example.user.service.dto.response.NotificationServiceResponse.NotificationInfoWithImageResponse; import org.example.util.DateTimeUtil; @Builder diff --git a/app/api/user-api/src/main/java/org/example/controller/dto/request/AdminLoginApiRequest.java b/app/api/user-api/src/main/java/org/example/user/controller/dto/request/AdminLoginApiRequest.java similarity index 84% rename from app/api/user-api/src/main/java/org/example/controller/dto/request/AdminLoginApiRequest.java rename to app/api/user-api/src/main/java/org/example/user/controller/dto/request/AdminLoginApiRequest.java index bd9b1693..1af9b131 100644 --- a/app/api/user-api/src/main/java/org/example/controller/dto/request/AdminLoginApiRequest.java +++ b/app/api/user-api/src/main/java/org/example/user/controller/dto/request/AdminLoginApiRequest.java @@ -1,9 +1,9 @@ -package org.example.controller.dto.request; +package org.example.user.controller.dto.request; import jakarta.validation.constraints.Email; import jakarta.validation.constraints.NotNull; import jakarta.validation.constraints.Size; -import org.example.service.dto.request.AdminLoginServiceRequest; +import org.example.user.service.dto.request.AdminLoginServiceRequest; public record AdminLoginApiRequest( diff --git a/app/api/user-api/src/main/java/org/example/controller/dto/request/LoginApiRequest.java b/app/api/user-api/src/main/java/org/example/user/controller/dto/request/LoginApiRequest.java similarity index 83% rename from app/api/user-api/src/main/java/org/example/controller/dto/request/LoginApiRequest.java rename to app/api/user-api/src/main/java/org/example/user/controller/dto/request/LoginApiRequest.java index 817aaf70..5d40ba21 100644 --- a/app/api/user-api/src/main/java/org/example/controller/dto/request/LoginApiRequest.java +++ b/app/api/user-api/src/main/java/org/example/user/controller/dto/request/LoginApiRequest.java @@ -1,9 +1,9 @@ -package org.example.controller.dto.request; +package org.example.user.controller.dto.request; import io.swagger.v3.oas.annotations.media.Schema; import jakarta.validation.constraints.NotNull; -import org.example.service.dto.request.LoginServiceRequest; -import org.example.vo.SocialLoginApiType; +import org.example.user.service.dto.request.LoginServiceRequest; +import org.example.user.vo.SocialLoginApiType; public record LoginApiRequest( diff --git a/app/api/user-api/src/main/java/org/example/controller/dto/response/HasUnreadNotificationApiResponse.java b/app/api/user-api/src/main/java/org/example/user/controller/dto/response/HasUnreadNotificationApiResponse.java similarity index 82% rename from app/api/user-api/src/main/java/org/example/controller/dto/response/HasUnreadNotificationApiResponse.java rename to app/api/user-api/src/main/java/org/example/user/controller/dto/response/HasUnreadNotificationApiResponse.java index e3fb562d..cbafe00b 100644 --- a/app/api/user-api/src/main/java/org/example/controller/dto/response/HasUnreadNotificationApiResponse.java +++ b/app/api/user-api/src/main/java/org/example/user/controller/dto/response/HasUnreadNotificationApiResponse.java @@ -1,4 +1,4 @@ -package org.example.controller.dto.response; +package org.example.user.controller.dto.response; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Builder; diff --git a/app/api/user-api/src/main/java/org/example/controller/dto/response/LoginApiResponse.java b/app/api/user-api/src/main/java/org/example/user/controller/dto/response/LoginApiResponse.java similarity index 84% rename from app/api/user-api/src/main/java/org/example/controller/dto/response/LoginApiResponse.java rename to app/api/user-api/src/main/java/org/example/user/controller/dto/response/LoginApiResponse.java index 92b338a5..b388bd02 100644 --- a/app/api/user-api/src/main/java/org/example/controller/dto/response/LoginApiResponse.java +++ b/app/api/user-api/src/main/java/org/example/user/controller/dto/response/LoginApiResponse.java @@ -1,4 +1,4 @@ -package org.example.controller.dto.response; +package org.example.user.controller.dto.response; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Builder; diff --git a/app/api/user-api/src/main/java/org/example/controller/dto/response/NotificationExistApiResponse.java b/app/api/user-api/src/main/java/org/example/user/controller/dto/response/NotificationExistApiResponse.java similarity index 74% rename from app/api/user-api/src/main/java/org/example/controller/dto/response/NotificationExistApiResponse.java rename to app/api/user-api/src/main/java/org/example/user/controller/dto/response/NotificationExistApiResponse.java index 71427277..341cc8f4 100644 --- a/app/api/user-api/src/main/java/org/example/controller/dto/response/NotificationExistApiResponse.java +++ b/app/api/user-api/src/main/java/org/example/user/controller/dto/response/NotificationExistApiResponse.java @@ -1,8 +1,8 @@ -package org.example.controller.dto.response; +package org.example.user.controller.dto.response; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Builder; -import org.example.service.dto.response.NotificationExistServiceResponse; +import org.example.user.service.dto.response.NotificationExistServiceResponse; @Builder public record NotificationExistApiResponse( diff --git a/app/api/user-api/src/main/java/org/example/controller/dto/response/NotificationsApiResponse.java b/app/api/user-api/src/main/java/org/example/user/controller/dto/response/NotificationsApiResponse.java similarity index 55% rename from app/api/user-api/src/main/java/org/example/controller/dto/response/NotificationsApiResponse.java rename to app/api/user-api/src/main/java/org/example/user/controller/dto/response/NotificationsApiResponse.java index f49702e3..2d790668 100644 --- a/app/api/user-api/src/main/java/org/example/controller/dto/response/NotificationsApiResponse.java +++ b/app/api/user-api/src/main/java/org/example/user/controller/dto/response/NotificationsApiResponse.java @@ -1,8 +1,8 @@ -package org.example.controller.dto.response; +package org.example.user.controller.dto.response; import java.util.List; import lombok.Builder; -import org.example.controller.dto.param.SimpleNotificationApiParam; +import org.example.user.controller.dto.param.SimpleNotificationApiParam; @Builder public record NotificationsApiResponse( diff --git a/app/api/user-api/src/main/java/org/example/controller/dto/response/ReissueApiResponse.java b/app/api/user-api/src/main/java/org/example/user/controller/dto/response/ReissueApiResponse.java similarity index 85% rename from app/api/user-api/src/main/java/org/example/controller/dto/response/ReissueApiResponse.java rename to app/api/user-api/src/main/java/org/example/user/controller/dto/response/ReissueApiResponse.java index 830baa6b..3c8d3a99 100644 --- a/app/api/user-api/src/main/java/org/example/controller/dto/response/ReissueApiResponse.java +++ b/app/api/user-api/src/main/java/org/example/user/controller/dto/response/ReissueApiResponse.java @@ -1,4 +1,4 @@ -package org.example.controller.dto.response; +package org.example.user.controller.dto.response; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Builder; diff --git a/app/api/user-api/src/main/java/org/example/controller/dto/response/UserProfileApiResponse.java b/app/api/user-api/src/main/java/org/example/user/controller/dto/response/UserProfileApiResponse.java similarity index 75% rename from app/api/user-api/src/main/java/org/example/controller/dto/response/UserProfileApiResponse.java rename to app/api/user-api/src/main/java/org/example/user/controller/dto/response/UserProfileApiResponse.java index a7cfa4e0..21ce9714 100644 --- a/app/api/user-api/src/main/java/org/example/controller/dto/response/UserProfileApiResponse.java +++ b/app/api/user-api/src/main/java/org/example/user/controller/dto/response/UserProfileApiResponse.java @@ -1,9 +1,9 @@ -package org.example.controller.dto.response; +package org.example.user.controller.dto.response; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Builder; -import org.example.service.dto.response.UserProfileServiceResponse; -import org.example.vo.SocialLoginApiType; +import org.example.user.service.dto.response.UserProfileServiceResponse; +import org.example.user.vo.SocialLoginApiType; @Builder public record UserProfileApiResponse( diff --git a/app/api/user-api/src/main/java/org/example/pub/UserFcmMessage.java b/app/api/user-api/src/main/java/org/example/user/pub/UserFcmMessage.java similarity index 91% rename from app/api/user-api/src/main/java/org/example/pub/UserFcmMessage.java rename to app/api/user-api/src/main/java/org/example/user/pub/UserFcmMessage.java index 6363060f..8f68f11e 100644 --- a/app/api/user-api/src/main/java/org/example/pub/UserFcmMessage.java +++ b/app/api/user-api/src/main/java/org/example/user/pub/UserFcmMessage.java @@ -1,4 +1,4 @@ -package org.example.pub; +package org.example.user.pub; import java.util.UUID; diff --git a/app/api/user-api/src/main/java/org/example/pub/UserMessagePublisher.java b/app/api/user-api/src/main/java/org/example/user/pub/UserMessagePublisher.java similarity index 78% rename from app/api/user-api/src/main/java/org/example/pub/UserMessagePublisher.java rename to app/api/user-api/src/main/java/org/example/user/pub/UserMessagePublisher.java index 96622bc7..55439166 100644 --- a/app/api/user-api/src/main/java/org/example/pub/UserMessagePublisher.java +++ b/app/api/user-api/src/main/java/org/example/user/pub/UserMessagePublisher.java @@ -1,4 +1,4 @@ -package org.example.pub; +package org.example.user.pub; public interface UserMessagePublisher { diff --git a/app/api/user-api/src/main/java/org/example/service/AdminService.java b/app/api/user-api/src/main/java/org/example/user/service/AdminService.java similarity index 78% rename from app/api/user-api/src/main/java/org/example/service/AdminService.java rename to app/api/user-api/src/main/java/org/example/user/service/AdminService.java index 60f75d66..acedec47 100644 --- a/app/api/user-api/src/main/java/org/example/service/AdminService.java +++ b/app/api/user-api/src/main/java/org/example/user/service/AdminService.java @@ -1,8 +1,8 @@ -package org.example.service; +package org.example.user.service; import lombok.RequiredArgsConstructor; -import org.example.service.dto.request.AdminLoginServiceRequest; import org.example.usecase.AdminUseCase; +import org.example.user.service.dto.request.AdminLoginServiceRequest; import org.springframework.stereotype.Service; @Service diff --git a/app/api/user-api/src/main/java/org/example/service/UserAlarmService.java b/app/api/user-api/src/main/java/org/example/user/service/UserAlarmService.java similarity index 81% rename from app/api/user-api/src/main/java/org/example/service/UserAlarmService.java rename to app/api/user-api/src/main/java/org/example/user/service/UserAlarmService.java index 2b5738dc..56d27524 100644 --- a/app/api/user-api/src/main/java/org/example/service/UserAlarmService.java +++ b/app/api/user-api/src/main/java/org/example/user/service/UserAlarmService.java @@ -1,4 +1,4 @@ -package org.example.service; +package org.example.user.service; import java.time.LocalDateTime; import java.util.List; @@ -6,13 +6,13 @@ import java.util.UUID; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; -import org.example.client.AlarmClientManager; import org.example.entity.show.Show; import org.example.repository.show.ShowRepository; import org.example.repository.user.UserRepository; -import org.example.service.dto.response.NotificationExistServiceResponse; -import org.example.service.dto.response.NotificationPaginationResponse.NotificationInfoResponse; -import org.example.service.dto.response.NotificationServiceResponse; +import org.example.user.client.AlarmClientManager; +import org.example.user.service.dto.response.NotificationExistServiceResponse; +import org.example.user.service.dto.response.NotificationPaginationResponse.NotificationInfoResponse; +import org.example.user.service.dto.response.NotificationServiceResponse; import org.springframework.stereotype.Service; @Slf4j @@ -34,7 +34,8 @@ public NotificationServiceResponse findNotifications(UUID userId, UUID cursorId, LocalDateTime cursorValue, int size) { String userFcmToken = findUserFcmTokenById(userId); - var response = alarmClientManager.getNotificationPagination(userFcmToken, cursorId, cursorValue, size); + var response = alarmClientManager.getNotificationPagination(userFcmToken, cursorId, + cursorValue, size); if (response != null) { List showIdsByAlarm = response.data().stream() .map(NotificationInfoResponse::showId) diff --git a/app/api/user-api/src/main/java/org/example/service/UserService.java b/app/api/user-api/src/main/java/org/example/user/service/UserService.java similarity index 82% rename from app/api/user-api/src/main/java/org/example/service/UserService.java rename to app/api/user-api/src/main/java/org/example/user/service/UserService.java index 939de911..de9d1413 100644 --- a/app/api/user-api/src/main/java/org/example/service/UserService.java +++ b/app/api/user-api/src/main/java/org/example/user/service/UserService.java @@ -1,4 +1,4 @@ -package org.example.service; +package org.example.user.service; import java.util.Date; import java.util.NoSuchElementException; @@ -7,19 +7,21 @@ import org.example.dto.response.UserProfileDomainResponse; import org.example.entity.SocialLogin; import org.example.entity.User; -import org.example.pub.UserFcmMessage; -import org.example.pub.UserMessagePublisher; +import org.example.file.component.FileComponent; import org.example.security.dto.TokenParam; import org.example.security.dto.UserParam; import org.example.security.token.JWTGenerator; import org.example.security.token.TokenProcessor; -import org.example.service.dto.request.LoginServiceRequest; -import org.example.service.dto.response.UserProfileServiceResponse; import org.example.usecase.ArtistSubscriptionUseCase; import org.example.usecase.GenreSubscriptionUseCase; import org.example.usecase.InterestShowUseCase; import org.example.usecase.TicketingAlertUseCase; import org.example.usecase.UserUseCase; +import org.example.user.pub.UserFcmMessage; +import org.example.user.pub.UserMessagePublisher; +import org.example.user.service.dto.request.LoginServiceRequest; +import org.example.user.service.dto.response.UserProfileServiceResponse; +import org.example.util.RandomNumber; import org.springframework.stereotype.Service; import org.springframework.transaction.support.TransactionTemplate; @@ -36,6 +38,7 @@ public class UserService { private final TokenProcessor tokenProcessor; private final TransactionTemplate transactionTemplate; private final UserMessagePublisher userMessagePublisher; + private final FileComponent fileLocalComponent; public TokenParam login(LoginServiceRequest loginServiceRequest) { User user = getUser(loginServiceRequest); @@ -85,7 +88,10 @@ private User getUser(LoginServiceRequest request) { return user; } catch (NoSuchElementException e) { - return createUser(request); + int minProfileNumber = 1; + int maxProfileNumber = 16; + int profileNumber = RandomNumber.getRandomNumber(minProfileNumber, maxProfileNumber); + return createUser(request, profileNumber); } } @@ -96,8 +102,11 @@ private void updateUserFcmToken(User user, String previousFcmToken, String updat UserFcmMessage.of(user.getId(), previousFcmToken, updatedFcmToken)); } - private User createUser(LoginServiceRequest loginServiceRequest) { - User user = loginServiceRequest.createUser(); + private User createUser(LoginServiceRequest loginServiceRequest, int profileNumber) { + String profileUrl = fileLocalComponent.getImageUrl(profileNumber) + .orElseThrow(IllegalStateException::new); + + User user = loginServiceRequest.createUser(profileUrl); SocialLogin socialLogin = SocialLogin.builder() .socialLoginType(loginServiceRequest.socialLoginType().toDomainType()) .identifier(loginServiceRequest.identifier()) diff --git a/app/api/user-api/src/main/java/org/example/service/dto/request/AdminLoginServiceRequest.java b/app/api/user-api/src/main/java/org/example/user/service/dto/request/AdminLoginServiceRequest.java similarity index 85% rename from app/api/user-api/src/main/java/org/example/service/dto/request/AdminLoginServiceRequest.java rename to app/api/user-api/src/main/java/org/example/user/service/dto/request/AdminLoginServiceRequest.java index ba14799f..e410fc30 100644 --- a/app/api/user-api/src/main/java/org/example/service/dto/request/AdminLoginServiceRequest.java +++ b/app/api/user-api/src/main/java/org/example/user/service/dto/request/AdminLoginServiceRequest.java @@ -1,4 +1,4 @@ -package org.example.service.dto.request; +package org.example.user.service.dto.request; import org.example.entity.Admin; diff --git a/app/api/user-api/src/main/java/org/example/service/dto/request/LoginServiceRequest.java b/app/api/user-api/src/main/java/org/example/user/service/dto/request/LoginServiceRequest.java similarity index 79% rename from app/api/user-api/src/main/java/org/example/service/dto/request/LoginServiceRequest.java rename to app/api/user-api/src/main/java/org/example/user/service/dto/request/LoginServiceRequest.java index d3cfeeb0..cb22f845 100644 --- a/app/api/user-api/src/main/java/org/example/service/dto/request/LoginServiceRequest.java +++ b/app/api/user-api/src/main/java/org/example/user/service/dto/request/LoginServiceRequest.java @@ -1,10 +1,10 @@ -package org.example.service.dto.request; +package org.example.user.service.dto.request; import lombok.Builder; import org.example.dto.request.LoginDomainRequest; import org.example.entity.User; +import org.example.user.vo.SocialLoginApiType; import org.example.vo.RandomNickname; -import org.example.vo.SocialLoginApiType; @Builder public record LoginServiceRequest( @@ -13,10 +13,11 @@ public record LoginServiceRequest( String fcmToken ) { - public User createUser() { + public User createUser(String profileUrl) { return User.builder() .nickname(RandomNickname.makeRandomNickName()) .fcmToken(fcmToken) + .profileUrl(profileUrl) .build(); } diff --git a/app/api/user-api/src/main/java/org/example/service/dto/response/NotificationExistServiceResponse.java b/app/api/user-api/src/main/java/org/example/user/service/dto/response/NotificationExistServiceResponse.java similarity index 70% rename from app/api/user-api/src/main/java/org/example/service/dto/response/NotificationExistServiceResponse.java rename to app/api/user-api/src/main/java/org/example/user/service/dto/response/NotificationExistServiceResponse.java index aa4d2ad8..63f3611e 100644 --- a/app/api/user-api/src/main/java/org/example/service/dto/response/NotificationExistServiceResponse.java +++ b/app/api/user-api/src/main/java/org/example/user/service/dto/response/NotificationExistServiceResponse.java @@ -1,4 +1,4 @@ -package org.example.service.dto.response; +package org.example.user.service.dto.response; import lombok.Builder; diff --git a/app/api/user-api/src/main/java/org/example/service/dto/response/NotificationPaginationResponse.java b/app/api/user-api/src/main/java/org/example/user/service/dto/response/NotificationPaginationResponse.java similarity index 90% rename from app/api/user-api/src/main/java/org/example/service/dto/response/NotificationPaginationResponse.java rename to app/api/user-api/src/main/java/org/example/user/service/dto/response/NotificationPaginationResponse.java index 67d7f030..debe23f6 100644 --- a/app/api/user-api/src/main/java/org/example/service/dto/response/NotificationPaginationResponse.java +++ b/app/api/user-api/src/main/java/org/example/user/service/dto/response/NotificationPaginationResponse.java @@ -1,4 +1,4 @@ -package org.example.service.dto.response; +package org.example.user.service.dto.response; import java.time.LocalDateTime; import java.util.List; diff --git a/app/api/user-api/src/main/java/org/example/service/dto/response/NotificationServiceResponse.java b/app/api/user-api/src/main/java/org/example/user/service/dto/response/NotificationServiceResponse.java similarity index 97% rename from app/api/user-api/src/main/java/org/example/service/dto/response/NotificationServiceResponse.java rename to app/api/user-api/src/main/java/org/example/user/service/dto/response/NotificationServiceResponse.java index 9992335e..c90b74f7 100644 --- a/app/api/user-api/src/main/java/org/example/service/dto/response/NotificationServiceResponse.java +++ b/app/api/user-api/src/main/java/org/example/user/service/dto/response/NotificationServiceResponse.java @@ -1,4 +1,4 @@ -package org.example.service.dto.response; +package org.example.user.service.dto.response; import java.time.LocalDateTime; import java.util.List; diff --git a/app/api/user-api/src/main/java/org/example/service/dto/response/UserProfileServiceResponse.java b/app/api/user-api/src/main/java/org/example/user/service/dto/response/UserProfileServiceResponse.java similarity index 83% rename from app/api/user-api/src/main/java/org/example/service/dto/response/UserProfileServiceResponse.java rename to app/api/user-api/src/main/java/org/example/user/service/dto/response/UserProfileServiceResponse.java index a371c6fd..384fefed 100644 --- a/app/api/user-api/src/main/java/org/example/service/dto/response/UserProfileServiceResponse.java +++ b/app/api/user-api/src/main/java/org/example/user/service/dto/response/UserProfileServiceResponse.java @@ -1,8 +1,8 @@ -package org.example.service.dto.response; +package org.example.user.service.dto.response; import lombok.Builder; import org.example.dto.response.UserProfileDomainResponse; -import org.example.vo.SocialLoginApiType; +import org.example.user.vo.SocialLoginApiType; @Builder public record UserProfileServiceResponse( diff --git a/app/api/user-api/src/main/java/org/example/vo/SocialLoginApiType.java b/app/api/user-api/src/main/java/org/example/user/vo/SocialLoginApiType.java similarity index 89% rename from app/api/user-api/src/main/java/org/example/vo/SocialLoginApiType.java rename to app/api/user-api/src/main/java/org/example/user/vo/SocialLoginApiType.java index 428058cb..d8299a2c 100644 --- a/app/api/user-api/src/main/java/org/example/vo/SocialLoginApiType.java +++ b/app/api/user-api/src/main/java/org/example/user/vo/SocialLoginApiType.java @@ -1,4 +1,6 @@ -package org.example.vo; +package org.example.user.vo; + +import org.example.vo.SocialLoginType; public enum SocialLoginApiType { GOOGLE, KAKAO, APPLE; diff --git a/app/api/user-api/src/main/resources/static/image/profileImage1.png b/app/api/user-api/src/main/resources/static/image/profileImage1.png new file mode 100644 index 00000000..1d6cf656 Binary files /dev/null and b/app/api/user-api/src/main/resources/static/image/profileImage1.png differ diff --git a/app/api/user-api/src/main/resources/static/image/profileImage10.png b/app/api/user-api/src/main/resources/static/image/profileImage10.png new file mode 100644 index 00000000..4d8f2822 Binary files /dev/null and b/app/api/user-api/src/main/resources/static/image/profileImage10.png differ diff --git a/app/api/user-api/src/main/resources/static/image/profileImage11.png b/app/api/user-api/src/main/resources/static/image/profileImage11.png new file mode 100644 index 00000000..368468bb Binary files /dev/null and b/app/api/user-api/src/main/resources/static/image/profileImage11.png differ diff --git a/app/api/user-api/src/main/resources/static/image/profileImage12.png b/app/api/user-api/src/main/resources/static/image/profileImage12.png new file mode 100644 index 00000000..8873b46e Binary files /dev/null and b/app/api/user-api/src/main/resources/static/image/profileImage12.png differ diff --git a/app/api/user-api/src/main/resources/static/image/profileImage13.png b/app/api/user-api/src/main/resources/static/image/profileImage13.png new file mode 100644 index 00000000..ce8907a8 Binary files /dev/null and b/app/api/user-api/src/main/resources/static/image/profileImage13.png differ diff --git a/app/api/user-api/src/main/resources/static/image/profileImage14.png b/app/api/user-api/src/main/resources/static/image/profileImage14.png new file mode 100644 index 00000000..f834e2b1 Binary files /dev/null and b/app/api/user-api/src/main/resources/static/image/profileImage14.png differ diff --git a/app/api/user-api/src/main/resources/static/image/profileImage15.png b/app/api/user-api/src/main/resources/static/image/profileImage15.png new file mode 100644 index 00000000..7566e671 Binary files /dev/null and b/app/api/user-api/src/main/resources/static/image/profileImage15.png differ diff --git a/app/api/user-api/src/main/resources/static/image/profileImage16.png b/app/api/user-api/src/main/resources/static/image/profileImage16.png new file mode 100644 index 00000000..12777648 Binary files /dev/null and b/app/api/user-api/src/main/resources/static/image/profileImage16.png differ diff --git a/app/api/user-api/src/main/resources/static/image/profileImage2.png b/app/api/user-api/src/main/resources/static/image/profileImage2.png new file mode 100644 index 00000000..0d0e9a19 Binary files /dev/null and b/app/api/user-api/src/main/resources/static/image/profileImage2.png differ diff --git a/app/api/user-api/src/main/resources/static/image/profileImage3.png b/app/api/user-api/src/main/resources/static/image/profileImage3.png new file mode 100644 index 00000000..030f8d68 Binary files /dev/null and b/app/api/user-api/src/main/resources/static/image/profileImage3.png differ diff --git a/app/api/user-api/src/main/resources/static/image/profileImage4.png b/app/api/user-api/src/main/resources/static/image/profileImage4.png new file mode 100644 index 00000000..bf7b225e Binary files /dev/null and b/app/api/user-api/src/main/resources/static/image/profileImage4.png differ diff --git a/app/api/user-api/src/main/resources/static/image/profileImage5.png b/app/api/user-api/src/main/resources/static/image/profileImage5.png new file mode 100644 index 00000000..613a0e49 Binary files /dev/null and b/app/api/user-api/src/main/resources/static/image/profileImage5.png differ diff --git a/app/api/user-api/src/main/resources/static/image/profileImage6.png b/app/api/user-api/src/main/resources/static/image/profileImage6.png new file mode 100644 index 00000000..16d492bc Binary files /dev/null and b/app/api/user-api/src/main/resources/static/image/profileImage6.png differ diff --git a/app/api/user-api/src/main/resources/static/image/profileImage7.png b/app/api/user-api/src/main/resources/static/image/profileImage7.png new file mode 100644 index 00000000..0bc46434 Binary files /dev/null and b/app/api/user-api/src/main/resources/static/image/profileImage7.png differ diff --git a/app/api/user-api/src/main/resources/static/image/profileImage8.png b/app/api/user-api/src/main/resources/static/image/profileImage8.png new file mode 100644 index 00000000..b22ff98e Binary files /dev/null and b/app/api/user-api/src/main/resources/static/image/profileImage8.png differ diff --git a/app/api/user-api/src/main/resources/static/image/profileImage9.png b/app/api/user-api/src/main/resources/static/image/profileImage9.png new file mode 100644 index 00000000..78ea6100 Binary files /dev/null and b/app/api/user-api/src/main/resources/static/image/profileImage9.png differ diff --git a/app/api/user-api/src/test/java/org/example/fixture/dto/UserRequestDtoFixture.java b/app/api/user-api/src/test/java/org/example/fixture/dto/UserRequestDtoFixture.java index def788c4..7089cb02 100644 --- a/app/api/user-api/src/test/java/org/example/fixture/dto/UserRequestDtoFixture.java +++ b/app/api/user-api/src/test/java/org/example/fixture/dto/UserRequestDtoFixture.java @@ -1,7 +1,7 @@ package org.example.fixture.dto; -import org.example.service.dto.request.LoginServiceRequest; -import org.example.vo.SocialLoginApiType; +import org.example.user.service.dto.request.LoginServiceRequest; +import org.example.user.vo.SocialLoginApiType; public class UserRequestDtoFixture { diff --git a/app/api/user-api/src/test/java/org/example/service/UserServiceTest.java b/app/api/user-api/src/test/java/org/example/service/UserServiceTest.java index f35df0cd..6b8515a9 100644 --- a/app/api/user-api/src/test/java/org/example/service/UserServiceTest.java +++ b/app/api/user-api/src/test/java/org/example/service/UserServiceTest.java @@ -1,6 +1,7 @@ package org.example.service; import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyInt; import static org.mockito.BDDMockito.given; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.times; @@ -8,11 +9,13 @@ import java.util.Date; import java.util.NoSuchElementException; +import java.util.Optional; import org.example.entity.SocialLogin; import org.example.entity.User; +import org.example.file.component.FileComponent; +import org.example.file.component.FileLocalComponent; import org.example.fixture.UserFixture; import org.example.fixture.dto.UserRequestDtoFixture; -import org.example.pub.UserMessagePublisher; import org.example.security.dto.UserParam; import org.example.security.token.JWTGenerator; import org.example.security.token.TokenProcessor; @@ -21,7 +24,9 @@ import org.example.usecase.InterestShowUseCase; import org.example.usecase.TicketingAlertUseCase; import org.example.usecase.UserUseCase; -import org.example.vo.SocialLoginApiType; +import org.example.user.pub.UserMessagePublisher; +import org.example.user.service.UserService; +import org.example.user.vo.SocialLoginApiType; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; import org.junit.jupiter.params.ParameterizedTest; @@ -32,14 +37,17 @@ public class UserServiceTest { private final UserUseCase userUseCase = mock(UserUseCase.class); - private final ArtistSubscriptionUseCase artistSubscriptionUseCase = mock(ArtistSubscriptionUseCase.class); - private final GenreSubscriptionUseCase genreSubscriptionUseCase = mock(GenreSubscriptionUseCase.class); + private final ArtistSubscriptionUseCase artistSubscriptionUseCase = mock( + ArtistSubscriptionUseCase.class); + private final GenreSubscriptionUseCase genreSubscriptionUseCase = mock( + GenreSubscriptionUseCase.class); private final InterestShowUseCase interestShowUseCase = mock(InterestShowUseCase.class); private final TicketingAlertUseCase ticketingAlertUseCase = mock(TicketingAlertUseCase.class); private final JWTGenerator jwtGenerator = mock(JWTGenerator.class); private final TokenProcessor tokenProcessor = mock(TokenProcessor.class); private final TransactionTemplate transactionTemplate = mock(TransactionTemplate.class); private final UserMessagePublisher userMessagePublisher = mock(UserMessagePublisher.class); + private final FileComponent fileComponent = mock(FileLocalComponent.class); private final UserService userService = new UserService( userUseCase, @@ -50,7 +58,8 @@ public class UserServiceTest { jwtGenerator, tokenProcessor, transactionTemplate, - userMessagePublisher + userMessagePublisher, + fileComponent ); @ParameterizedTest @@ -63,16 +72,14 @@ public class UserServiceTest { void getJwtAndCreatesNewUserIfNotExistWhenLogin(SocialLoginApiType type) { // given var request = UserRequestDtoFixture.loginServiceRequest(type); - given( - userUseCase.findUser(request.toDomainRequest()) - ).willThrow( - NoSuchElementException.class - ); + given(userUseCase.findUser(request.toDomainRequest())) + .willThrow(NoSuchElementException.class); var user = UserFixture.randomNicknameUser(); - given( - userUseCase.createNewUser(any(User.class), any(SocialLogin.class)) - ).willReturn(user); + given(fileComponent.getImageUrl(anyInt())) + .willReturn(Optional.of("testProfileUrl")); + given(userUseCase.createNewUser(any(User.class), any(SocialLogin.class))) + .willReturn(user); // when userService.login(request); @@ -81,6 +88,7 @@ void getJwtAndCreatesNewUserIfNotExistWhenLogin(SocialLoginApiType type) { verify(jwtGenerator, times(1)).generate(any(UserParam.class), any(Date.class)); } + @Test @DisplayName("로그인 시 사용자가 존재하면 기존의 사용자 정보로 JWT를 반환하다.") void getJwtAndUserIfExistWhenLogin() { diff --git a/app/domain/user-domain/src/main/java/org/example/entity/User.java b/app/domain/user-domain/src/main/java/org/example/entity/User.java index e2b6af9b..779fd9ca 100644 --- a/app/domain/user-domain/src/main/java/org/example/entity/User.java +++ b/app/domain/user-domain/src/main/java/org/example/entity/User.java @@ -43,13 +43,15 @@ public class User extends BaseEntity { @Builder public User( String nickname, - String fcmToken + String fcmToken, + String profileUrl ) { this.nickname = nickname; this.birth = LocalDate.of(0, 1, 1); this.fcmToken = fcmToken; this.userGender = UserGender.NOT_CHOSEN; this.userRole = UserRole.USER; + this.profileUrl = profileUrl; } public boolean isChangedFcmToken(String fcmToken) { diff --git a/app/domain/user-domain/src/testFixtures/java/org/example/fixture/UserFixture.java b/app/domain/user-domain/src/testFixtures/java/org/example/fixture/UserFixture.java index 7e87a132..f27bf989 100644 --- a/app/domain/user-domain/src/testFixtures/java/org/example/fixture/UserFixture.java +++ b/app/domain/user-domain/src/testFixtures/java/org/example/fixture/UserFixture.java @@ -9,6 +9,7 @@ public static User randomNicknameUser() { return User.builder() .nickname(RandomNickname.makeRandomNickName()) .fcmToken("testFcmToken") + .profileUrl("testProfileUrl") .build(); } } diff --git a/app/infrastructure/message-queue/src/main/java/org/example/publish/RedisMessagePublisher.java b/app/infrastructure/message-queue/src/main/java/org/example/publish/RedisMessagePublisher.java index 4147660d..7dfbd523 100644 --- a/app/infrastructure/message-queue/src/main/java/org/example/publish/RedisMessagePublisher.java +++ b/app/infrastructure/message-queue/src/main/java/org/example/publish/RedisMessagePublisher.java @@ -12,8 +12,8 @@ import org.example.message.ShowRelationArtistAndGenreInfraMessage; import org.example.message.TicketingReservationInfraMessage; import org.example.metric.MessageQueuePubMonitored; -import org.example.pub.UserFcmMessage; -import org.example.pub.UserMessagePublisher; +import org.example.user.pub.UserFcmMessage; +import org.example.user.pub.UserMessagePublisher; import org.springframework.data.redis.core.RedisTemplate; import org.springframework.stereotype.Component; diff --git a/app/src/main/resources/application-dev.yml b/app/src/main/resources/application-dev.yml index 7837203f..899a6b83 100644 --- a/app/src/main/resources/application-dev.yml +++ b/app/src/main/resources/application-dev.yml @@ -30,6 +30,9 @@ token: alarm: api-url: ${ALARM_SERVER_API_URL} +file: + root-url: ${FILE_ROOT_API_URL_DEV} + springdoc: swagger-ui: disable-swagger-default-url: true diff --git a/app/src/main/resources/application-local.yml b/app/src/main/resources/application-local.yml index 4ddebb79..69c2131c 100644 --- a/app/src/main/resources/application-local.yml +++ b/app/src/main/resources/application-local.yml @@ -31,6 +31,9 @@ token: alarm: api-url: http://localhost:8081/api/v1 +file: + root-url: http://localhost:8080/api/v1/files + springdoc: swagger-ui: disable-swagger-default-url: true diff --git a/app/src/main/resources/application-prod.yml b/app/src/main/resources/application-prod.yml index 2da323f1..9c854e52 100644 --- a/app/src/main/resources/application-prod.yml +++ b/app/src/main/resources/application-prod.yml @@ -22,6 +22,9 @@ token: alarm: api-url: ${ALARM_SERVER_API_URL_PROD} +file: + root-url: ${FILE_ROOT_API_URL_PROD} + springdoc: swagger-ui: disable-swagger-default-url: true diff --git a/common/src/main/java/org/example/util/RandomNumber.java b/common/src/main/java/org/example/util/RandomNumber.java new file mode 100644 index 00000000..eb7d677b --- /dev/null +++ b/common/src/main/java/org/example/util/RandomNumber.java @@ -0,0 +1,15 @@ +package org.example.util; + +import java.util.concurrent.ThreadLocalRandom; +import lombok.experimental.UtilityClass; + +@UtilityClass +public class RandomNumber { + + public static int getRandomNumber(int min, int max) { + if (min > max) { + throw new IllegalArgumentException("min 값은 max 값보다 작거나 같아야 합니다."); + } + return ThreadLocalRandom.current().nextInt(min, max + 1); + } +} diff --git a/common/src/main/java/org/example/util/ValidateStatus.java b/common/src/main/java/org/example/util/ValidateStatus.java index e99197cc..05f8f6c5 100644 --- a/common/src/main/java/org/example/util/ValidateStatus.java +++ b/common/src/main/java/org/example/util/ValidateStatus.java @@ -1,7 +1,9 @@ package org.example.util; import java.util.List; +import lombok.experimental.UtilityClass; +@UtilityClass public class ValidateStatus { public static List checkNullOrEmpty(List list) {