diff --git a/server/src/main/java/server/haengdong/HaengdongApplication.java b/server/src/main/java/haengdong/HaengdongApplication.java similarity index 95% rename from server/src/main/java/server/haengdong/HaengdongApplication.java rename to server/src/main/java/haengdong/HaengdongApplication.java index 3e4f9fcfe..466297436 100644 --- a/server/src/main/java/server/haengdong/HaengdongApplication.java +++ b/server/src/main/java/haengdong/HaengdongApplication.java @@ -1,4 +1,4 @@ -package server.haengdong; +package haengdong; import lombok.extern.slf4j.Slf4j; import org.springframework.boot.SpringApplication; diff --git a/server/src/main/java/server/haengdong/config/Login.java b/server/src/main/java/haengdong/common/auth/Login.java similarity index 89% rename from server/src/main/java/server/haengdong/config/Login.java rename to server/src/main/java/haengdong/common/auth/Login.java index 76786ffd5..a9ab5bad0 100644 --- a/server/src/main/java/server/haengdong/config/Login.java +++ b/server/src/main/java/haengdong/common/auth/Login.java @@ -1,4 +1,4 @@ -package server.haengdong.config; +package haengdong.common.auth; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; diff --git a/server/src/main/java/server/haengdong/domain/TokenProvider.java b/server/src/main/java/haengdong/common/auth/TokenProvider.java similarity index 86% rename from server/src/main/java/server/haengdong/domain/TokenProvider.java rename to server/src/main/java/haengdong/common/auth/TokenProvider.java index 28e7956c3..c514b222f 100644 --- a/server/src/main/java/server/haengdong/domain/TokenProvider.java +++ b/server/src/main/java/haengdong/common/auth/TokenProvider.java @@ -1,4 +1,4 @@ -package server.haengdong.domain; +package haengdong.common.auth; import java.util.Map; diff --git a/server/src/main/java/server/haengdong/application/AuthService.java b/server/src/main/java/haengdong/common/auth/application/AuthService.java similarity index 85% rename from server/src/main/java/server/haengdong/application/AuthService.java rename to server/src/main/java/haengdong/common/auth/application/AuthService.java index 78242c783..0e87ab317 100644 --- a/server/src/main/java/server/haengdong/application/AuthService.java +++ b/server/src/main/java/haengdong/common/auth/application/AuthService.java @@ -1,12 +1,13 @@ -package server.haengdong.application; +package haengdong.common.auth.application; import java.util.Map; import lombok.extern.slf4j.Slf4j; -import server.haengdong.domain.TokenProvider; -import server.haengdong.domain.user.Role; -import server.haengdong.exception.AuthenticationException; -import server.haengdong.exception.HaengdongErrorCode; +import haengdong.event.application.EventService; +import haengdong.common.auth.TokenProvider; +import haengdong.user.domain.Role; +import haengdong.common.exception.AuthenticationException; +import haengdong.common.exception.HaengdongErrorCode; @Slf4j public class AuthService { diff --git a/server/src/main/java/server/haengdong/infrastructure/auth/AuthenticationExtractor.java b/server/src/main/java/haengdong/common/auth/infrastructure/AuthenticationExtractor.java similarity index 80% rename from server/src/main/java/server/haengdong/infrastructure/auth/AuthenticationExtractor.java rename to server/src/main/java/haengdong/common/auth/infrastructure/AuthenticationExtractor.java index 4972de48a..d7159a9ad 100644 --- a/server/src/main/java/server/haengdong/infrastructure/auth/AuthenticationExtractor.java +++ b/server/src/main/java/haengdong/common/auth/infrastructure/AuthenticationExtractor.java @@ -1,10 +1,10 @@ -package server.haengdong.infrastructure.auth; +package haengdong.common.auth.infrastructure; import jakarta.servlet.http.Cookie; import jakarta.servlet.http.HttpServletRequest; import java.util.Arrays; -import server.haengdong.exception.AuthenticationException; -import server.haengdong.exception.HaengdongErrorCode; +import haengdong.common.exception.AuthenticationException; +import haengdong.common.exception.HaengdongErrorCode; public class AuthenticationExtractor { diff --git a/server/src/main/java/server/haengdong/infrastructure/auth/JwtTokenProvider.java b/server/src/main/java/haengdong/common/auth/infrastructure/JwtTokenProvider.java similarity index 63% rename from server/src/main/java/server/haengdong/infrastructure/auth/JwtTokenProvider.java rename to server/src/main/java/haengdong/common/auth/infrastructure/JwtTokenProvider.java index df9ec6a81..f8e276397 100644 --- a/server/src/main/java/server/haengdong/infrastructure/auth/JwtTokenProvider.java +++ b/server/src/main/java/haengdong/common/auth/infrastructure/JwtTokenProvider.java @@ -1,5 +1,6 @@ -package server.haengdong.infrastructure.auth; +package haengdong.common.auth.infrastructure; +import haengdong.common.properties.JwtProperties; import io.jsonwebtoken.Claims; import io.jsonwebtoken.Jws; import io.jsonwebtoken.JwtException; @@ -8,34 +9,34 @@ import java.util.Date; import java.util.HashMap; import java.util.Map; -import server.haengdong.domain.TokenProvider; +import haengdong.common.auth.TokenProvider; public class JwtTokenProvider implements TokenProvider { - private final TokenProperties tokenProperties; + private final JwtProperties jwtProperties; - public JwtTokenProvider(TokenProperties tokenProperties) { - this.tokenProperties = tokenProperties; + public JwtTokenProvider(JwtProperties jwtProperties) { + this.jwtProperties = jwtProperties; } @Override public String createToken(Map payload) { Claims claims = Jwts.claims(new HashMap<>(payload)); Date now = new Date(); - Date validity = new Date(now.getTime() + tokenProperties.expireLength()); + Date validity = new Date(now.getTime() + jwtProperties.expireLength()); return Jwts.builder() .setClaims(claims) .setIssuedAt(now) .setExpiration(validity) - .signWith(SignatureAlgorithm.HS256, tokenProperties.secretKey()) + .signWith(SignatureAlgorithm.HS256, jwtProperties.secretKey()) .compact(); } @Override public Map getPayload(String token) { return Jwts.parser() - .setSigningKey(tokenProperties.secretKey()) + .setSigningKey(jwtProperties.secretKey()) .parseClaimsJws(token) .getBody(); } @@ -43,7 +44,7 @@ public Map getPayload(String token) { @Override public boolean validateToken(String token) { try { - Jws claims = Jwts.parser().setSigningKey(tokenProperties.secretKey()).parseClaimsJws(token); + Jws claims = Jwts.parser().setSigningKey(jwtProperties.secretKey()).parseClaimsJws(token); return !claims.getBody().getExpiration().before(new Date()); } catch (JwtException | IllegalArgumentException e) { diff --git a/server/src/main/java/server/haengdong/infrastructure/DataSourceConfig.java b/server/src/main/java/haengdong/common/config/DataSourceConfig.java similarity index 96% rename from server/src/main/java/server/haengdong/infrastructure/DataSourceConfig.java rename to server/src/main/java/haengdong/common/config/DataSourceConfig.java index c859217b4..9f5877e8d 100644 --- a/server/src/main/java/server/haengdong/infrastructure/DataSourceConfig.java +++ b/server/src/main/java/haengdong/common/config/DataSourceConfig.java @@ -1,4 +1,4 @@ -package server.haengdong.infrastructure; +package haengdong.common.config; import com.zaxxer.hikari.HikariDataSource; import jakarta.persistence.EntityManagerFactory; @@ -16,6 +16,7 @@ import org.springframework.jdbc.datasource.LazyConnectionDataSourceProxy; import org.springframework.orm.jpa.JpaTransactionManager; import org.springframework.transaction.PlatformTransactionManager; +import haengdong.common.infrastructure.DynamicRoutingDataSource; @Profile("prod") @Configuration diff --git a/server/src/main/java/server/haengdong/config/JpaConfig.java b/server/src/main/java/haengdong/common/config/JpaConfig.java similarity index 85% rename from server/src/main/java/server/haengdong/config/JpaConfig.java rename to server/src/main/java/haengdong/common/config/JpaConfig.java index f0210e4b0..a895d4ffa 100644 --- a/server/src/main/java/server/haengdong/config/JpaConfig.java +++ b/server/src/main/java/haengdong/common/config/JpaConfig.java @@ -1,4 +1,4 @@ -package server.haengdong.config; +package haengdong.common.config; import org.springframework.context.annotation.Configuration; import org.springframework.data.jpa.repository.config.EnableJpaAuditing; diff --git a/server/src/main/java/server/haengdong/config/WebMvcConfig.java b/server/src/main/java/haengdong/common/config/WebMvcConfig.java similarity index 65% rename from server/src/main/java/server/haengdong/config/WebMvcConfig.java rename to server/src/main/java/haengdong/common/config/WebMvcConfig.java index bd7c95126..c421ba648 100644 --- a/server/src/main/java/server/haengdong/config/WebMvcConfig.java +++ b/server/src/main/java/haengdong/common/config/WebMvcConfig.java @@ -1,42 +1,38 @@ -package server.haengdong.config; - +package haengdong.common.config; + +import haengdong.common.auth.TokenProvider; +import haengdong.common.auth.application.AuthService; +import haengdong.common.auth.infrastructure.AuthenticationExtractor; +import haengdong.common.auth.infrastructure.JwtTokenProvider; +import haengdong.common.infrastructure.AdminInterceptor; +import haengdong.common.properties.CorsProperties; +import haengdong.common.properties.JwtProperties; +import haengdong.event.application.EventService; import lombok.RequiredArgsConstructor; -import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.web.servlet.config.annotation.CorsRegistry; import org.springframework.web.servlet.config.annotation.InterceptorRegistry; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; -import server.haengdong.application.AuthService; -import server.haengdong.application.EventService; -import server.haengdong.domain.TokenProvider; -import server.haengdong.infrastructure.auth.AuthenticationExtractor; -import server.haengdong.infrastructure.auth.JwtTokenProvider; -import server.haengdong.infrastructure.auth.TokenProperties; @RequiredArgsConstructor -@EnableConfigurationProperties(TokenProperties.class) +@EnableConfigurationProperties({JwtProperties.class, CorsProperties.class}) @Configuration public class WebMvcConfig implements WebMvcConfigurer { - private final TokenProperties tokenProperties; + private final JwtProperties jwtProperties; private final EventService eventService; - - @Value("${cors.max-age}") - private Long maxAge; - - @Value("${cors.allowed-origins}") - private String[] allowedOrigins; + private final CorsProperties corsProperties; @Override public void addCorsMappings(CorsRegistry registry) { registry.addMapping("/**") - .allowedOrigins(allowedOrigins) + .allowedOrigins(corsProperties.allowedOrigins()) .allowedMethods("GET", "POST", "PUT", "PATCH", "DELETE", "OPTIONS") .allowedHeaders("*") .allowCredentials(true) - .maxAge(maxAge); + .maxAge(corsProperties.maxAge()); } @Override @@ -57,7 +53,7 @@ public AuthService authService() { @Bean public TokenProvider tokenProvider() { - return new JwtTokenProvider(tokenProperties); + return new JwtTokenProvider(jwtProperties); } @Bean diff --git a/server/src/main/java/server/haengdong/domain/BaseEntity.java b/server/src/main/java/haengdong/common/domain/BaseEntity.java similarity index 94% rename from server/src/main/java/server/haengdong/domain/BaseEntity.java rename to server/src/main/java/haengdong/common/domain/BaseEntity.java index 2eb4aa01c..399f70a11 100644 --- a/server/src/main/java/server/haengdong/domain/BaseEntity.java +++ b/server/src/main/java/haengdong/common/domain/BaseEntity.java @@ -1,4 +1,4 @@ -package server.haengdong.domain; +package haengdong.common.domain; import jakarta.persistence.Column; import jakarta.persistence.EntityListeners; diff --git a/server/src/main/java/server/haengdong/exception/AuthenticationException.java b/server/src/main/java/haengdong/common/exception/AuthenticationException.java similarity index 92% rename from server/src/main/java/server/haengdong/exception/AuthenticationException.java rename to server/src/main/java/haengdong/common/exception/AuthenticationException.java index 2efcb16e7..f86b2dca0 100644 --- a/server/src/main/java/server/haengdong/exception/AuthenticationException.java +++ b/server/src/main/java/haengdong/common/exception/AuthenticationException.java @@ -1,4 +1,4 @@ -package server.haengdong.exception; +package haengdong.common.exception; import lombok.Getter; diff --git a/server/src/main/java/server/haengdong/exception/ErrorResponse.java b/server/src/main/java/haengdong/common/exception/ErrorResponse.java similarity index 91% rename from server/src/main/java/server/haengdong/exception/ErrorResponse.java rename to server/src/main/java/haengdong/common/exception/ErrorResponse.java index 3937f4322..981101722 100644 --- a/server/src/main/java/server/haengdong/exception/ErrorResponse.java +++ b/server/src/main/java/haengdong/common/exception/ErrorResponse.java @@ -1,4 +1,4 @@ -package server.haengdong.exception; +package haengdong.common.exception; public record ErrorResponse( String errorCode, diff --git a/server/src/main/java/server/haengdong/exception/GlobalExceptionHandler.java b/server/src/main/java/haengdong/common/exception/GlobalExceptionHandler.java similarity index 99% rename from server/src/main/java/server/haengdong/exception/GlobalExceptionHandler.java rename to server/src/main/java/haengdong/common/exception/GlobalExceptionHandler.java index 4d2c96c73..61f71d184 100644 --- a/server/src/main/java/server/haengdong/exception/GlobalExceptionHandler.java +++ b/server/src/main/java/haengdong/common/exception/GlobalExceptionHandler.java @@ -1,4 +1,4 @@ -package server.haengdong.exception; +package haengdong.common.exception; import jakarta.servlet.http.HttpServletRequest; import java.io.BufferedReader; diff --git a/server/src/main/java/server/haengdong/exception/HaengdongErrorCode.java b/server/src/main/java/haengdong/common/exception/HaengdongErrorCode.java similarity index 98% rename from server/src/main/java/server/haengdong/exception/HaengdongErrorCode.java rename to server/src/main/java/haengdong/common/exception/HaengdongErrorCode.java index 1bdb96c0a..68d0f4db6 100644 --- a/server/src/main/java/server/haengdong/exception/HaengdongErrorCode.java +++ b/server/src/main/java/haengdong/common/exception/HaengdongErrorCode.java @@ -1,4 +1,4 @@ -package server.haengdong.exception; +package haengdong.common.exception; import lombok.Getter; diff --git a/server/src/main/java/server/haengdong/exception/HaengdongException.java b/server/src/main/java/haengdong/common/exception/HaengdongException.java similarity index 94% rename from server/src/main/java/server/haengdong/exception/HaengdongException.java rename to server/src/main/java/haengdong/common/exception/HaengdongException.java index 212b5bed5..9bfed423e 100644 --- a/server/src/main/java/server/haengdong/exception/HaengdongException.java +++ b/server/src/main/java/haengdong/common/exception/HaengdongException.java @@ -1,4 +1,4 @@ -package server.haengdong.exception; +package haengdong.common.exception; import lombok.Getter; diff --git a/server/src/main/java/server/haengdong/config/AdminInterceptor.java b/server/src/main/java/haengdong/common/infrastructure/AdminInterceptor.java similarity index 87% rename from server/src/main/java/server/haengdong/config/AdminInterceptor.java rename to server/src/main/java/haengdong/common/infrastructure/AdminInterceptor.java index 527cdbbf7..1de325a34 100644 --- a/server/src/main/java/server/haengdong/config/AdminInterceptor.java +++ b/server/src/main/java/haengdong/common/infrastructure/AdminInterceptor.java @@ -1,4 +1,4 @@ -package server.haengdong.config; +package haengdong.common.infrastructure; import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletResponse; @@ -7,10 +7,10 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.http.HttpMethod; import org.springframework.web.servlet.HandlerInterceptor; -import server.haengdong.application.AuthService; -import server.haengdong.exception.AuthenticationException; -import server.haengdong.exception.HaengdongErrorCode; -import server.haengdong.infrastructure.auth.AuthenticationExtractor; +import haengdong.common.auth.application.AuthService; +import haengdong.common.exception.AuthenticationException; +import haengdong.common.exception.HaengdongErrorCode; +import haengdong.common.auth.infrastructure.AuthenticationExtractor; @Slf4j public class AdminInterceptor implements HandlerInterceptor { diff --git a/server/src/main/java/server/haengdong/config/AuthenticationPrincipalArgumentResolver.java b/server/src/main/java/haengdong/common/infrastructure/AuthenticationPrincipalArgumentResolver.java similarity index 86% rename from server/src/main/java/server/haengdong/config/AuthenticationPrincipalArgumentResolver.java rename to server/src/main/java/haengdong/common/infrastructure/AuthenticationPrincipalArgumentResolver.java index 383f5b536..03fa35554 100644 --- a/server/src/main/java/server/haengdong/config/AuthenticationPrincipalArgumentResolver.java +++ b/server/src/main/java/haengdong/common/infrastructure/AuthenticationPrincipalArgumentResolver.java @@ -1,7 +1,8 @@ -package server.haengdong.config; +package haengdong.common.infrastructure; -import static server.haengdong.config.AdminInterceptor.LOGIN_MEMBER_REQUEST; +import static haengdong.common.infrastructure.AdminInterceptor.LOGIN_MEMBER_REQUEST; +import haengdong.common.auth.Login; import jakarta.servlet.http.HttpServletRequest; import org.springframework.core.MethodParameter; import org.springframework.web.bind.support.WebDataBinderFactory; diff --git a/server/src/main/java/server/haengdong/infrastructure/DynamicRoutingDataSource.java b/server/src/main/java/haengdong/common/infrastructure/DynamicRoutingDataSource.java similarity index 93% rename from server/src/main/java/server/haengdong/infrastructure/DynamicRoutingDataSource.java rename to server/src/main/java/haengdong/common/infrastructure/DynamicRoutingDataSource.java index 5f84010a1..dbea8036a 100644 --- a/server/src/main/java/server/haengdong/infrastructure/DynamicRoutingDataSource.java +++ b/server/src/main/java/haengdong/common/infrastructure/DynamicRoutingDataSource.java @@ -1,4 +1,4 @@ -package server.haengdong.infrastructure; +package haengdong.common.infrastructure; import static org.springframework.transaction.support.TransactionSynchronizationManager.isCurrentTransactionReadOnly; diff --git a/server/src/main/java/server/haengdong/config/RequestServletFilter.java b/server/src/main/java/haengdong/common/infrastructure/RequestServletFilter.java similarity index 95% rename from server/src/main/java/server/haengdong/config/RequestServletFilter.java rename to server/src/main/java/haengdong/common/infrastructure/RequestServletFilter.java index b1afdb6f8..0819dff64 100644 --- a/server/src/main/java/server/haengdong/config/RequestServletFilter.java +++ b/server/src/main/java/haengdong/common/infrastructure/RequestServletFilter.java @@ -1,4 +1,4 @@ -package server.haengdong.config; +package haengdong.common.infrastructure; import jakarta.servlet.Filter; import jakarta.servlet.FilterChain; diff --git a/server/src/main/java/server/haengdong/infrastructure/auth/CookieProperties.java b/server/src/main/java/haengdong/common/properties/CookieProperties.java similarity index 87% rename from server/src/main/java/server/haengdong/infrastructure/auth/CookieProperties.java rename to server/src/main/java/haengdong/common/properties/CookieProperties.java index 18f867601..1020c370d 100644 --- a/server/src/main/java/server/haengdong/infrastructure/auth/CookieProperties.java +++ b/server/src/main/java/haengdong/common/properties/CookieProperties.java @@ -1,4 +1,4 @@ -package server.haengdong.infrastructure.auth; +package haengdong.common.properties; import java.time.Duration; import org.springframework.boot.context.properties.ConfigurationProperties; diff --git a/server/src/main/java/haengdong/common/properties/CorsProperties.java b/server/src/main/java/haengdong/common/properties/CorsProperties.java new file mode 100644 index 000000000..a07ad8de4 --- /dev/null +++ b/server/src/main/java/haengdong/common/properties/CorsProperties.java @@ -0,0 +1,10 @@ +package haengdong.common.properties; + +import org.springframework.boot.context.properties.ConfigurationProperties; + +@ConfigurationProperties("cors") +public record CorsProperties( + Long maxAge, + String[] allowedOrigins +) { +} diff --git a/server/src/main/java/server/haengdong/infrastructure/auth/TokenProperties.java b/server/src/main/java/haengdong/common/properties/JwtProperties.java similarity index 52% rename from server/src/main/java/server/haengdong/infrastructure/auth/TokenProperties.java rename to server/src/main/java/haengdong/common/properties/JwtProperties.java index 11dedcdbf..4502f8f86 100644 --- a/server/src/main/java/server/haengdong/infrastructure/auth/TokenProperties.java +++ b/server/src/main/java/haengdong/common/properties/JwtProperties.java @@ -1,7 +1,7 @@ -package server.haengdong.infrastructure.auth; +package haengdong.common.properties; import org.springframework.boot.context.properties.ConfigurationProperties; @ConfigurationProperties("security.jwt.token") -public record TokenProperties(String secretKey, Long expireLength) { +public record JwtProperties(String secretKey, Long expireLength) { } diff --git a/server/src/main/java/haengdong/event/application/BillService.java b/server/src/main/java/haengdong/event/application/BillService.java new file mode 100644 index 000000000..09fdd3889 --- /dev/null +++ b/server/src/main/java/haengdong/event/application/BillService.java @@ -0,0 +1,110 @@ +package haengdong.event.application; + +import haengdong.common.exception.HaengdongErrorCode; +import haengdong.common.exception.HaengdongException; +import haengdong.event.application.request.BillAppRequest; +import haengdong.event.application.request.BillDetailsUpdateAppRequest; +import haengdong.event.application.request.BillUpdateAppRequest; +import haengdong.event.application.response.BillDetailsAppResponse; +import haengdong.event.application.response.StepAppResponse; +import haengdong.event.domain.bill.Bill; +import haengdong.event.domain.bill.BillDetail; +import haengdong.event.domain.bill.BillRepository; +import haengdong.event.domain.event.Event; +import haengdong.event.domain.event.EventRepository; +import haengdong.event.domain.event.member.EventMember; +import haengdong.event.domain.event.member.EventMemberRepository; +import haengdong.event.domain.step.Steps; +import java.util.List; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@RequiredArgsConstructor +@Transactional(readOnly = true) +@Service +public class BillService { + + private final BillRepository billRepository; + private final EventRepository eventRepository; + private final EventMemberRepository eventMemberRepository; + + @Transactional + public void saveBill(String eventToken, BillAppRequest request) { + Event event = getEvent(eventToken); + List memberIds = request.memberIds(); + List eventMembers = memberIds.stream() + .map(this::getMember) + .toList(); + + Bill bill = request.toBill(event, eventMembers); + billRepository.save(bill); + } + + public List findSteps(String token) { + Event event = getEvent(token); + List bills = billRepository.findAllByEvent(event); + + return createStepAppResponses(bills); + } + + private List createStepAppResponses(List bills) { + Steps steps = Steps.of(bills); + return steps.getSteps().stream() + .map(StepAppResponse::of) + .toList(); + } + + @Transactional + public void updateBill(String token, Long billId, BillUpdateAppRequest request) { + Bill bill = getBill(billId); + validateToken(token, bill); + bill.update(request.title(), request.price()); + } + + @Transactional + public void deleteBill(String token, Long billId) { + Bill bill = getBill(billId); + validateToken(token, bill); + billRepository.deleteById(billId); + } + + public BillDetailsAppResponse findBillDetails(String token, Long billId) { + Bill bill = getBill(billId); + validateToken(token, bill); + + List billDetails = bill.getBillDetails(); + return BillDetailsAppResponse.of(billDetails); + } + + @Transactional + public void updateBillDetails(String token, Long billId, BillDetailsUpdateAppRequest request) { + Bill bill = getBill(billId); + validateToken(token, bill); + + List billDetails = request.toBillDetails(bill); + bill.updateDetails(billDetails); + } + + private void validateToken(String token, Bill bill) { + Event event = bill.getEvent(); + if (event.isTokenMismatch(token)) { + throw new HaengdongException(HaengdongErrorCode.BILL_NOT_FOUND); + } + } + + private Event getEvent(String eventToken) { + return eventRepository.findByToken(eventToken) + .orElseThrow(() -> new HaengdongException(HaengdongErrorCode.EVENT_NOT_FOUND)); + } + + private Bill getBill(Long billId) { + return billRepository.findById(billId) + .orElseThrow(() -> new HaengdongException(HaengdongErrorCode.BILL_NOT_FOUND)); + } + + private EventMember getMember(Long memberId) { + return eventMemberRepository.findById(memberId) + .orElseThrow(() -> new HaengdongException(HaengdongErrorCode.MEMBER_NOT_FOUND)); + } +} diff --git a/server/src/main/java/server/haengdong/application/EventImageFacadeService.java b/server/src/main/java/haengdong/event/application/EventImageFacadeService.java similarity index 86% rename from server/src/main/java/server/haengdong/application/EventImageFacadeService.java rename to server/src/main/java/haengdong/event/application/EventImageFacadeService.java index 11a639ca6..d5f5f78f4 100644 --- a/server/src/main/java/server/haengdong/application/EventImageFacadeService.java +++ b/server/src/main/java/haengdong/event/application/EventImageFacadeService.java @@ -1,5 +1,7 @@ -package server.haengdong.application; +package haengdong.event.application; +import haengdong.event.application.response.EventImageAppResponse; +import haengdong.event.application.response.EventImageUrlAppResponse; import java.time.Instant; import java.time.temporal.ChronoUnit; import java.util.List; @@ -13,10 +15,10 @@ import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Service; import org.springframework.web.multipart.MultipartFile; -import server.haengdong.application.response.EventImageSaveAppResponse; -import server.haengdong.application.response.ImageInfo; -import server.haengdong.exception.HaengdongErrorCode; -import server.haengdong.exception.HaengdongException; +import haengdong.event.application.response.EventImageSaveAppResponse; +import haengdong.event.application.response.ImageInfo; +import haengdong.common.exception.HaengdongErrorCode; +import haengdong.common.exception.HaengdongException; @RequiredArgsConstructor @Service @@ -125,4 +127,13 @@ private void removeImageNotInRepository(List eventIma .filter(name -> !imageNames.contains(name)) .forEach(imageService::deleteImage); } + + public List findImages(String token) { + List images = eventService.findImages(token); + String baseUrl = imageService.getBaseUrl(); + + return images.stream() + .map(image -> new EventImageUrlAppResponse(image.id(), baseUrl + image.name())) + .toList(); + } } diff --git a/server/src/main/java/server/haengdong/application/EventMemberService.java b/server/src/main/java/haengdong/event/application/EventMemberService.java similarity index 59% rename from server/src/main/java/server/haengdong/application/EventMemberService.java rename to server/src/main/java/haengdong/event/application/EventMemberService.java index 823c25945..dcc81b79d 100644 --- a/server/src/main/java/server/haengdong/application/EventMemberService.java +++ b/server/src/main/java/haengdong/event/application/EventMemberService.java @@ -1,26 +1,25 @@ -package server.haengdong.application; - - +package haengdong.event.application; + + +import haengdong.common.exception.HaengdongErrorCode; +import haengdong.common.exception.HaengdongException; +import haengdong.event.application.request.MembersSaveAppRequest; +import haengdong.event.application.request.MembersUpdateAppRequest; +import haengdong.event.application.response.MemberAppResponse; +import haengdong.event.application.response.MembersDepositAppResponse; +import haengdong.event.application.response.MembersSaveAppResponse; +import haengdong.event.domain.bill.Bill; +import haengdong.event.domain.bill.BillRepository; +import haengdong.event.domain.event.Event; +import haengdong.event.domain.event.EventRepository; +import haengdong.event.domain.event.member.EventMember; +import haengdong.event.domain.event.member.EventMemberRepository; +import haengdong.event.domain.event.member.EventUniqueMembers; +import haengdong.event.domain.event.member.UpdatedMembers; import java.util.List; -import java.util.Set; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import server.haengdong.application.request.MemberSaveAppRequest; -import server.haengdong.application.request.MembersSaveAppRequest; -import server.haengdong.application.request.MembersUpdateAppRequest; -import server.haengdong.application.response.MemberAppResponse; -import server.haengdong.application.response.MembersDepositAppResponse; -import server.haengdong.application.response.MembersSaveAppResponse; -import server.haengdong.domain.bill.Bill; -import server.haengdong.domain.bill.BillRepository; -import server.haengdong.domain.event.Event; -import server.haengdong.domain.event.EventRepository; -import server.haengdong.domain.eventmember.EventMember; -import server.haengdong.domain.eventmember.EventMemberRepository; -import server.haengdong.domain.eventmember.UpdatedMembers; -import server.haengdong.exception.HaengdongErrorCode; -import server.haengdong.exception.HaengdongException; @RequiredArgsConstructor @Transactional(readOnly = true) @@ -34,35 +33,20 @@ public class EventMemberService { @Transactional public MembersSaveAppResponse saveMembers(String token, MembersSaveAppRequest request) { Event event = getEvent(token); - List memberNames = request.members().stream() - .map(MemberSaveAppRequest::name) - .toList(); - - validateMemberSave(memberNames, event); - - List eventMembers = memberNames.stream() - .map(name -> new EventMember(event, name)) - .toList(); + EventUniqueMembers eventMembers = request.toEventMembers(event); + validateDuplicateName(eventMembers, event); - List savedEventMembers = eventMemberRepository.saveAll(eventMembers); + List savedEventMembers = eventMemberRepository.saveAll(eventMembers.getEventMembers()); return MembersSaveAppResponse.of(savedEventMembers); } - private void validateMemberSave(List memberNames, Event event) { - Set uniqueMemberNames = Set.copyOf(memberNames); - if (memberNames.size() != uniqueMemberNames.size()) { - throw new HaengdongException(HaengdongErrorCode.MEMBER_NAME_DUPLICATE, memberNames); - } - if (isDuplicatedMemberNames(uniqueMemberNames, event)) { + private void validateDuplicateName(EventUniqueMembers eventMembers, Event event) { + List foundEventMembers = eventMemberRepository.findAllByEvent(event); + if (eventMembers.containName(foundEventMembers)) { throw new HaengdongException(HaengdongErrorCode.MEMBER_ALREADY_EXIST); } } - private boolean isDuplicatedMemberNames(Set uniqueMemberNames, Event event) { - return eventMemberRepository.findAllByEvent(event).stream() - .anyMatch(member -> uniqueMemberNames.contains(member.getName())); - } - public List getCurrentMembers(String token) { Event event = getEvent(token); @@ -76,9 +60,7 @@ public List getCurrentMembers(String token) { public MembersDepositAppResponse findAllMembers(String token) { Event event = getEvent(token); - List eventMembers = eventMemberRepository.findAllByEvent(event); - return MembersDepositAppResponse.of(eventMembers); } diff --git a/server/src/main/java/server/haengdong/application/EventService.java b/server/src/main/java/haengdong/event/application/EventService.java similarity index 78% rename from server/src/main/java/server/haengdong/application/EventService.java rename to server/src/main/java/haengdong/event/application/EventService.java index b087e46fd..45fce389b 100644 --- a/server/src/main/java/server/haengdong/application/EventService.java +++ b/server/src/main/java/haengdong/event/application/EventService.java @@ -1,4 +1,4 @@ -package server.haengdong.application; +package haengdong.event.application; import java.time.Instant; import java.util.List; @@ -7,28 +7,29 @@ import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import server.haengdong.application.request.EventAppRequest; -import server.haengdong.application.request.EventGuestAppRequest; -import server.haengdong.application.request.EventLoginAppRequest; -import server.haengdong.application.request.EventUpdateAppRequest; -import server.haengdong.application.response.EventAppResponse; -import server.haengdong.application.response.EventDetailAppResponse; -import server.haengdong.application.response.EventImageAppResponse; -import server.haengdong.application.response.EventImageSaveAppResponse; -import server.haengdong.application.response.MemberBillReportAppResponse; -import server.haengdong.domain.RandomValueProvider; -import server.haengdong.domain.bill.Bill; -import server.haengdong.domain.bill.BillRepository; -import server.haengdong.domain.bill.MemberBillReport; -import server.haengdong.domain.event.Event; -import server.haengdong.domain.event.EventImage; -import server.haengdong.domain.event.EventImageRepository; -import server.haengdong.domain.event.EventRepository; -import server.haengdong.domain.eventmember.EventMember; -import server.haengdong.domain.eventmember.EventMemberRepository; -import server.haengdong.exception.AuthenticationException; -import server.haengdong.exception.HaengdongErrorCode; -import server.haengdong.exception.HaengdongException; +import haengdong.event.application.request.EventAppRequest; +import haengdong.event.application.request.EventGuestAppRequest; +import haengdong.event.application.request.EventLoginAppRequest; +import haengdong.event.application.request.EventUpdateAppRequest; +import haengdong.event.application.response.EventAppResponse; +import haengdong.event.application.response.EventDetailAppResponse; +import haengdong.event.application.response.EventImageAppResponse; +import haengdong.event.application.response.EventImageSaveAppResponse; +import haengdong.event.application.response.MemberBillReportAppResponse; +import haengdong.event.domain.RandomValueProvider; +import haengdong.event.domain.bill.Bill; +import haengdong.event.domain.bill.BillRepository; +import haengdong.event.domain.bill.MemberBillReport; +import haengdong.event.domain.event.Event; +import haengdong.event.domain.event.image.EventImage; +import haengdong.event.domain.event.image.EventImageRepository; +import haengdong.event.domain.event.EventRepository; +import haengdong.event.domain.event.member.EventMember; +import haengdong.event.domain.event.member.EventMemberRepository; +import haengdong.common.exception.AuthenticationException; +import haengdong.common.exception.HaengdongErrorCode; +import haengdong.common.exception.HaengdongException; +import haengdong.user.application.UserService; @RequiredArgsConstructor @Transactional(readOnly = true) @@ -83,8 +84,7 @@ public EventAppResponse findByGuestPassword(EventLoginAppRequest request) { } public List getMemberBillReports(String token) { - Event event = eventRepository.findByToken(token) - .orElseThrow(() -> new HaengdongException(HaengdongErrorCode.EVENT_NOT_FOUND)); + Event event = getEvent(token); List bills = billRepository.findAllByEvent(event); MemberBillReport memberBillReport = MemberBillReport.createByBills(bills); @@ -135,7 +135,7 @@ public List saveImages(String token, List ori private void validateImageCount(List images, Event event) { Long imageCount = eventImageRepository.countByEvent(event); - Long totalImageCount = imageCount + images.size(); + long totalImageCount = imageCount + images.size(); if (totalImageCount > MAX_IMAGE_COUNT) { throw new HaengdongException(HaengdongErrorCode.IMAGE_COUNT_INVALID, totalImageCount); @@ -147,14 +147,10 @@ public List findImages(String token) { return eventImageRepository.findAllByEvent(event) .stream() - .map(image -> new EventImageAppResponse(image.getId(), createUrl(image))) + .map(image -> new EventImageAppResponse(image.getId(), image.getName())) .toList(); } - private String createUrl(EventImage image) { - return baseUrl + image.getName(); - } - @Transactional public String deleteImage(String token, Long imageId) { EventImage eventImage = getEventImage(imageId); @@ -177,16 +173,6 @@ public void deleteImages(String token, List imageIds) { imageIds.forEach(imageId -> deleteImage(token, imageId)); } - private Event getEvent(String token) { - return eventRepository.findByToken(token) - .orElseThrow(() -> new HaengdongException(HaengdongErrorCode.EVENT_NOT_FOUND)); - } - - private EventImage getEventImage(Long imageId) { - return eventImageRepository.findById(imageId) - .orElseThrow(() -> new HaengdongException(HaengdongErrorCode.IMAGE_NOT_FOUND)); - } - public List findImagesDateBefore(Instant date) { return eventImageRepository.findByCreatedAtAfter(date).stream() .map(EventImageSaveAppResponse::of) @@ -196,4 +182,14 @@ public List findImagesDateBefore(Instant date) { public boolean existsByTokenAndUserId(String eventToken, Long userId) { return eventRepository.existsByTokenAndUserId(eventToken, userId); } + + private Event getEvent(String token) { + return eventRepository.findByToken(token) + .orElseThrow(() -> new HaengdongException(HaengdongErrorCode.EVENT_NOT_FOUND)); + } + + private EventImage getEventImage(Long imageId) { + return eventImageRepository.findById(imageId) + .orElseThrow(() -> new HaengdongException(HaengdongErrorCode.IMAGE_NOT_FOUND)); + } } diff --git a/server/src/main/java/server/haengdong/application/ImageService.java b/server/src/main/java/haengdong/event/application/ImageService.java similarity index 72% rename from server/src/main/java/server/haengdong/application/ImageService.java rename to server/src/main/java/haengdong/event/application/ImageService.java index dd6b39daf..097cfe95e 100644 --- a/server/src/main/java/server/haengdong/application/ImageService.java +++ b/server/src/main/java/haengdong/event/application/ImageService.java @@ -1,21 +1,22 @@ -package server.haengdong.application; +package haengdong.event.application; import static software.amazon.awssdk.core.sync.RequestBody.fromInputStream; +import haengdong.common.exception.HaengdongErrorCode; +import haengdong.common.exception.HaengdongException; +import haengdong.event.application.response.ImageInfo; +import haengdong.event.properties.ImageProperties; import java.io.IOException; import java.io.InputStream; import java.util.List; import java.util.concurrent.CompletableFuture; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; -import org.springframework.beans.factory.annotation.Value; +import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.retry.annotation.Retryable; import org.springframework.scheduling.annotation.Async; import org.springframework.stereotype.Service; import org.springframework.web.multipart.MultipartFile; -import server.haengdong.application.response.ImageInfo; -import server.haengdong.exception.HaengdongErrorCode; -import server.haengdong.exception.HaengdongException; import software.amazon.awssdk.services.s3.S3Client; import software.amazon.awssdk.services.s3.model.DeleteObjectRequest; import software.amazon.awssdk.services.s3.model.ListObjectsV2Request; @@ -24,15 +25,11 @@ @Slf4j @RequiredArgsConstructor +@EnableConfigurationProperties(ImageProperties.class) @Service public class ImageService { - @Value("${image.bucket}") - private String bucketName; - - @Value("${image.directory}") - private String directoryPath; - + private final ImageProperties imageProperties; private final S3Client s3Client; @Retryable @@ -45,11 +42,11 @@ public void uploadImage(MultipartFile image, String imageName) { } private void uploadImageToStorage(InputStream inputStream, MultipartFile image, String imageName) { - String key = directoryPath + imageName; + String key = imageProperties.directory() + imageName; long contentLength = image.getSize(); PutObjectRequest putObjectRequest = PutObjectRequest.builder() - .bucket(bucketName) + .bucket(imageProperties.bucket()) .key(key) .contentLength(contentLength) .contentType(image.getContentType()) @@ -62,8 +59,8 @@ private void uploadImageToStorage(InputStream inputStream, MultipartFile image, @Retryable public CompletableFuture deleteImage(String imageName) { DeleteObjectRequest deleteObjectRequest = DeleteObjectRequest.builder() - .bucket(bucketName) - .key(directoryPath + imageName) + .bucket(imageProperties.bucket()) + .key(imageProperties.directory() + imageName) .build(); s3Client.deleteObject(deleteObjectRequest); @@ -72,17 +69,21 @@ public CompletableFuture deleteImage(String imageName) { public List findImages() { ListObjectsV2Request request = ListObjectsV2Request.builder() - .bucket(bucketName) - .prefix(directoryPath) + .bucket(imageProperties.bucket()) + .prefix(imageProperties.directory()) .build(); ListObjectsV2Response response = s3Client.listObjectsV2(request); return response.contents().stream() .map(s3Object -> new ImageInfo( - s3Object.key().substring(directoryPath.length()), + s3Object.key().substring(imageProperties.directory().length()), s3Object.lastModified() )) .toList(); } + + public String getBaseUrl() { + return imageProperties.baseUrl(); + } } diff --git a/server/src/main/java/server/haengdong/application/request/BillAppRequest.java b/server/src/main/java/haengdong/event/application/request/BillAppRequest.java similarity index 59% rename from server/src/main/java/server/haengdong/application/request/BillAppRequest.java rename to server/src/main/java/haengdong/event/application/request/BillAppRequest.java index 07faed97c..dbd8cf804 100644 --- a/server/src/main/java/server/haengdong/application/request/BillAppRequest.java +++ b/server/src/main/java/haengdong/event/application/request/BillAppRequest.java @@ -1,9 +1,9 @@ -package server.haengdong.application.request; +package haengdong.event.application.request; import java.util.List; -import server.haengdong.domain.bill.Bill; -import server.haengdong.domain.eventmember.EventMember; -import server.haengdong.domain.event.Event; +import haengdong.event.domain.bill.Bill; +import haengdong.event.domain.event.member.EventMember; +import haengdong.event.domain.event.Event; public record BillAppRequest( String title, diff --git a/server/src/main/java/haengdong/event/application/request/BillDetailUpdateAppRequest.java b/server/src/main/java/haengdong/event/application/request/BillDetailUpdateAppRequest.java new file mode 100644 index 000000000..b772eb474 --- /dev/null +++ b/server/src/main/java/haengdong/event/application/request/BillDetailUpdateAppRequest.java @@ -0,0 +1,31 @@ +package haengdong.event.application.request; + +import haengdong.common.exception.HaengdongErrorCode; +import haengdong.common.exception.HaengdongException; +import haengdong.event.domain.bill.Bill; +import haengdong.event.domain.bill.BillDetail; +import haengdong.event.domain.event.member.EventMember; +import java.util.List; + +public record BillDetailUpdateAppRequest( + Long id, + Long price, + boolean isFixed +) { + + public BillDetail toBillDetail(Bill bill) { + List billDetails = bill.getBillDetails(); + + return new BillDetail(bill, findEventMemberById(id, billDetails), price, isFixed); + } + + private EventMember findEventMemberById( + Long id, List billDetails + ) { + return billDetails.stream() + .filter(detail -> detail.isSameId(id)) + .findFirst() + .map(BillDetail::getEventMember) + .orElseThrow(() -> new HaengdongException(HaengdongErrorCode.BILL_DETAIL_NOT_FOUND)); + } +} diff --git a/server/src/main/java/haengdong/event/application/request/BillDetailsUpdateAppRequest.java b/server/src/main/java/haengdong/event/application/request/BillDetailsUpdateAppRequest.java new file mode 100644 index 000000000..cbb5e52d3 --- /dev/null +++ b/server/src/main/java/haengdong/event/application/request/BillDetailsUpdateAppRequest.java @@ -0,0 +1,15 @@ +package haengdong.event.application.request; + +import haengdong.event.domain.bill.Bill; +import haengdong.event.domain.bill.BillDetail; +import java.util.List; + +public record BillDetailsUpdateAppRequest( + List billDetailUpdateAppRequests +) { + public List toBillDetails(Bill bill) { + return billDetailUpdateAppRequests.stream() + .map(request -> request.toBillDetail(bill)) + .toList(); + } +} diff --git a/server/src/main/java/server/haengdong/application/request/BillUpdateAppRequest.java b/server/src/main/java/haengdong/event/application/request/BillUpdateAppRequest.java similarity index 64% rename from server/src/main/java/server/haengdong/application/request/BillUpdateAppRequest.java rename to server/src/main/java/haengdong/event/application/request/BillUpdateAppRequest.java index aa09f2351..cb6f67c26 100644 --- a/server/src/main/java/server/haengdong/application/request/BillUpdateAppRequest.java +++ b/server/src/main/java/haengdong/event/application/request/BillUpdateAppRequest.java @@ -1,4 +1,4 @@ -package server.haengdong.application.request; +package haengdong.event.application.request; public record BillUpdateAppRequest( String title, diff --git a/server/src/main/java/server/haengdong/application/request/EventAppRequest.java b/server/src/main/java/haengdong/event/application/request/EventAppRequest.java similarity index 63% rename from server/src/main/java/server/haengdong/application/request/EventAppRequest.java rename to server/src/main/java/haengdong/event/application/request/EventAppRequest.java index d286fe819..0d7a6c5a6 100644 --- a/server/src/main/java/server/haengdong/application/request/EventAppRequest.java +++ b/server/src/main/java/haengdong/event/application/request/EventAppRequest.java @@ -1,6 +1,6 @@ -package server.haengdong.application.request; +package haengdong.event.application.request; -import server.haengdong.domain.event.Event; +import haengdong.event.domain.event.Event; public record EventAppRequest(String name, Long userId) { diff --git a/server/src/main/java/server/haengdong/application/request/EventGuestAppRequest.java b/server/src/main/java/haengdong/event/application/request/EventGuestAppRequest.java similarity index 68% rename from server/src/main/java/server/haengdong/application/request/EventGuestAppRequest.java rename to server/src/main/java/haengdong/event/application/request/EventGuestAppRequest.java index 0c04a29dc..60190d943 100644 --- a/server/src/main/java/server/haengdong/application/request/EventGuestAppRequest.java +++ b/server/src/main/java/haengdong/event/application/request/EventGuestAppRequest.java @@ -1,4 +1,6 @@ -package server.haengdong.application.request; +package haengdong.event.application.request; + +import haengdong.user.application.request.UserGuestSaveAppRequest; public record EventGuestAppRequest( String eventName, diff --git a/server/src/main/java/server/haengdong/application/request/EventLoginAppRequest.java b/server/src/main/java/haengdong/event/application/request/EventLoginAppRequest.java similarity index 60% rename from server/src/main/java/server/haengdong/application/request/EventLoginAppRequest.java rename to server/src/main/java/haengdong/event/application/request/EventLoginAppRequest.java index 947b5ef39..3a3256266 100644 --- a/server/src/main/java/server/haengdong/application/request/EventLoginAppRequest.java +++ b/server/src/main/java/haengdong/event/application/request/EventLoginAppRequest.java @@ -1,4 +1,4 @@ -package server.haengdong.application.request; +package haengdong.event.application.request; public record EventLoginAppRequest(String token, String password) { } diff --git a/server/src/main/java/server/haengdong/application/request/EventUpdateAppRequest.java b/server/src/main/java/haengdong/event/application/request/EventUpdateAppRequest.java similarity index 90% rename from server/src/main/java/server/haengdong/application/request/EventUpdateAppRequest.java rename to server/src/main/java/haengdong/event/application/request/EventUpdateAppRequest.java index 13bffccc1..7377acb62 100644 --- a/server/src/main/java/server/haengdong/application/request/EventUpdateAppRequest.java +++ b/server/src/main/java/haengdong/event/application/request/EventUpdateAppRequest.java @@ -1,4 +1,4 @@ -package server.haengdong.application.request; +package haengdong.event.application.request; public record EventUpdateAppRequest( String eventName, diff --git a/server/src/main/java/server/haengdong/application/request/MemberNameUpdateAppRequest.java b/server/src/main/java/haengdong/event/application/request/MemberNameUpdateAppRequest.java similarity index 65% rename from server/src/main/java/server/haengdong/application/request/MemberNameUpdateAppRequest.java rename to server/src/main/java/haengdong/event/application/request/MemberNameUpdateAppRequest.java index b36d71cc1..55e6199c8 100644 --- a/server/src/main/java/server/haengdong/application/request/MemberNameUpdateAppRequest.java +++ b/server/src/main/java/haengdong/event/application/request/MemberNameUpdateAppRequest.java @@ -1,4 +1,4 @@ -package server.haengdong.application.request; +package haengdong.event.application.request; public record MemberNameUpdateAppRequest( Long id, diff --git a/server/src/main/java/server/haengdong/application/request/MemberNamesUpdateAppRequest.java b/server/src/main/java/haengdong/event/application/request/MemberNamesUpdateAppRequest.java similarity index 72% rename from server/src/main/java/server/haengdong/application/request/MemberNamesUpdateAppRequest.java rename to server/src/main/java/haengdong/event/application/request/MemberNamesUpdateAppRequest.java index cd0c00544..184466ff9 100644 --- a/server/src/main/java/server/haengdong/application/request/MemberNamesUpdateAppRequest.java +++ b/server/src/main/java/haengdong/event/application/request/MemberNamesUpdateAppRequest.java @@ -1,4 +1,4 @@ -package server.haengdong.application.request; +package haengdong.event.application.request; import java.util.List; diff --git a/server/src/main/java/server/haengdong/application/request/MemberSaveAppRequest.java b/server/src/main/java/haengdong/event/application/request/MemberSaveAppRequest.java similarity index 53% rename from server/src/main/java/server/haengdong/application/request/MemberSaveAppRequest.java rename to server/src/main/java/haengdong/event/application/request/MemberSaveAppRequest.java index 45dc234e3..308453982 100644 --- a/server/src/main/java/server/haengdong/application/request/MemberSaveAppRequest.java +++ b/server/src/main/java/haengdong/event/application/request/MemberSaveAppRequest.java @@ -1,4 +1,4 @@ -package server.haengdong.application.request; +package haengdong.event.application.request; public record MemberSaveAppRequest(String name) { } diff --git a/server/src/main/java/server/haengdong/application/request/MemberUpdateAppRequest.java b/server/src/main/java/haengdong/event/application/request/MemberUpdateAppRequest.java similarity index 61% rename from server/src/main/java/server/haengdong/application/request/MemberUpdateAppRequest.java rename to server/src/main/java/haengdong/event/application/request/MemberUpdateAppRequest.java index 510c904b4..c3b23772e 100644 --- a/server/src/main/java/server/haengdong/application/request/MemberUpdateAppRequest.java +++ b/server/src/main/java/haengdong/event/application/request/MemberUpdateAppRequest.java @@ -1,8 +1,8 @@ -package server.haengdong.application.request; +package haengdong.event.application.request; -import server.haengdong.domain.eventmember.EventMember; -import server.haengdong.domain.event.Event; +import haengdong.event.domain.event.member.EventMember; +import haengdong.event.domain.event.Event; public record MemberUpdateAppRequest( Long id, diff --git a/server/src/main/java/haengdong/event/application/request/MembersSaveAppRequest.java b/server/src/main/java/haengdong/event/application/request/MembersSaveAppRequest.java new file mode 100644 index 000000000..32b1df37f --- /dev/null +++ b/server/src/main/java/haengdong/event/application/request/MembersSaveAppRequest.java @@ -0,0 +1,18 @@ +package haengdong.event.application.request; + +import haengdong.event.domain.event.Event; +import haengdong.event.domain.event.member.EventMember; +import haengdong.event.domain.event.member.EventUniqueMembers; +import java.util.List; + +public record MembersSaveAppRequest( + List members +) { + public EventUniqueMembers toEventMembers(Event event) { + List eventMembers = members.stream() + .map(member -> new EventMember(event, member.name())) + .toList(); + + return new EventUniqueMembers(eventMembers); + } +} diff --git a/server/src/main/java/server/haengdong/application/request/MembersUpdateAppRequest.java b/server/src/main/java/haengdong/event/application/request/MembersUpdateAppRequest.java similarity index 66% rename from server/src/main/java/server/haengdong/application/request/MembersUpdateAppRequest.java rename to server/src/main/java/haengdong/event/application/request/MembersUpdateAppRequest.java index ee08c239e..3a5fdb185 100644 --- a/server/src/main/java/server/haengdong/application/request/MembersUpdateAppRequest.java +++ b/server/src/main/java/haengdong/event/application/request/MembersUpdateAppRequest.java @@ -1,8 +1,8 @@ -package server.haengdong.application.request; +package haengdong.event.application.request; import java.util.List; -import server.haengdong.domain.event.Event; -import server.haengdong.domain.eventmember.EventMember; +import haengdong.event.domain.event.Event; +import haengdong.event.domain.event.member.EventMember; public record MembersUpdateAppRequest(List members) { diff --git a/server/src/main/java/server/haengdong/application/response/BillAppResponse.java b/server/src/main/java/haengdong/event/application/response/BillAppResponse.java similarity index 75% rename from server/src/main/java/server/haengdong/application/response/BillAppResponse.java rename to server/src/main/java/haengdong/event/application/response/BillAppResponse.java index 6ee68935c..95ab9ebce 100644 --- a/server/src/main/java/server/haengdong/application/response/BillAppResponse.java +++ b/server/src/main/java/haengdong/event/application/response/BillAppResponse.java @@ -1,6 +1,6 @@ -package server.haengdong.application.response; +package haengdong.event.application.response; -import server.haengdong.domain.bill.Bill; +import haengdong.event.domain.bill.Bill; public record BillAppResponse( Long id, diff --git a/server/src/main/java/server/haengdong/application/response/BillDetailAppResponse.java b/server/src/main/java/haengdong/event/application/response/BillDetailAppResponse.java similarity index 81% rename from server/src/main/java/server/haengdong/application/response/BillDetailAppResponse.java rename to server/src/main/java/haengdong/event/application/response/BillDetailAppResponse.java index 9c9e11ca2..31c20865b 100644 --- a/server/src/main/java/server/haengdong/application/response/BillDetailAppResponse.java +++ b/server/src/main/java/haengdong/event/application/response/BillDetailAppResponse.java @@ -1,6 +1,6 @@ -package server.haengdong.application.response; +package haengdong.event.application.response; -import server.haengdong.domain.bill.BillDetail; +import haengdong.event.domain.bill.BillDetail; public record BillDetailAppResponse( Long id, diff --git a/server/src/main/java/server/haengdong/application/response/BillDetailsAppResponse.java b/server/src/main/java/haengdong/event/application/response/BillDetailsAppResponse.java similarity index 81% rename from server/src/main/java/server/haengdong/application/response/BillDetailsAppResponse.java rename to server/src/main/java/haengdong/event/application/response/BillDetailsAppResponse.java index 3618e0d08..8367aa1af 100644 --- a/server/src/main/java/server/haengdong/application/response/BillDetailsAppResponse.java +++ b/server/src/main/java/haengdong/event/application/response/BillDetailsAppResponse.java @@ -1,8 +1,8 @@ -package server.haengdong.application.response; +package haengdong.event.application.response; import java.util.List; import java.util.stream.Collectors; -import server.haengdong.domain.bill.BillDetail; +import haengdong.event.domain.bill.BillDetail; public record BillDetailsAppResponse(List billDetails) { diff --git a/server/src/main/java/server/haengdong/application/response/EventAppResponse.java b/server/src/main/java/haengdong/event/application/response/EventAppResponse.java similarity index 70% rename from server/src/main/java/server/haengdong/application/response/EventAppResponse.java rename to server/src/main/java/haengdong/event/application/response/EventAppResponse.java index 1e900a13b..fd26f660b 100644 --- a/server/src/main/java/server/haengdong/application/response/EventAppResponse.java +++ b/server/src/main/java/haengdong/event/application/response/EventAppResponse.java @@ -1,6 +1,6 @@ -package server.haengdong.application.response; +package haengdong.event.application.response; -import server.haengdong.domain.event.Event; +import haengdong.event.domain.event.Event; public record EventAppResponse( String token, diff --git a/server/src/main/java/server/haengdong/application/response/EventDetailAppResponse.java b/server/src/main/java/haengdong/event/application/response/EventDetailAppResponse.java similarity index 76% rename from server/src/main/java/server/haengdong/application/response/EventDetailAppResponse.java rename to server/src/main/java/haengdong/event/application/response/EventDetailAppResponse.java index 899ea76ec..19a9862ef 100644 --- a/server/src/main/java/server/haengdong/application/response/EventDetailAppResponse.java +++ b/server/src/main/java/haengdong/event/application/response/EventDetailAppResponse.java @@ -1,6 +1,6 @@ -package server.haengdong.application.response; +package haengdong.event.application.response; -import server.haengdong.domain.event.Event; +import haengdong.event.domain.event.Event; public record EventDetailAppResponse( String eventName, diff --git a/server/src/main/java/haengdong/event/application/response/EventImageAppResponse.java b/server/src/main/java/haengdong/event/application/response/EventImageAppResponse.java new file mode 100644 index 000000000..0261ad7bd --- /dev/null +++ b/server/src/main/java/haengdong/event/application/response/EventImageAppResponse.java @@ -0,0 +1,7 @@ +package haengdong.event.application.response; + +public record EventImageAppResponse( + Long id, + String name +) { +} diff --git a/server/src/main/java/server/haengdong/application/response/EventImageSaveAppResponse.java b/server/src/main/java/haengdong/event/application/response/EventImageSaveAppResponse.java similarity index 71% rename from server/src/main/java/server/haengdong/application/response/EventImageSaveAppResponse.java rename to server/src/main/java/haengdong/event/application/response/EventImageSaveAppResponse.java index e1da79de3..985822aca 100644 --- a/server/src/main/java/server/haengdong/application/response/EventImageSaveAppResponse.java +++ b/server/src/main/java/haengdong/event/application/response/EventImageSaveAppResponse.java @@ -1,6 +1,6 @@ -package server.haengdong.application.response; +package haengdong.event.application.response; -import server.haengdong.domain.event.EventImage; +import haengdong.event.domain.event.image.EventImage; public record EventImageSaveAppResponse( Long id, diff --git a/server/src/main/java/haengdong/event/application/response/EventImageUrlAppResponse.java b/server/src/main/java/haengdong/event/application/response/EventImageUrlAppResponse.java new file mode 100644 index 000000000..75870d33b --- /dev/null +++ b/server/src/main/java/haengdong/event/application/response/EventImageUrlAppResponse.java @@ -0,0 +1,7 @@ +package haengdong.event.application.response; + +public record EventImageUrlAppResponse( + Long id, + String url +) { +} diff --git a/server/src/main/java/server/haengdong/application/response/ImageInfo.java b/server/src/main/java/haengdong/event/application/response/ImageInfo.java similarity index 69% rename from server/src/main/java/server/haengdong/application/response/ImageInfo.java rename to server/src/main/java/haengdong/event/application/response/ImageInfo.java index 92deb1f72..73fc06f75 100644 --- a/server/src/main/java/server/haengdong/application/response/ImageInfo.java +++ b/server/src/main/java/haengdong/event/application/response/ImageInfo.java @@ -1,4 +1,4 @@ -package server.haengdong.application.response; +package haengdong.event.application.response; import java.time.Instant; diff --git a/server/src/main/java/server/haengdong/application/response/LastBillMemberAppResponse.java b/server/src/main/java/haengdong/event/application/response/LastBillMemberAppResponse.java similarity index 69% rename from server/src/main/java/server/haengdong/application/response/LastBillMemberAppResponse.java rename to server/src/main/java/haengdong/event/application/response/LastBillMemberAppResponse.java index a259d83a7..ba803c58e 100644 --- a/server/src/main/java/server/haengdong/application/response/LastBillMemberAppResponse.java +++ b/server/src/main/java/haengdong/event/application/response/LastBillMemberAppResponse.java @@ -1,6 +1,6 @@ -package server.haengdong.application.response; +package haengdong.event.application.response; -import server.haengdong.domain.eventmember.EventMember; +import haengdong.event.domain.event.member.EventMember; public record LastBillMemberAppResponse(Long id, String name) { diff --git a/server/src/main/java/server/haengdong/application/response/MemberAppResponse.java b/server/src/main/java/haengdong/event/application/response/MemberAppResponse.java similarity index 69% rename from server/src/main/java/server/haengdong/application/response/MemberAppResponse.java rename to server/src/main/java/haengdong/event/application/response/MemberAppResponse.java index 869f2a238..711f5274c 100644 --- a/server/src/main/java/server/haengdong/application/response/MemberAppResponse.java +++ b/server/src/main/java/haengdong/event/application/response/MemberAppResponse.java @@ -1,6 +1,6 @@ -package server.haengdong.application.response; +package haengdong.event.application.response; -import server.haengdong.domain.eventmember.EventMember; +import haengdong.event.domain.event.member.EventMember; public record MemberAppResponse( Long id, diff --git a/server/src/main/java/server/haengdong/application/response/MemberBillReportAppResponse.java b/server/src/main/java/haengdong/event/application/response/MemberBillReportAppResponse.java similarity index 75% rename from server/src/main/java/server/haengdong/application/response/MemberBillReportAppResponse.java rename to server/src/main/java/haengdong/event/application/response/MemberBillReportAppResponse.java index 875578fbc..66dbdad53 100644 --- a/server/src/main/java/server/haengdong/application/response/MemberBillReportAppResponse.java +++ b/server/src/main/java/haengdong/event/application/response/MemberBillReportAppResponse.java @@ -1,4 +1,4 @@ -package server.haengdong.application.response; +package haengdong.event.application.response; public record MemberBillReportAppResponse( Long memberId, diff --git a/server/src/main/java/server/haengdong/application/response/MemberDepositAppResponse.java b/server/src/main/java/haengdong/event/application/response/MemberDepositAppResponse.java similarity index 75% rename from server/src/main/java/server/haengdong/application/response/MemberDepositAppResponse.java rename to server/src/main/java/haengdong/event/application/response/MemberDepositAppResponse.java index 05a909a86..a9db0c6c6 100644 --- a/server/src/main/java/server/haengdong/application/response/MemberDepositAppResponse.java +++ b/server/src/main/java/haengdong/event/application/response/MemberDepositAppResponse.java @@ -1,6 +1,6 @@ -package server.haengdong.application.response; +package haengdong.event.application.response; -import server.haengdong.domain.eventmember.EventMember; +import haengdong.event.domain.event.member.EventMember; public record MemberDepositAppResponse( Long id, diff --git a/server/src/main/java/server/haengdong/application/response/MemberSaveAppResponse.java b/server/src/main/java/haengdong/event/application/response/MemberSaveAppResponse.java similarity index 70% rename from server/src/main/java/server/haengdong/application/response/MemberSaveAppResponse.java rename to server/src/main/java/haengdong/event/application/response/MemberSaveAppResponse.java index 0d339d5a7..bd1c2a6f3 100644 --- a/server/src/main/java/server/haengdong/application/response/MemberSaveAppResponse.java +++ b/server/src/main/java/haengdong/event/application/response/MemberSaveAppResponse.java @@ -1,6 +1,6 @@ -package server.haengdong.application.response; +package haengdong.event.application.response; -import server.haengdong.domain.eventmember.EventMember; +import haengdong.event.domain.event.member.EventMember; public record MemberSaveAppResponse( Long id, diff --git a/server/src/main/java/server/haengdong/application/response/MembersDepositAppResponse.java b/server/src/main/java/haengdong/event/application/response/MembersDepositAppResponse.java similarity index 77% rename from server/src/main/java/server/haengdong/application/response/MembersDepositAppResponse.java rename to server/src/main/java/haengdong/event/application/response/MembersDepositAppResponse.java index 66ba3602c..1239a300d 100644 --- a/server/src/main/java/server/haengdong/application/response/MembersDepositAppResponse.java +++ b/server/src/main/java/haengdong/event/application/response/MembersDepositAppResponse.java @@ -1,7 +1,7 @@ -package server.haengdong.application.response; +package haengdong.event.application.response; import java.util.List; -import server.haengdong.domain.eventmember.EventMember; +import haengdong.event.domain.event.member.EventMember; public record MembersDepositAppResponse( List members diff --git a/server/src/main/java/server/haengdong/application/response/MembersSaveAppResponse.java b/server/src/main/java/haengdong/event/application/response/MembersSaveAppResponse.java similarity index 78% rename from server/src/main/java/server/haengdong/application/response/MembersSaveAppResponse.java rename to server/src/main/java/haengdong/event/application/response/MembersSaveAppResponse.java index d90d71db8..c91000add 100644 --- a/server/src/main/java/server/haengdong/application/response/MembersSaveAppResponse.java +++ b/server/src/main/java/haengdong/event/application/response/MembersSaveAppResponse.java @@ -1,7 +1,7 @@ -package server.haengdong.application.response; +package haengdong.event.application.response; import java.util.List; -import server.haengdong.domain.eventmember.EventMember; +import haengdong.event.domain.event.member.EventMember; public record MembersSaveAppResponse( List members diff --git a/server/src/main/java/server/haengdong/application/response/StepAppResponse.java b/server/src/main/java/haengdong/event/application/response/StepAppResponse.java similarity index 86% rename from server/src/main/java/server/haengdong/application/response/StepAppResponse.java rename to server/src/main/java/haengdong/event/application/response/StepAppResponse.java index 57ca1860c..cc919cafe 100644 --- a/server/src/main/java/server/haengdong/application/response/StepAppResponse.java +++ b/server/src/main/java/haengdong/event/application/response/StepAppResponse.java @@ -1,7 +1,7 @@ -package server.haengdong.application.response; +package haengdong.event.application.response; import java.util.List; -import server.haengdong.domain.step.Step; +import haengdong.event.domain.step.Step; public record StepAppResponse( List bills, diff --git a/server/src/main/java/server/haengdong/config/S3Config.java b/server/src/main/java/haengdong/event/config/S3Config.java similarity index 95% rename from server/src/main/java/server/haengdong/config/S3Config.java rename to server/src/main/java/haengdong/event/config/S3Config.java index cdac7c1dc..ecf5e9691 100644 --- a/server/src/main/java/server/haengdong/config/S3Config.java +++ b/server/src/main/java/haengdong/event/config/S3Config.java @@ -1,4 +1,4 @@ -package server.haengdong.config; +package haengdong.event.config; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; diff --git a/server/src/main/java/server/haengdong/domain/RandomValueProvider.java b/server/src/main/java/haengdong/event/domain/RandomValueProvider.java similarity index 75% rename from server/src/main/java/server/haengdong/domain/RandomValueProvider.java rename to server/src/main/java/haengdong/event/domain/RandomValueProvider.java index 9f05f62a2..b8ca2e5b5 100644 --- a/server/src/main/java/server/haengdong/domain/RandomValueProvider.java +++ b/server/src/main/java/haengdong/event/domain/RandomValueProvider.java @@ -1,4 +1,4 @@ -package server.haengdong.domain; +package haengdong.event.domain; import java.util.UUID; diff --git a/server/src/main/java/server/haengdong/domain/bill/Bill.java b/server/src/main/java/haengdong/event/domain/bill/Bill.java similarity index 75% rename from server/src/main/java/server/haengdong/domain/bill/Bill.java rename to server/src/main/java/haengdong/event/domain/bill/Bill.java index 43c33dab7..fddd9e19e 100644 --- a/server/src/main/java/server/haengdong/domain/bill/Bill.java +++ b/server/src/main/java/haengdong/event/domain/bill/Bill.java @@ -1,5 +1,10 @@ -package server.haengdong.domain.bill; +package haengdong.event.domain.bill; +import haengdong.common.domain.BaseEntity; +import haengdong.common.exception.HaengdongErrorCode; +import haengdong.common.exception.HaengdongException; +import haengdong.event.domain.event.Event; +import haengdong.event.domain.event.member.EventMember; import jakarta.persistence.CascadeType; import jakarta.persistence.Column; import jakarta.persistence.Entity; @@ -13,17 +18,11 @@ import java.util.ArrayList; import java.util.Iterator; import java.util.List; -import java.util.Set; import java.util.stream.Collectors; import java.util.stream.Stream; import lombok.AccessLevel; import lombok.Getter; import lombok.NoArgsConstructor; -import server.haengdong.domain.BaseEntity; -import server.haengdong.domain.eventmember.EventMember; -import server.haengdong.domain.event.Event; -import server.haengdong.exception.HaengdongErrorCode; -import server.haengdong.exception.HaengdongException; @Getter @NoArgsConstructor(access = AccessLevel.PROTECTED) @@ -130,20 +129,43 @@ public void update(String title, Long price) { resetBillDetails(); } - public boolean containMember(EventMember eventMember) { - return billDetails.stream() - .anyMatch(billDetail -> billDetail.isMember(eventMember)); + public void updateDetails(List billDetails) { + validateBillDetailSize(billDetails); + validateTotalPrice(billDetails); + this.billDetails.clear(); + this.billDetails.addAll(billDetails); + } + + private void validateBillDetailSize(List billDetails) { + List ids = billDetails.stream() + .map(billDetail -> billDetail.getEventMember().getId()) + .distinct() + .toList(); + if (this.billDetails.size() != ids.size()) { + throw new HaengdongException(HaengdongErrorCode.BILL_DETAIL_NOT_FOUND); + } } - public boolean isSameMembers(Bill other) { - Set eventMembers = Set.copyOf(this.getMembers()); - Set otherEventMembers = Set.copyOf(other.getMembers()); + private void validateTotalPrice(List billDetails) { + Long requestsPriceSum = calculateUpdatePriceSum(billDetails); + if (isNotSamePrice(requestsPriceSum)) { + throw new HaengdongException(HaengdongErrorCode.BILL_PRICE_NOT_MATCHED); + } + } + + private Long calculateUpdatePriceSum(List billDetails) { + return billDetails.stream() + .map(BillDetail::getPrice) + .reduce(0L, Long::sum); + } - return eventMembers.equals(otherEventMembers); + public boolean containMember(EventMember eventMember) { + return billDetails.stream() + .anyMatch(billDetail -> billDetail.isMember(eventMember)); } - public boolean isSamePrice(Long price) { - return this.price.equals(price); + private boolean isNotSamePrice(Long price) { + return !this.price.equals(price); } public boolean isFixed() { diff --git a/server/src/main/java/server/haengdong/domain/bill/BillDetail.java b/server/src/main/java/haengdong/event/domain/bill/BillDetail.java similarity index 91% rename from server/src/main/java/server/haengdong/domain/bill/BillDetail.java rename to server/src/main/java/haengdong/event/domain/bill/BillDetail.java index 856bdaf45..3177f9cbd 100644 --- a/server/src/main/java/server/haengdong/domain/bill/BillDetail.java +++ b/server/src/main/java/haengdong/event/domain/bill/BillDetail.java @@ -1,4 +1,4 @@ -package server.haengdong.domain.bill; +package haengdong.event.domain.bill; import jakarta.persistence.Column; import jakarta.persistence.Entity; @@ -11,8 +11,8 @@ import lombok.AccessLevel; import lombok.Getter; import lombok.NoArgsConstructor; -import server.haengdong.domain.BaseEntity; -import server.haengdong.domain.eventmember.EventMember; +import haengdong.common.domain.BaseEntity; +import haengdong.event.domain.event.member.EventMember; @Getter @NoArgsConstructor(access = AccessLevel.PROTECTED) diff --git a/server/src/main/java/server/haengdong/domain/bill/BillRepository.java b/server/src/main/java/haengdong/event/domain/bill/BillRepository.java similarity index 87% rename from server/src/main/java/server/haengdong/domain/bill/BillRepository.java rename to server/src/main/java/haengdong/event/domain/bill/BillRepository.java index 351d8e656..80b8df959 100644 --- a/server/src/main/java/server/haengdong/domain/bill/BillRepository.java +++ b/server/src/main/java/haengdong/event/domain/bill/BillRepository.java @@ -1,11 +1,11 @@ -package server.haengdong.domain.bill; +package haengdong.event.domain.bill; import java.util.List; import java.util.Optional; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Query; import org.springframework.stereotype.Repository; -import server.haengdong.domain.event.Event; +import haengdong.event.domain.event.Event; @Repository public interface BillRepository extends JpaRepository { diff --git a/server/src/main/java/server/haengdong/domain/bill/MemberBillReport.java b/server/src/main/java/haengdong/event/domain/bill/MemberBillReport.java similarity index 88% rename from server/src/main/java/server/haengdong/domain/bill/MemberBillReport.java rename to server/src/main/java/haengdong/event/domain/bill/MemberBillReport.java index 07a98c804..bced7716d 100644 --- a/server/src/main/java/server/haengdong/domain/bill/MemberBillReport.java +++ b/server/src/main/java/haengdong/event/domain/bill/MemberBillReport.java @@ -1,11 +1,11 @@ -package server.haengdong.domain.bill; +package haengdong.event.domain.bill; import static java.util.stream.Collectors.toMap; import java.util.List; import java.util.Map; import lombok.Getter; -import server.haengdong.domain.eventmember.EventMember; +import haengdong.event.domain.event.member.EventMember; @Getter public class MemberBillReport { diff --git a/server/src/main/java/server/haengdong/domain/event/Event.java b/server/src/main/java/haengdong/event/domain/event/Event.java similarity index 94% rename from server/src/main/java/server/haengdong/domain/event/Event.java rename to server/src/main/java/haengdong/event/domain/event/Event.java index 87cf3a9bd..b06e30f43 100644 --- a/server/src/main/java/server/haengdong/domain/event/Event.java +++ b/server/src/main/java/haengdong/event/domain/event/Event.java @@ -1,5 +1,6 @@ -package server.haengdong.domain.event; +package haengdong.event.domain.event; +import haengdong.user.domain.Bank; import jakarta.persistence.AttributeOverride; import jakarta.persistence.Column; import jakarta.persistence.Embedded; @@ -11,9 +12,9 @@ import lombok.AccessLevel; import lombok.Getter; import lombok.NoArgsConstructor; -import server.haengdong.domain.BaseEntity; -import server.haengdong.exception.HaengdongErrorCode; -import server.haengdong.exception.HaengdongException; +import haengdong.common.domain.BaseEntity; +import haengdong.common.exception.HaengdongErrorCode; +import haengdong.common.exception.HaengdongException; @Getter @NoArgsConstructor(access = AccessLevel.PROTECTED) diff --git a/server/src/main/java/server/haengdong/domain/event/EventRepository.java b/server/src/main/java/haengdong/event/domain/event/EventRepository.java similarity index 89% rename from server/src/main/java/server/haengdong/domain/event/EventRepository.java rename to server/src/main/java/haengdong/event/domain/event/EventRepository.java index 0f85d5274..122fcb732 100644 --- a/server/src/main/java/server/haengdong/domain/event/EventRepository.java +++ b/server/src/main/java/haengdong/event/domain/event/EventRepository.java @@ -1,4 +1,4 @@ -package server.haengdong.domain.event; +package haengdong.event.domain.event; import java.util.Optional; import org.springframework.data.jpa.repository.JpaRepository; diff --git a/server/src/main/java/server/haengdong/domain/event/Password.java b/server/src/main/java/haengdong/event/domain/event/Password.java similarity index 91% rename from server/src/main/java/server/haengdong/domain/event/Password.java rename to server/src/main/java/haengdong/event/domain/event/Password.java index 7c195b5d5..a18405267 100644 --- a/server/src/main/java/server/haengdong/domain/event/Password.java +++ b/server/src/main/java/haengdong/event/domain/event/Password.java @@ -1,4 +1,4 @@ -package server.haengdong.domain.event; +package haengdong.event.domain.event; import jakarta.persistence.Embeddable; import java.security.MessageDigest; @@ -9,8 +9,8 @@ import lombok.AccessLevel; import lombok.Getter; import lombok.NoArgsConstructor; -import server.haengdong.exception.HaengdongErrorCode; -import server.haengdong.exception.HaengdongException; +import haengdong.common.exception.HaengdongErrorCode; +import haengdong.common.exception.HaengdongException; @NoArgsConstructor(access = AccessLevel.PROTECTED) @Getter diff --git a/server/src/main/java/server/haengdong/domain/event/EventImage.java b/server/src/main/java/haengdong/event/domain/event/image/EventImage.java similarity index 87% rename from server/src/main/java/server/haengdong/domain/event/EventImage.java rename to server/src/main/java/haengdong/event/domain/event/image/EventImage.java index 16b2f5964..8d1c615a5 100644 --- a/server/src/main/java/server/haengdong/domain/event/EventImage.java +++ b/server/src/main/java/haengdong/event/domain/event/image/EventImage.java @@ -1,5 +1,6 @@ -package server.haengdong.domain.event; +package haengdong.event.domain.event.image; +import haengdong.event.domain.event.Event; import jakarta.persistence.Column; import jakarta.persistence.Entity; import jakarta.persistence.FetchType; @@ -11,7 +12,7 @@ import lombok.AccessLevel; import lombok.Getter; import lombok.NoArgsConstructor; -import server.haengdong.domain.BaseEntity; +import haengdong.common.domain.BaseEntity; @Getter @NoArgsConstructor(access = AccessLevel.PROTECTED) diff --git a/server/src/main/java/server/haengdong/domain/event/EventImageRepository.java b/server/src/main/java/haengdong/event/domain/event/image/EventImageRepository.java similarity index 82% rename from server/src/main/java/server/haengdong/domain/event/EventImageRepository.java rename to server/src/main/java/haengdong/event/domain/event/image/EventImageRepository.java index 0e00697f1..227c3de63 100644 --- a/server/src/main/java/server/haengdong/domain/event/EventImageRepository.java +++ b/server/src/main/java/haengdong/event/domain/event/image/EventImageRepository.java @@ -1,5 +1,6 @@ -package server.haengdong.domain.event; +package haengdong.event.domain.event.image; +import haengdong.event.domain.event.Event; import java.time.Instant; import java.util.List; import org.springframework.data.jpa.repository.JpaRepository; diff --git a/server/src/main/java/server/haengdong/domain/eventmember/EventMember.java b/server/src/main/java/haengdong/event/domain/event/member/EventMember.java similarity index 86% rename from server/src/main/java/server/haengdong/domain/eventmember/EventMember.java rename to server/src/main/java/haengdong/event/domain/event/member/EventMember.java index f512e7764..379ee4883 100644 --- a/server/src/main/java/server/haengdong/domain/eventmember/EventMember.java +++ b/server/src/main/java/haengdong/event/domain/event/member/EventMember.java @@ -1,4 +1,4 @@ -package server.haengdong.domain.eventmember; +package haengdong.event.domain.event.member; import jakarta.persistence.Column; import jakarta.persistence.Entity; @@ -14,10 +14,10 @@ import lombok.AccessLevel; import lombok.Getter; import lombok.NoArgsConstructor; -import server.haengdong.domain.BaseEntity; -import server.haengdong.domain.event.Event; -import server.haengdong.exception.HaengdongErrorCode; -import server.haengdong.exception.HaengdongException; +import haengdong.common.domain.BaseEntity; +import haengdong.event.domain.event.Event; +import haengdong.common.exception.HaengdongErrorCode; +import haengdong.common.exception.HaengdongException; @Getter @NoArgsConstructor(access = AccessLevel.PROTECTED) @@ -66,6 +66,10 @@ public boolean hasName(String name) { return this.name.equals(name); } + public boolean isSameName(EventMember other) { + return this.name.equals(other.name); + } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/server/src/main/java/server/haengdong/domain/eventmember/EventMemberRepository.java b/server/src/main/java/haengdong/event/domain/event/member/EventMemberRepository.java similarity index 71% rename from server/src/main/java/server/haengdong/domain/eventmember/EventMemberRepository.java rename to server/src/main/java/haengdong/event/domain/event/member/EventMemberRepository.java index a1fc12562..a74e8cede 100644 --- a/server/src/main/java/server/haengdong/domain/eventmember/EventMemberRepository.java +++ b/server/src/main/java/haengdong/event/domain/event/member/EventMemberRepository.java @@ -1,8 +1,8 @@ -package server.haengdong.domain.eventmember; +package haengdong.event.domain.event.member; import java.util.List; import org.springframework.data.jpa.repository.JpaRepository; -import server.haengdong.domain.event.Event; +import haengdong.event.domain.event.Event; public interface EventMemberRepository extends JpaRepository { diff --git a/server/src/main/java/haengdong/event/domain/event/member/EventUniqueMembers.java b/server/src/main/java/haengdong/event/domain/event/member/EventUniqueMembers.java new file mode 100644 index 000000000..934e7c792 --- /dev/null +++ b/server/src/main/java/haengdong/event/domain/event/member/EventUniqueMembers.java @@ -0,0 +1,40 @@ +package haengdong.event.domain.event.member; + +import haengdong.common.exception.HaengdongErrorCode; +import haengdong.common.exception.HaengdongException; +import java.util.List; +import java.util.Set; +import java.util.stream.Collectors; +import lombok.Getter; + +@Getter +public class EventUniqueMembers { + + private final List eventMembers; + + public EventUniqueMembers(List eventMembers) { + validateDuplicateName(eventMembers); + this.eventMembers = eventMembers; + } + + private void validateDuplicateName(List eventMembers) { + Set uniqueNames = eventMembers.stream() + .map(EventMember::getName) + .distinct() + .collect(Collectors.toSet()); + + if (eventMembers.size() != uniqueNames.size()) { + throw new HaengdongException(HaengdongErrorCode.MEMBER_NAME_DUPLICATE); + } + } + + public boolean containName(List others) { + return others.stream() + .anyMatch(this::containName); + } + + private boolean containName(EventMember other) { + return eventMembers.stream() + .anyMatch(member -> member.isSameName(other)); + } +} diff --git a/server/src/main/java/server/haengdong/domain/eventmember/UpdatedMembers.java b/server/src/main/java/haengdong/event/domain/event/member/UpdatedMembers.java similarity index 93% rename from server/src/main/java/server/haengdong/domain/eventmember/UpdatedMembers.java rename to server/src/main/java/haengdong/event/domain/event/member/UpdatedMembers.java index f4b88af9d..31a989d5e 100644 --- a/server/src/main/java/server/haengdong/domain/eventmember/UpdatedMembers.java +++ b/server/src/main/java/haengdong/event/domain/event/member/UpdatedMembers.java @@ -1,11 +1,11 @@ -package server.haengdong.domain.eventmember; +package haengdong.event.domain.event.member; import java.util.HashSet; import java.util.List; import java.util.Set; import java.util.stream.Collectors; -import server.haengdong.exception.HaengdongErrorCode; -import server.haengdong.exception.HaengdongException; +import haengdong.common.exception.HaengdongErrorCode; +import haengdong.common.exception.HaengdongException; public class UpdatedMembers { diff --git a/server/src/main/java/server/haengdong/domain/step/Step.java b/server/src/main/java/haengdong/event/domain/step/Step.java similarity index 82% rename from server/src/main/java/server/haengdong/domain/step/Step.java rename to server/src/main/java/haengdong/event/domain/step/Step.java index ed82d2ee4..06ce56577 100644 --- a/server/src/main/java/server/haengdong/domain/step/Step.java +++ b/server/src/main/java/haengdong/event/domain/step/Step.java @@ -1,13 +1,13 @@ -package server.haengdong.domain.step; +package haengdong.event.domain.step; import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Set; -import server.haengdong.domain.bill.Bill; -import server.haengdong.domain.eventmember.EventMember; -import server.haengdong.exception.HaengdongErrorCode; -import server.haengdong.exception.HaengdongException; +import haengdong.event.domain.bill.Bill; +import haengdong.event.domain.event.member.EventMember; +import haengdong.common.exception.HaengdongErrorCode; +import haengdong.common.exception.HaengdongException; public class Step { diff --git a/server/src/main/java/server/haengdong/domain/step/Steps.java b/server/src/main/java/haengdong/event/domain/step/Steps.java similarity index 89% rename from server/src/main/java/server/haengdong/domain/step/Steps.java rename to server/src/main/java/haengdong/event/domain/step/Steps.java index f1ad8c746..c15bc9414 100644 --- a/server/src/main/java/server/haengdong/domain/step/Steps.java +++ b/server/src/main/java/haengdong/event/domain/step/Steps.java @@ -1,8 +1,8 @@ -package server.haengdong.domain.step; +package haengdong.event.domain.step; import java.util.ArrayList; import java.util.List; -import server.haengdong.domain.bill.Bill; +import haengdong.event.domain.bill.Bill; public class Steps { diff --git a/server/src/main/java/server/haengdong/infrastructure/UUIDProvider.java b/server/src/main/java/haengdong/event/infrastructure/UUIDProvider.java similarity index 71% rename from server/src/main/java/server/haengdong/infrastructure/UUIDProvider.java rename to server/src/main/java/haengdong/event/infrastructure/UUIDProvider.java index 39a97cadb..e2e34f46b 100644 --- a/server/src/main/java/server/haengdong/infrastructure/UUIDProvider.java +++ b/server/src/main/java/haengdong/event/infrastructure/UUIDProvider.java @@ -1,8 +1,8 @@ -package server.haengdong.infrastructure; +package haengdong.event.infrastructure; import java.util.UUID; import org.springframework.stereotype.Component; -import server.haengdong.domain.RandomValueProvider; +import haengdong.event.domain.RandomValueProvider; @Component public class UUIDProvider implements RandomValueProvider { diff --git a/server/src/main/java/server/haengdong/presentation/BillController.java b/server/src/main/java/haengdong/event/presentation/BillController.java similarity index 79% rename from server/src/main/java/server/haengdong/presentation/BillController.java rename to server/src/main/java/haengdong/event/presentation/BillController.java index f1a4f74f4..5ea9bd9ac 100644 --- a/server/src/main/java/server/haengdong/presentation/BillController.java +++ b/server/src/main/java/haengdong/event/presentation/BillController.java @@ -1,14 +1,14 @@ -package server.haengdong.presentation; +package haengdong.event.presentation; import lombok.RequiredArgsConstructor; 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.RestController; -import server.haengdong.application.BillService; -import server.haengdong.application.response.BillDetailsAppResponse; -import server.haengdong.presentation.response.BillDetailsResponse; -import server.haengdong.presentation.response.StepsResponse; +import haengdong.event.application.BillService; +import haengdong.event.application.response.BillDetailsAppResponse; +import haengdong.event.presentation.response.BillDetailsResponse; +import haengdong.event.presentation.response.StepsResponse; @RequiredArgsConstructor @RestController diff --git a/server/src/main/java/server/haengdong/presentation/EventController.java b/server/src/main/java/haengdong/event/presentation/EventController.java similarity index 78% rename from server/src/main/java/server/haengdong/presentation/EventController.java rename to server/src/main/java/haengdong/event/presentation/EventController.java index 326eafd5a..64cfe927f 100644 --- a/server/src/main/java/server/haengdong/presentation/EventController.java +++ b/server/src/main/java/haengdong/event/presentation/EventController.java @@ -1,5 +1,18 @@ -package server.haengdong.presentation; +package haengdong.event.presentation; +import haengdong.common.auth.application.AuthService; +import haengdong.common.properties.CookieProperties; +import haengdong.event.application.EventImageFacadeService; +import haengdong.event.application.EventService; +import haengdong.event.application.response.EventAppResponse; +import haengdong.event.application.response.EventImageUrlAppResponse; +import haengdong.event.application.response.MemberBillReportAppResponse; +import haengdong.event.presentation.request.EventGuestSaveRequest; +import haengdong.event.presentation.request.EventLoginRequest; +import haengdong.event.presentation.response.EventDetailResponse; +import haengdong.event.presentation.response.EventImagesResponse; +import haengdong.event.presentation.response.EventResponse; +import haengdong.event.presentation.response.MemberBillReportsResponse; import jakarta.validation.Valid; import java.util.List; import lombok.RequiredArgsConstructor; @@ -13,18 +26,6 @@ import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RestController; -import server.haengdong.application.AuthService; -import server.haengdong.application.EventService; -import server.haengdong.application.response.EventAppResponse; -import server.haengdong.application.response.EventImageAppResponse; -import server.haengdong.application.response.MemberBillReportAppResponse; -import server.haengdong.infrastructure.auth.CookieProperties; -import server.haengdong.presentation.request.EventGuestSaveRequest; -import server.haengdong.presentation.request.EventLoginRequest; -import server.haengdong.presentation.response.EventDetailResponse; -import server.haengdong.presentation.response.EventImagesResponse; -import server.haengdong.presentation.response.EventResponse; -import server.haengdong.presentation.response.MemberBillReportsResponse; @Slf4j @RequiredArgsConstructor @@ -35,6 +36,7 @@ public class EventController { private final EventService eventService; private final AuthService authService; private final CookieProperties cookieProperties; + private final EventImageFacadeService eventImageFacadeService; @GetMapping("/api/events/{eventId}") public ResponseEntity findEvent(@PathVariable("eventId") String token) { @@ -91,7 +93,7 @@ private ResponseCookie createResponseCookie(String token) { @GetMapping("/api/events/{eventId}/images") public ResponseEntity findAllImages(@PathVariable("eventId") String token) { - List images = eventService.findImages(token); + List images = eventImageFacadeService.findImages(token); return ResponseEntity.ok(EventImagesResponse.of(images)); } diff --git a/server/src/main/java/server/haengdong/presentation/EventMemberController.java b/server/src/main/java/haengdong/event/presentation/EventMemberController.java similarity index 79% rename from server/src/main/java/server/haengdong/presentation/EventMemberController.java rename to server/src/main/java/haengdong/event/presentation/EventMemberController.java index 08d3af273..09d5558bd 100644 --- a/server/src/main/java/server/haengdong/presentation/EventMemberController.java +++ b/server/src/main/java/haengdong/event/presentation/EventMemberController.java @@ -1,4 +1,4 @@ -package server.haengdong.presentation; +package haengdong.event.presentation; import java.util.List; import lombok.RequiredArgsConstructor; @@ -7,10 +7,10 @@ import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RestController; -import server.haengdong.application.EventMemberService; -import server.haengdong.application.response.MemberAppResponse; -import server.haengdong.presentation.response.CurrentMembersResponse; -import server.haengdong.presentation.response.MembersResponse; +import haengdong.event.application.EventMemberService; +import haengdong.event.application.response.MemberAppResponse; +import haengdong.event.presentation.response.CurrentMembersResponse; +import haengdong.event.presentation.response.MembersResponse; @Slf4j @RequiredArgsConstructor diff --git a/server/src/main/java/server/haengdong/presentation/admin/AdminBillController.java b/server/src/main/java/haengdong/event/presentation/admin/AdminBillController.java similarity index 87% rename from server/src/main/java/server/haengdong/presentation/admin/AdminBillController.java rename to server/src/main/java/haengdong/event/presentation/admin/AdminBillController.java index 5e65c04f9..bea39a868 100644 --- a/server/src/main/java/server/haengdong/presentation/admin/AdminBillController.java +++ b/server/src/main/java/haengdong/event/presentation/admin/AdminBillController.java @@ -1,4 +1,4 @@ -package server.haengdong.presentation.admin; +package haengdong.event.presentation.admin; import jakarta.validation.Valid; import lombok.RequiredArgsConstructor; @@ -9,10 +9,10 @@ import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RestController; -import server.haengdong.application.BillService; -import server.haengdong.presentation.request.BillDetailsUpdateRequest; -import server.haengdong.presentation.request.BillSaveRequest; -import server.haengdong.presentation.request.BillUpdateRequest; +import haengdong.event.application.BillService; +import haengdong.event.presentation.request.BillDetailsUpdateRequest; +import haengdong.event.presentation.request.BillSaveRequest; +import haengdong.event.presentation.request.BillUpdateRequest; @RequiredArgsConstructor @RestController diff --git a/server/src/main/java/server/haengdong/presentation/admin/AdminEventController.java b/server/src/main/java/haengdong/event/presentation/admin/AdminEventController.java similarity index 84% rename from server/src/main/java/server/haengdong/presentation/admin/AdminEventController.java rename to server/src/main/java/haengdong/event/presentation/admin/AdminEventController.java index 2dd84d449..83e6f3d95 100644 --- a/server/src/main/java/server/haengdong/presentation/admin/AdminEventController.java +++ b/server/src/main/java/haengdong/event/presentation/admin/AdminEventController.java @@ -1,4 +1,4 @@ -package server.haengdong.presentation.admin; +package haengdong.event.presentation.admin; import jakarta.validation.Valid; import java.util.List; @@ -13,13 +13,13 @@ import org.springframework.web.bind.annotation.RequestPart; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.multipart.MultipartFile; -import server.haengdong.application.EventImageFacadeService; -import server.haengdong.application.EventService; -import server.haengdong.application.request.EventAppRequest; -import server.haengdong.config.Login; -import server.haengdong.presentation.request.EventSaveRequest; -import server.haengdong.presentation.request.EventUpdateRequest; -import server.haengdong.presentation.response.EventResponse; +import haengdong.event.application.EventImageFacadeService; +import haengdong.event.application.EventService; +import haengdong.event.application.request.EventAppRequest; +import haengdong.common.auth.Login; +import haengdong.event.presentation.request.EventSaveRequest; +import haengdong.event.presentation.request.EventUpdateRequest; +import haengdong.event.presentation.response.EventResponse; @Slf4j @RequiredArgsConstructor diff --git a/server/src/main/java/server/haengdong/presentation/admin/AdminMemberController.java b/server/src/main/java/haengdong/event/presentation/admin/AdminMemberController.java similarity index 82% rename from server/src/main/java/server/haengdong/presentation/admin/AdminMemberController.java rename to server/src/main/java/haengdong/event/presentation/admin/AdminMemberController.java index be7c3c3c5..37350c39d 100644 --- a/server/src/main/java/server/haengdong/presentation/admin/AdminMemberController.java +++ b/server/src/main/java/haengdong/event/presentation/admin/AdminMemberController.java @@ -1,4 +1,4 @@ -package server.haengdong.presentation.admin; +package haengdong.event.presentation.admin; import jakarta.validation.Valid; import lombok.RequiredArgsConstructor; @@ -10,11 +10,11 @@ import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RestController; -import server.haengdong.application.EventMemberService; -import server.haengdong.application.response.MembersSaveAppResponse; -import server.haengdong.presentation.request.MembersSaveRequest; -import server.haengdong.presentation.request.MembersUpdateRequest; -import server.haengdong.presentation.response.MembersSaveResponse; +import haengdong.event.application.EventMemberService; +import haengdong.event.application.response.MembersSaveAppResponse; +import haengdong.event.presentation.request.MembersSaveRequest; +import haengdong.event.presentation.request.MembersUpdateRequest; +import haengdong.event.presentation.response.MembersSaveResponse; @Slf4j @RequiredArgsConstructor diff --git a/server/src/main/java/server/haengdong/presentation/request/BillDetailUpdateRequest.java b/server/src/main/java/haengdong/event/presentation/request/BillDetailUpdateRequest.java similarity index 79% rename from server/src/main/java/server/haengdong/presentation/request/BillDetailUpdateRequest.java rename to server/src/main/java/haengdong/event/presentation/request/BillDetailUpdateRequest.java index d0f69b148..5a4dfcf5f 100644 --- a/server/src/main/java/server/haengdong/presentation/request/BillDetailUpdateRequest.java +++ b/server/src/main/java/haengdong/event/presentation/request/BillDetailUpdateRequest.java @@ -1,7 +1,7 @@ -package server.haengdong.presentation.request; +package haengdong.event.presentation.request; import jakarta.validation.constraints.NotNull; -import server.haengdong.application.request.BillDetailUpdateAppRequest; +import haengdong.event.application.request.BillDetailUpdateAppRequest; public record BillDetailUpdateRequest( diff --git a/server/src/main/java/server/haengdong/presentation/request/BillDetailsUpdateRequest.java b/server/src/main/java/haengdong/event/presentation/request/BillDetailsUpdateRequest.java similarity index 79% rename from server/src/main/java/server/haengdong/presentation/request/BillDetailsUpdateRequest.java rename to server/src/main/java/haengdong/event/presentation/request/BillDetailsUpdateRequest.java index 091db5967..ac70f3573 100644 --- a/server/src/main/java/server/haengdong/presentation/request/BillDetailsUpdateRequest.java +++ b/server/src/main/java/haengdong/event/presentation/request/BillDetailsUpdateRequest.java @@ -1,9 +1,9 @@ -package server.haengdong.presentation.request; +package haengdong.event.presentation.request; import jakarta.validation.Valid; import jakarta.validation.constraints.NotEmpty; import java.util.List; -import server.haengdong.application.request.BillDetailsUpdateAppRequest; +import haengdong.event.application.request.BillDetailsUpdateAppRequest; public record BillDetailsUpdateRequest( diff --git a/server/src/main/java/server/haengdong/presentation/request/BillSaveRequest.java b/server/src/main/java/haengdong/event/presentation/request/BillSaveRequest.java similarity index 84% rename from server/src/main/java/server/haengdong/presentation/request/BillSaveRequest.java rename to server/src/main/java/haengdong/event/presentation/request/BillSaveRequest.java index 1a7365a6e..1fe4367a6 100644 --- a/server/src/main/java/server/haengdong/presentation/request/BillSaveRequest.java +++ b/server/src/main/java/haengdong/event/presentation/request/BillSaveRequest.java @@ -1,10 +1,10 @@ -package server.haengdong.presentation.request; +package haengdong.event.presentation.request; import jakarta.validation.constraints.NotBlank; import jakarta.validation.constraints.NotEmpty; import jakarta.validation.constraints.NotNull; import java.util.List; -import server.haengdong.application.request.BillAppRequest; +import haengdong.event.application.request.BillAppRequest; public record BillSaveRequest( diff --git a/server/src/main/java/server/haengdong/presentation/request/BillUpdateRequest.java b/server/src/main/java/haengdong/event/presentation/request/BillUpdateRequest.java similarity index 79% rename from server/src/main/java/server/haengdong/presentation/request/BillUpdateRequest.java rename to server/src/main/java/haengdong/event/presentation/request/BillUpdateRequest.java index d5ea67474..eb65578f1 100644 --- a/server/src/main/java/server/haengdong/presentation/request/BillUpdateRequest.java +++ b/server/src/main/java/haengdong/event/presentation/request/BillUpdateRequest.java @@ -1,8 +1,8 @@ -package server.haengdong.presentation.request; +package haengdong.event.presentation.request; import jakarta.validation.constraints.NotBlank; import jakarta.validation.constraints.NotNull; -import server.haengdong.application.request.BillUpdateAppRequest; +import haengdong.event.application.request.BillUpdateAppRequest; public record BillUpdateRequest( diff --git a/server/src/main/java/server/haengdong/presentation/request/EventGuestSaveRequest.java b/server/src/main/java/haengdong/event/presentation/request/EventGuestSaveRequest.java similarity index 82% rename from server/src/main/java/server/haengdong/presentation/request/EventGuestSaveRequest.java rename to server/src/main/java/haengdong/event/presentation/request/EventGuestSaveRequest.java index 3354e6cb4..27a613308 100644 --- a/server/src/main/java/server/haengdong/presentation/request/EventGuestSaveRequest.java +++ b/server/src/main/java/haengdong/event/presentation/request/EventGuestSaveRequest.java @@ -1,7 +1,7 @@ -package server.haengdong.presentation.request; +package haengdong.event.presentation.request; import jakarta.validation.constraints.NotBlank; -import server.haengdong.application.request.EventGuestAppRequest; +import haengdong.event.application.request.EventGuestAppRequest; public record EventGuestSaveRequest( diff --git a/server/src/main/java/server/haengdong/presentation/request/EventLoginRequest.java b/server/src/main/java/haengdong/event/presentation/request/EventLoginRequest.java similarity index 73% rename from server/src/main/java/server/haengdong/presentation/request/EventLoginRequest.java rename to server/src/main/java/haengdong/event/presentation/request/EventLoginRequest.java index d49a0e510..43a0dfa6d 100644 --- a/server/src/main/java/server/haengdong/presentation/request/EventLoginRequest.java +++ b/server/src/main/java/haengdong/event/presentation/request/EventLoginRequest.java @@ -1,7 +1,7 @@ -package server.haengdong.presentation.request; +package haengdong.event.presentation.request; import jakarta.validation.constraints.NotBlank; -import server.haengdong.application.request.EventLoginAppRequest; +import haengdong.event.application.request.EventLoginAppRequest; public record EventLoginRequest( diff --git a/server/src/main/java/server/haengdong/presentation/request/EventSaveRequest.java b/server/src/main/java/haengdong/event/presentation/request/EventSaveRequest.java similarity index 80% rename from server/src/main/java/server/haengdong/presentation/request/EventSaveRequest.java rename to server/src/main/java/haengdong/event/presentation/request/EventSaveRequest.java index e50e8a44f..8447b3d6f 100644 --- a/server/src/main/java/server/haengdong/presentation/request/EventSaveRequest.java +++ b/server/src/main/java/haengdong/event/presentation/request/EventSaveRequest.java @@ -1,4 +1,4 @@ -package server.haengdong.presentation.request; +package haengdong.event.presentation.request; import jakarta.validation.constraints.NotBlank; diff --git a/server/src/main/java/server/haengdong/presentation/request/EventUpdateRequest.java b/server/src/main/java/haengdong/event/presentation/request/EventUpdateRequest.java similarity index 69% rename from server/src/main/java/server/haengdong/presentation/request/EventUpdateRequest.java rename to server/src/main/java/haengdong/event/presentation/request/EventUpdateRequest.java index cafd12ea6..980809a22 100644 --- a/server/src/main/java/server/haengdong/presentation/request/EventUpdateRequest.java +++ b/server/src/main/java/haengdong/event/presentation/request/EventUpdateRequest.java @@ -1,6 +1,6 @@ -package server.haengdong.presentation.request; +package haengdong.event.presentation.request; -import server.haengdong.application.request.EventUpdateAppRequest; +import haengdong.event.application.request.EventUpdateAppRequest; public record EventUpdateRequest( String eventName, diff --git a/server/src/main/java/server/haengdong/presentation/request/MemberSaveRequest.java b/server/src/main/java/haengdong/event/presentation/request/MemberSaveRequest.java similarity index 80% rename from server/src/main/java/server/haengdong/presentation/request/MemberSaveRequest.java rename to server/src/main/java/haengdong/event/presentation/request/MemberSaveRequest.java index 8b763be09..e400c48a0 100644 --- a/server/src/main/java/server/haengdong/presentation/request/MemberSaveRequest.java +++ b/server/src/main/java/haengdong/event/presentation/request/MemberSaveRequest.java @@ -1,4 +1,4 @@ -package server.haengdong.presentation.request; +package haengdong.event.presentation.request; import jakarta.validation.constraints.NotBlank; diff --git a/server/src/main/java/server/haengdong/presentation/request/MemberUpdateRequest.java b/server/src/main/java/haengdong/event/presentation/request/MemberUpdateRequest.java similarity index 82% rename from server/src/main/java/server/haengdong/presentation/request/MemberUpdateRequest.java rename to server/src/main/java/haengdong/event/presentation/request/MemberUpdateRequest.java index 1f3bfe95a..971488d6f 100644 --- a/server/src/main/java/server/haengdong/presentation/request/MemberUpdateRequest.java +++ b/server/src/main/java/haengdong/event/presentation/request/MemberUpdateRequest.java @@ -1,8 +1,8 @@ -package server.haengdong.presentation.request; +package haengdong.event.presentation.request; import jakarta.validation.constraints.NotBlank; import jakarta.validation.constraints.NotNull; -import server.haengdong.application.request.MemberUpdateAppRequest; +import haengdong.event.application.request.MemberUpdateAppRequest; public record MemberUpdateRequest( diff --git a/server/src/main/java/server/haengdong/presentation/request/MembersSaveRequest.java b/server/src/main/java/haengdong/event/presentation/request/MembersSaveRequest.java similarity index 64% rename from server/src/main/java/server/haengdong/presentation/request/MembersSaveRequest.java rename to server/src/main/java/haengdong/event/presentation/request/MembersSaveRequest.java index cc611742a..cea642ab7 100644 --- a/server/src/main/java/server/haengdong/presentation/request/MembersSaveRequest.java +++ b/server/src/main/java/haengdong/event/presentation/request/MembersSaveRequest.java @@ -1,8 +1,8 @@ -package server.haengdong.presentation.request; +package haengdong.event.presentation.request; import java.util.List; -import server.haengdong.application.request.MemberSaveAppRequest; -import server.haengdong.application.request.MembersSaveAppRequest; +import haengdong.event.application.request.MemberSaveAppRequest; +import haengdong.event.application.request.MembersSaveAppRequest; public record MembersSaveRequest( List members diff --git a/server/src/main/java/server/haengdong/presentation/request/MembersUpdateRequest.java b/server/src/main/java/haengdong/event/presentation/request/MembersUpdateRequest.java similarity index 78% rename from server/src/main/java/server/haengdong/presentation/request/MembersUpdateRequest.java rename to server/src/main/java/haengdong/event/presentation/request/MembersUpdateRequest.java index db3715130..0b7608ddb 100644 --- a/server/src/main/java/server/haengdong/presentation/request/MembersUpdateRequest.java +++ b/server/src/main/java/haengdong/event/presentation/request/MembersUpdateRequest.java @@ -1,9 +1,9 @@ -package server.haengdong.presentation.request; +package haengdong.event.presentation.request; import jakarta.validation.Valid; import jakarta.validation.constraints.NotNull; import java.util.List; -import server.haengdong.application.request.MembersUpdateAppRequest; +import haengdong.event.application.request.MembersUpdateAppRequest; public record MembersUpdateRequest( diff --git a/server/src/main/java/server/haengdong/presentation/response/BillDetailResponse.java b/server/src/main/java/haengdong/event/presentation/response/BillDetailResponse.java similarity index 80% rename from server/src/main/java/server/haengdong/presentation/response/BillDetailResponse.java rename to server/src/main/java/haengdong/event/presentation/response/BillDetailResponse.java index 9ff993b8a..c20b02525 100644 --- a/server/src/main/java/server/haengdong/presentation/response/BillDetailResponse.java +++ b/server/src/main/java/haengdong/event/presentation/response/BillDetailResponse.java @@ -1,6 +1,6 @@ -package server.haengdong.presentation.response; +package haengdong.event.presentation.response; -import server.haengdong.application.response.BillDetailAppResponse; +import haengdong.event.application.response.BillDetailAppResponse; public record BillDetailResponse( Long id, diff --git a/server/src/main/java/server/haengdong/presentation/response/BillDetailsResponse.java b/server/src/main/java/haengdong/event/presentation/response/BillDetailsResponse.java similarity index 79% rename from server/src/main/java/server/haengdong/presentation/response/BillDetailsResponse.java rename to server/src/main/java/haengdong/event/presentation/response/BillDetailsResponse.java index 888b0160d..998eec2b3 100644 --- a/server/src/main/java/server/haengdong/presentation/response/BillDetailsResponse.java +++ b/server/src/main/java/haengdong/event/presentation/response/BillDetailsResponse.java @@ -1,8 +1,8 @@ -package server.haengdong.presentation.response; +package haengdong.event.presentation.response; import java.util.List; import java.util.stream.Collectors; -import server.haengdong.application.response.BillDetailsAppResponse; +import haengdong.event.application.response.BillDetailsAppResponse; public record BillDetailsResponse( List members diff --git a/server/src/main/java/server/haengdong/presentation/response/BillResponse.java b/server/src/main/java/haengdong/event/presentation/response/BillResponse.java similarity index 72% rename from server/src/main/java/server/haengdong/presentation/response/BillResponse.java rename to server/src/main/java/haengdong/event/presentation/response/BillResponse.java index 0f3aaeaa0..c85c7e4d2 100644 --- a/server/src/main/java/server/haengdong/presentation/response/BillResponse.java +++ b/server/src/main/java/haengdong/event/presentation/response/BillResponse.java @@ -1,6 +1,6 @@ -package server.haengdong.presentation.response; +package haengdong.event.presentation.response; -import server.haengdong.application.response.BillAppResponse; +import haengdong.event.application.response.BillAppResponse; public record BillResponse( Long id, diff --git a/server/src/main/java/server/haengdong/presentation/response/CurrentMembersResponse.java b/server/src/main/java/haengdong/event/presentation/response/CurrentMembersResponse.java similarity index 67% rename from server/src/main/java/server/haengdong/presentation/response/CurrentMembersResponse.java rename to server/src/main/java/haengdong/event/presentation/response/CurrentMembersResponse.java index b1fe5720b..1ed19888d 100644 --- a/server/src/main/java/server/haengdong/presentation/response/CurrentMembersResponse.java +++ b/server/src/main/java/haengdong/event/presentation/response/CurrentMembersResponse.java @@ -1,8 +1,7 @@ -package server.haengdong.presentation.response; +package haengdong.event.presentation.response; import java.util.List; -import server.haengdong.application.response.LastBillMemberAppResponse; -import server.haengdong.application.response.MemberAppResponse; +import haengdong.event.application.response.MemberAppResponse; public record CurrentMembersResponse(List members) { diff --git a/server/src/main/java/server/haengdong/presentation/response/EventDetailResponse.java b/server/src/main/java/haengdong/event/presentation/response/EventDetailResponse.java similarity index 72% rename from server/src/main/java/server/haengdong/presentation/response/EventDetailResponse.java rename to server/src/main/java/haengdong/event/presentation/response/EventDetailResponse.java index e5421940c..567528e34 100644 --- a/server/src/main/java/server/haengdong/presentation/response/EventDetailResponse.java +++ b/server/src/main/java/haengdong/event/presentation/response/EventDetailResponse.java @@ -1,6 +1,6 @@ -package server.haengdong.presentation.response; +package haengdong.event.presentation.response; -import server.haengdong.application.response.EventDetailAppResponse; +import haengdong.event.application.response.EventDetailAppResponse; public record EventDetailResponse( String eventName, diff --git a/server/src/main/java/haengdong/event/presentation/response/EventImageResponse.java b/server/src/main/java/haengdong/event/presentation/response/EventImageResponse.java new file mode 100644 index 000000000..3a8b4c5e2 --- /dev/null +++ b/server/src/main/java/haengdong/event/presentation/response/EventImageResponse.java @@ -0,0 +1,13 @@ +package haengdong.event.presentation.response; + +import haengdong.event.application.response.EventImageUrlAppResponse; + +public record EventImageResponse( + Long id, + String url +) { + + public static EventImageResponse of(EventImageUrlAppResponse response) { + return new EventImageResponse(response.id(), response.url()); + } +} diff --git a/server/src/main/java/server/haengdong/presentation/response/EventImagesResponse.java b/server/src/main/java/haengdong/event/presentation/response/EventImagesResponse.java similarity index 58% rename from server/src/main/java/server/haengdong/presentation/response/EventImagesResponse.java rename to server/src/main/java/haengdong/event/presentation/response/EventImagesResponse.java index d5c2b0ab8..2addc2e55 100644 --- a/server/src/main/java/server/haengdong/presentation/response/EventImagesResponse.java +++ b/server/src/main/java/haengdong/event/presentation/response/EventImagesResponse.java @@ -1,11 +1,11 @@ -package server.haengdong.presentation.response; +package haengdong.event.presentation.response; +import haengdong.event.application.response.EventImageUrlAppResponse; import java.util.List; -import server.haengdong.application.response.EventImageAppResponse; public record EventImagesResponse(List images) { - public static EventImagesResponse of(List responses) { + public static EventImagesResponse of(List responses) { List images = responses.stream() .map(EventImageResponse::of) .toList(); diff --git a/server/src/main/java/server/haengdong/presentation/response/EventResponse.java b/server/src/main/java/haengdong/event/presentation/response/EventResponse.java similarity index 63% rename from server/src/main/java/server/haengdong/presentation/response/EventResponse.java rename to server/src/main/java/haengdong/event/presentation/response/EventResponse.java index 506f5e814..2f02454b9 100644 --- a/server/src/main/java/server/haengdong/presentation/response/EventResponse.java +++ b/server/src/main/java/haengdong/event/presentation/response/EventResponse.java @@ -1,6 +1,6 @@ -package server.haengdong.presentation.response; +package haengdong.event.presentation.response; -import server.haengdong.application.response.EventAppResponse; +import haengdong.event.application.response.EventAppResponse; public record EventResponse(String eventId) { diff --git a/server/src/main/java/server/haengdong/presentation/response/MemberBillReportResponse.java b/server/src/main/java/haengdong/event/presentation/response/MemberBillReportResponse.java similarity index 81% rename from server/src/main/java/server/haengdong/presentation/response/MemberBillReportResponse.java rename to server/src/main/java/haengdong/event/presentation/response/MemberBillReportResponse.java index 1ab22b83e..a0d4d7370 100644 --- a/server/src/main/java/server/haengdong/presentation/response/MemberBillReportResponse.java +++ b/server/src/main/java/haengdong/event/presentation/response/MemberBillReportResponse.java @@ -1,6 +1,6 @@ -package server.haengdong.presentation.response; +package haengdong.event.presentation.response; -import server.haengdong.application.response.MemberBillReportAppResponse; +import haengdong.event.application.response.MemberBillReportAppResponse; public record MemberBillReportResponse( Long memberId, diff --git a/server/src/main/java/server/haengdong/presentation/response/MemberBillReportsResponse.java b/server/src/main/java/haengdong/event/presentation/response/MemberBillReportsResponse.java similarity index 77% rename from server/src/main/java/server/haengdong/presentation/response/MemberBillReportsResponse.java rename to server/src/main/java/haengdong/event/presentation/response/MemberBillReportsResponse.java index d350c4009..28f44d69a 100644 --- a/server/src/main/java/server/haengdong/presentation/response/MemberBillReportsResponse.java +++ b/server/src/main/java/haengdong/event/presentation/response/MemberBillReportsResponse.java @@ -1,7 +1,7 @@ -package server.haengdong.presentation.response; +package haengdong.event.presentation.response; import java.util.List; -import server.haengdong.application.response.MemberBillReportAppResponse; +import haengdong.event.application.response.MemberBillReportAppResponse; public record MemberBillReportsResponse(List reports) { diff --git a/server/src/main/java/server/haengdong/presentation/response/MemberDepositResponse.java b/server/src/main/java/haengdong/event/presentation/response/MemberDepositResponse.java similarity index 71% rename from server/src/main/java/server/haengdong/presentation/response/MemberDepositResponse.java rename to server/src/main/java/haengdong/event/presentation/response/MemberDepositResponse.java index 26699bc72..e54687db7 100644 --- a/server/src/main/java/server/haengdong/presentation/response/MemberDepositResponse.java +++ b/server/src/main/java/haengdong/event/presentation/response/MemberDepositResponse.java @@ -1,6 +1,6 @@ -package server.haengdong.presentation.response; +package haengdong.event.presentation.response; -import server.haengdong.application.response.MemberDepositAppResponse; +import haengdong.event.application.response.MemberDepositAppResponse; public record MemberDepositResponse( Long id, diff --git a/server/src/main/java/server/haengdong/presentation/response/MemberResponse.java b/server/src/main/java/haengdong/event/presentation/response/MemberResponse.java similarity index 66% rename from server/src/main/java/server/haengdong/presentation/response/MemberResponse.java rename to server/src/main/java/haengdong/event/presentation/response/MemberResponse.java index 6b43d72ee..d96b58e4e 100644 --- a/server/src/main/java/server/haengdong/presentation/response/MemberResponse.java +++ b/server/src/main/java/haengdong/event/presentation/response/MemberResponse.java @@ -1,7 +1,7 @@ -package server.haengdong.presentation.response; +package haengdong.event.presentation.response; -import server.haengdong.application.response.LastBillMemberAppResponse; -import server.haengdong.application.response.MemberAppResponse; +import haengdong.event.application.response.LastBillMemberAppResponse; +import haengdong.event.application.response.MemberAppResponse; public record MemberResponse( Long id, diff --git a/server/src/main/java/server/haengdong/presentation/response/MemberSaveResponse.java b/server/src/main/java/haengdong/event/presentation/response/MemberSaveResponse.java similarity index 66% rename from server/src/main/java/server/haengdong/presentation/response/MemberSaveResponse.java rename to server/src/main/java/haengdong/event/presentation/response/MemberSaveResponse.java index 21a7e7969..61fb7e080 100644 --- a/server/src/main/java/server/haengdong/presentation/response/MemberSaveResponse.java +++ b/server/src/main/java/haengdong/event/presentation/response/MemberSaveResponse.java @@ -1,6 +1,6 @@ -package server.haengdong.presentation.response; +package haengdong.event.presentation.response; -import server.haengdong.application.response.MemberSaveAppResponse; +import haengdong.event.application.response.MemberSaveAppResponse; public record MemberSaveResponse( Long id, diff --git a/server/src/main/java/server/haengdong/presentation/response/MembersResponse.java b/server/src/main/java/haengdong/event/presentation/response/MembersResponse.java similarity index 64% rename from server/src/main/java/server/haengdong/presentation/response/MembersResponse.java rename to server/src/main/java/haengdong/event/presentation/response/MembersResponse.java index 333428761..99efb61e4 100644 --- a/server/src/main/java/server/haengdong/presentation/response/MembersResponse.java +++ b/server/src/main/java/haengdong/event/presentation/response/MembersResponse.java @@ -1,8 +1,7 @@ -package server.haengdong.presentation.response; +package haengdong.event.presentation.response; import java.util.List; -import server.haengdong.application.response.MemberDepositAppResponse; -import server.haengdong.application.response.MembersDepositAppResponse; +import haengdong.event.application.response.MembersDepositAppResponse; public record MembersResponse( List members diff --git a/server/src/main/java/server/haengdong/presentation/response/MembersSaveResponse.java b/server/src/main/java/haengdong/event/presentation/response/MembersSaveResponse.java similarity index 76% rename from server/src/main/java/server/haengdong/presentation/response/MembersSaveResponse.java rename to server/src/main/java/haengdong/event/presentation/response/MembersSaveResponse.java index d4b7ad456..4fddd814f 100644 --- a/server/src/main/java/server/haengdong/presentation/response/MembersSaveResponse.java +++ b/server/src/main/java/haengdong/event/presentation/response/MembersSaveResponse.java @@ -1,7 +1,7 @@ -package server.haengdong.presentation.response; +package haengdong.event.presentation.response; import java.util.List; -import server.haengdong.application.response.MembersSaveAppResponse; +import haengdong.event.application.response.MembersSaveAppResponse; public record MembersSaveResponse( List members diff --git a/server/src/main/java/server/haengdong/presentation/response/StepResponse.java b/server/src/main/java/haengdong/event/presentation/response/StepResponse.java similarity index 82% rename from server/src/main/java/server/haengdong/presentation/response/StepResponse.java rename to server/src/main/java/haengdong/event/presentation/response/StepResponse.java index a164e71f5..6a7293462 100644 --- a/server/src/main/java/server/haengdong/presentation/response/StepResponse.java +++ b/server/src/main/java/haengdong/event/presentation/response/StepResponse.java @@ -1,7 +1,7 @@ -package server.haengdong.presentation.response; +package haengdong.event.presentation.response; import java.util.List; -import server.haengdong.application.response.StepAppResponse; +import haengdong.event.application.response.StepAppResponse; public record StepResponse( List bills, diff --git a/server/src/main/java/server/haengdong/presentation/response/StepsResponse.java b/server/src/main/java/haengdong/event/presentation/response/StepsResponse.java similarity index 71% rename from server/src/main/java/server/haengdong/presentation/response/StepsResponse.java rename to server/src/main/java/haengdong/event/presentation/response/StepsResponse.java index 8a66df1c6..ff9a23702 100644 --- a/server/src/main/java/server/haengdong/presentation/response/StepsResponse.java +++ b/server/src/main/java/haengdong/event/presentation/response/StepsResponse.java @@ -1,7 +1,7 @@ -package server.haengdong.presentation.response; +package haengdong.event.presentation.response; import java.util.List; -import server.haengdong.application.response.StepAppResponse; +import haengdong.event.application.response.StepAppResponse; public record StepsResponse( List steps diff --git a/server/src/main/java/haengdong/event/properties/ImageProperties.java b/server/src/main/java/haengdong/event/properties/ImageProperties.java new file mode 100644 index 000000000..8d62f63cc --- /dev/null +++ b/server/src/main/java/haengdong/event/properties/ImageProperties.java @@ -0,0 +1,11 @@ +package haengdong.event.properties; + +import org.springframework.boot.context.properties.ConfigurationProperties; + +@ConfigurationProperties("image") +public record ImageProperties( + String bucket, + String directory, + String baseUrl +) { +} diff --git a/server/src/main/java/server/haengdong/application/KakaoClient.java b/server/src/main/java/haengdong/user/application/KakaoClient.java similarity index 85% rename from server/src/main/java/server/haengdong/application/KakaoClient.java rename to server/src/main/java/haengdong/user/application/KakaoClient.java index 4981549b6..6aa0757c8 100644 --- a/server/src/main/java/server/haengdong/application/KakaoClient.java +++ b/server/src/main/java/haengdong/user/application/KakaoClient.java @@ -1,4 +1,4 @@ -package server.haengdong.application; +package haengdong.user.application; import lombok.RequiredArgsConstructor; import org.springframework.boot.context.properties.EnableConfigurationProperties; @@ -8,10 +8,10 @@ import org.springframework.util.LinkedMultiValueMap; import org.springframework.util.MultiValueMap; import org.springframework.web.client.RestClient; -import server.haengdong.application.response.KakaoTokenResponse; -import server.haengdong.config.KakaoProperties; -import server.haengdong.exception.HaengdongErrorCode; -import server.haengdong.exception.HaengdongException; +import haengdong.user.application.response.KakaoTokenResponse; +import haengdong.user.config.KakaoProperties; +import haengdong.common.exception.HaengdongErrorCode; +import haengdong.common.exception.HaengdongException; @RequiredArgsConstructor @EnableConfigurationProperties(KakaoProperties.class) diff --git a/server/src/main/java/server/haengdong/application/KakaoUserService.java b/server/src/main/java/haengdong/user/application/KakaoUserService.java similarity index 89% rename from server/src/main/java/server/haengdong/application/KakaoUserService.java rename to server/src/main/java/haengdong/user/application/KakaoUserService.java index 6ba52f5b5..21c1919dc 100644 --- a/server/src/main/java/server/haengdong/application/KakaoUserService.java +++ b/server/src/main/java/haengdong/user/application/KakaoUserService.java @@ -1,10 +1,10 @@ -package server.haengdong.application; +package haengdong.user.application; import com.auth0.jwt.JWT; import com.auth0.jwt.interfaces.DecodedJWT; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; -import server.haengdong.application.response.KakaoTokenResponse; +import haengdong.user.application.response.KakaoTokenResponse; @RequiredArgsConstructor @Service diff --git a/server/src/main/java/server/haengdong/application/UserService.java b/server/src/main/java/haengdong/user/application/UserService.java similarity index 78% rename from server/src/main/java/server/haengdong/application/UserService.java rename to server/src/main/java/haengdong/user/application/UserService.java index 2c7078544..9c4665014 100644 --- a/server/src/main/java/server/haengdong/application/UserService.java +++ b/server/src/main/java/haengdong/user/application/UserService.java @@ -1,22 +1,21 @@ -package server.haengdong.application; +package haengdong.user.application; +import haengdong.common.exception.AuthenticationException; +import haengdong.common.exception.HaengdongErrorCode; +import haengdong.common.exception.HaengdongException; +import haengdong.user.application.request.UserGuestSaveAppRequest; +import haengdong.user.application.request.UserUpdateAppRequest; +import haengdong.user.domain.User; +import haengdong.user.domain.repository.UserRepository; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import server.haengdong.application.request.UserGuestSaveAppRequest; -import server.haengdong.application.request.UserUpdateAppRequest; -import server.haengdong.domain.user.User; -import server.haengdong.domain.user.UserRepository; -import server.haengdong.exception.AuthenticationException; -import server.haengdong.exception.HaengdongErrorCode; -import server.haengdong.exception.HaengdongException; @RequiredArgsConstructor @Service public class UserService { - private final UserRepository userRepository; - private final EventMemberService eventMemberService; + private final UserRepository userRepository; private final KakaoClient kakaoClient; @Transactional diff --git a/server/src/main/java/server/haengdong/application/request/UserGuestSaveAppRequest.java b/server/src/main/java/haengdong/user/application/request/UserGuestSaveAppRequest.java similarity index 81% rename from server/src/main/java/server/haengdong/application/request/UserGuestSaveAppRequest.java rename to server/src/main/java/haengdong/user/application/request/UserGuestSaveAppRequest.java index 21a10a706..b6ba00503 100644 --- a/server/src/main/java/server/haengdong/application/request/UserGuestSaveAppRequest.java +++ b/server/src/main/java/haengdong/user/application/request/UserGuestSaveAppRequest.java @@ -1,7 +1,7 @@ -package server.haengdong.application.request; +package haengdong.user.application.request; import jakarta.validation.constraints.NotBlank; -import server.haengdong.domain.user.User; +import haengdong.user.domain.User; public record UserGuestSaveAppRequest( diff --git a/server/src/main/java/server/haengdong/application/request/UserUpdateAppRequest.java b/server/src/main/java/haengdong/user/application/request/UserUpdateAppRequest.java similarity index 89% rename from server/src/main/java/server/haengdong/application/request/UserUpdateAppRequest.java rename to server/src/main/java/haengdong/user/application/request/UserUpdateAppRequest.java index a174cd943..c04ae2465 100644 --- a/server/src/main/java/server/haengdong/application/request/UserUpdateAppRequest.java +++ b/server/src/main/java/haengdong/user/application/request/UserUpdateAppRequest.java @@ -1,4 +1,4 @@ -package server.haengdong.application.request; +package haengdong.user.application.request; public record UserUpdateAppRequest( Long id, diff --git a/server/src/main/java/server/haengdong/application/response/KakaoTokenResponse.java b/server/src/main/java/haengdong/user/application/response/KakaoTokenResponse.java similarity index 82% rename from server/src/main/java/server/haengdong/application/response/KakaoTokenResponse.java rename to server/src/main/java/haengdong/user/application/response/KakaoTokenResponse.java index 5dff47918..f379a03c6 100644 --- a/server/src/main/java/server/haengdong/application/response/KakaoTokenResponse.java +++ b/server/src/main/java/haengdong/user/application/response/KakaoTokenResponse.java @@ -1,4 +1,4 @@ -package server.haengdong.application.response; +package haengdong.user.application.response; import com.fasterxml.jackson.annotation.JsonProperty; diff --git a/server/src/main/java/server/haengdong/config/KakaoConfig.java b/server/src/main/java/haengdong/user/config/KakaoConfig.java similarity index 97% rename from server/src/main/java/server/haengdong/config/KakaoConfig.java rename to server/src/main/java/haengdong/user/config/KakaoConfig.java index 029a91725..4c70bdbf2 100644 --- a/server/src/main/java/server/haengdong/config/KakaoConfig.java +++ b/server/src/main/java/haengdong/user/config/KakaoConfig.java @@ -1,4 +1,4 @@ -package server.haengdong.config; +package haengdong.user.config; import java.time.Duration; import org.springframework.boot.web.client.ClientHttpRequestFactories; diff --git a/server/src/main/java/server/haengdong/config/KakaoProperties.java b/server/src/main/java/haengdong/user/config/KakaoProperties.java similarity index 88% rename from server/src/main/java/server/haengdong/config/KakaoProperties.java rename to server/src/main/java/haengdong/user/config/KakaoProperties.java index c4dcc32db..0e9bff45c 100644 --- a/server/src/main/java/server/haengdong/config/KakaoProperties.java +++ b/server/src/main/java/haengdong/user/config/KakaoProperties.java @@ -1,4 +1,4 @@ -package server.haengdong.config; +package haengdong.user.config; import org.springframework.boot.context.properties.ConfigurationProperties; diff --git a/server/src/main/java/server/haengdong/domain/event/Bank.java b/server/src/main/java/haengdong/user/domain/Bank.java similarity index 91% rename from server/src/main/java/server/haengdong/domain/event/Bank.java rename to server/src/main/java/haengdong/user/domain/Bank.java index 53fbbd92d..d033aea8c 100644 --- a/server/src/main/java/server/haengdong/domain/event/Bank.java +++ b/server/src/main/java/haengdong/user/domain/Bank.java @@ -1,8 +1,8 @@ -package server.haengdong.domain.event; +package haengdong.user.domain; import java.util.Arrays; -import server.haengdong.exception.HaengdongErrorCode; -import server.haengdong.exception.HaengdongException; +import haengdong.common.exception.HaengdongErrorCode; +import haengdong.common.exception.HaengdongException; public enum Bank { WOORI_BANK("우리은행"), diff --git a/server/src/main/java/server/haengdong/domain/user/Role.java b/server/src/main/java/haengdong/user/domain/Role.java similarity index 51% rename from server/src/main/java/server/haengdong/domain/user/Role.java rename to server/src/main/java/haengdong/user/domain/Role.java index 921af7ae5..0bb1a4df8 100644 --- a/server/src/main/java/server/haengdong/domain/user/Role.java +++ b/server/src/main/java/haengdong/user/domain/Role.java @@ -1,4 +1,4 @@ -package server.haengdong.domain.user; +package haengdong.user.domain; public enum Role { GUEST, MEMBER diff --git a/server/src/main/java/server/haengdong/domain/user/User.java b/server/src/main/java/haengdong/user/domain/User.java similarity index 90% rename from server/src/main/java/server/haengdong/domain/user/User.java rename to server/src/main/java/haengdong/user/domain/User.java index 31d1fff56..4c5f173c6 100644 --- a/server/src/main/java/server/haengdong/domain/user/User.java +++ b/server/src/main/java/haengdong/user/domain/User.java @@ -1,4 +1,4 @@ -package server.haengdong.domain.user; +package haengdong.user.domain; import jakarta.persistence.Column; import jakarta.persistence.Entity; @@ -9,10 +9,9 @@ import lombok.AccessLevel; import lombok.Getter; import lombok.NoArgsConstructor; -import server.haengdong.domain.BaseEntity; -import server.haengdong.domain.event.Bank; -import server.haengdong.exception.HaengdongErrorCode; -import server.haengdong.exception.HaengdongException; +import haengdong.common.domain.BaseEntity; +import haengdong.common.exception.HaengdongErrorCode; +import haengdong.common.exception.HaengdongException; @Getter @NoArgsConstructor(access = AccessLevel.PROTECTED) diff --git a/server/src/main/java/server/haengdong/domain/user/UserRepository.java b/server/src/main/java/haengdong/user/domain/repository/UserRepository.java similarity index 74% rename from server/src/main/java/server/haengdong/domain/user/UserRepository.java rename to server/src/main/java/haengdong/user/domain/repository/UserRepository.java index 77c601634..b0d214f09 100644 --- a/server/src/main/java/server/haengdong/domain/user/UserRepository.java +++ b/server/src/main/java/haengdong/user/domain/repository/UserRepository.java @@ -1,7 +1,8 @@ -package server.haengdong.domain.user; +package haengdong.user.domain.repository; import java.util.Optional; import org.springframework.data.jpa.repository.JpaRepository; +import haengdong.user.domain.User; public interface UserRepository extends JpaRepository { diff --git a/server/src/main/java/server/haengdong/presentation/UserController.java b/server/src/main/java/haengdong/user/presentation/UserController.java similarity index 86% rename from server/src/main/java/server/haengdong/presentation/UserController.java rename to server/src/main/java/haengdong/user/presentation/UserController.java index f8a029028..845a5f582 100644 --- a/server/src/main/java/server/haengdong/presentation/UserController.java +++ b/server/src/main/java/haengdong/user/presentation/UserController.java @@ -1,4 +1,4 @@ -package server.haengdong.presentation; +package haengdong.user.presentation; import jakarta.validation.Valid; import lombok.RequiredArgsConstructor; @@ -12,13 +12,13 @@ import org.springframework.web.bind.annotation.PatchMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestParam; -import server.haengdong.application.AuthService; -import server.haengdong.application.KakaoUserService; -import server.haengdong.application.UserService; -import server.haengdong.config.Login; -import server.haengdong.infrastructure.auth.CookieProperties; -import server.haengdong.presentation.request.UserUpdateRequest; -import server.haengdong.presentation.response.KakaoClientId; +import haengdong.common.auth.application.AuthService; +import haengdong.user.application.KakaoUserService; +import haengdong.user.application.UserService; +import haengdong.common.auth.Login; +import haengdong.common.properties.CookieProperties; +import haengdong.user.presentation.request.UserUpdateRequest; +import haengdong.user.presentation.response.KakaoClientId; @Slf4j @RequiredArgsConstructor diff --git a/server/src/main/java/server/haengdong/presentation/request/UserGuestSaveRequest.java b/server/src/main/java/haengdong/user/presentation/request/UserGuestSaveRequest.java similarity index 78% rename from server/src/main/java/server/haengdong/presentation/request/UserGuestSaveRequest.java rename to server/src/main/java/haengdong/user/presentation/request/UserGuestSaveRequest.java index f2469b35c..d097a8270 100644 --- a/server/src/main/java/server/haengdong/presentation/request/UserGuestSaveRequest.java +++ b/server/src/main/java/haengdong/user/presentation/request/UserGuestSaveRequest.java @@ -1,7 +1,7 @@ -package server.haengdong.presentation.request; +package haengdong.user.presentation.request; import jakarta.validation.constraints.NotBlank; -import server.haengdong.application.request.UserGuestSaveAppRequest; +import haengdong.user.application.request.UserGuestSaveAppRequest; public record UserGuestSaveRequest( diff --git a/server/src/main/java/server/haengdong/presentation/request/UserUpdateRequest.java b/server/src/main/java/haengdong/user/presentation/request/UserUpdateRequest.java similarity index 70% rename from server/src/main/java/server/haengdong/presentation/request/UserUpdateRequest.java rename to server/src/main/java/haengdong/user/presentation/request/UserUpdateRequest.java index ba9c6197c..ee6923de4 100644 --- a/server/src/main/java/server/haengdong/presentation/request/UserUpdateRequest.java +++ b/server/src/main/java/haengdong/user/presentation/request/UserUpdateRequest.java @@ -1,6 +1,6 @@ -package server.haengdong.presentation.request; +package haengdong.user.presentation.request; -import server.haengdong.application.request.UserUpdateAppRequest; +import haengdong.user.application.request.UserUpdateAppRequest; public record UserUpdateRequest( String nickname, diff --git a/server/src/main/java/server/haengdong/presentation/response/KakaoClientId.java b/server/src/main/java/haengdong/user/presentation/response/KakaoClientId.java similarity index 55% rename from server/src/main/java/server/haengdong/presentation/response/KakaoClientId.java rename to server/src/main/java/haengdong/user/presentation/response/KakaoClientId.java index f3fa62992..61f89ad94 100644 --- a/server/src/main/java/server/haengdong/presentation/response/KakaoClientId.java +++ b/server/src/main/java/haengdong/user/presentation/response/KakaoClientId.java @@ -1,4 +1,4 @@ -package server.haengdong.presentation.response; +package haengdong.user.presentation.response; public record KakaoClientId( String clientId diff --git a/server/src/main/java/server/haengdong/application/BillService.java b/server/src/main/java/server/haengdong/application/BillService.java deleted file mode 100644 index 461ae6b52..000000000 --- a/server/src/main/java/server/haengdong/application/BillService.java +++ /dev/null @@ -1,155 +0,0 @@ -package server.haengdong.application; - -import java.util.List; -import lombok.RequiredArgsConstructor; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; -import server.haengdong.application.request.BillAppRequest; -import server.haengdong.application.request.BillDetailUpdateAppRequest; -import server.haengdong.application.request.BillDetailsUpdateAppRequest; -import server.haengdong.application.request.BillUpdateAppRequest; -import server.haengdong.application.response.BillDetailsAppResponse; -import server.haengdong.application.response.StepAppResponse; -import server.haengdong.domain.bill.Bill; -import server.haengdong.domain.bill.BillDetail; -import server.haengdong.domain.bill.BillRepository; -import server.haengdong.domain.event.Event; -import server.haengdong.domain.event.EventRepository; -import server.haengdong.domain.eventmember.EventMember; -import server.haengdong.domain.eventmember.EventMemberRepository; -import server.haengdong.domain.step.Steps; -import server.haengdong.exception.HaengdongErrorCode; -import server.haengdong.exception.HaengdongException; - -@RequiredArgsConstructor -@Transactional(readOnly = true) -@Service -public class BillService { - - private final BillRepository billRepository; - private final EventRepository eventRepository; - private final EventMemberRepository eventMemberRepository; - - @Transactional - public void saveBill(String eventToken, BillAppRequest request) { - Event event = getEvent(eventToken); - List memberIds = request.memberIds(); - List eventMembers = memberIds.stream() - .map(this::findMember) - .toList(); - - Bill bill = request.toBill(event, eventMembers); - billRepository.save(bill); - } - - private EventMember findMember(Long memberId) { - return eventMemberRepository.findById(memberId) - .orElseThrow(() -> new HaengdongException(HaengdongErrorCode.MEMBER_NOT_FOUND)); - } - - public List findSteps(String token) { - Event event = getEvent(token); - List bills = billRepository.findAllByEvent(event); - - return createStepAppResponses(bills); - } - - private List createStepAppResponses(List bills) { - Steps steps = Steps.of(bills); - return steps.getSteps().stream() - .map(StepAppResponse::of) - .toList(); - } - - @Transactional - public void updateBill(String token, Long billId, BillUpdateAppRequest request) { - Bill bill = getBill(billId); - - validateToken(token, bill); - - bill.update(request.title(), request.price()); - } - - private void validateToken(String token, Bill bill) { - Event event = bill.getEvent(); - if (event.isTokenMismatch(token)) { - throw new HaengdongException(HaengdongErrorCode.BILL_NOT_FOUND); - } - } - - @Transactional - public void deleteBill(String token, Long billId) { - Bill bill = getBill(billId); - validateToken(token, bill); - billRepository.deleteById(billId); - } - - public BillDetailsAppResponse findBillDetails(String token, Long billId) { - Bill bill = billRepository.findById(billId) - .orElseThrow(() -> new HaengdongException(HaengdongErrorCode.BILL_NOT_FOUND)); - validateToken(token, bill); - - List billDetails = bill.getBillDetails(); - return BillDetailsAppResponse.of(billDetails); - } - - @Transactional - public void updateBillDetails(String token, Long billId, BillDetailsUpdateAppRequest request) { - Bill bill = billRepository.findById(billId) - .orElseThrow(() -> new HaengdongException(HaengdongErrorCode.BILL_NOT_FOUND)); - - List billDetailUpdateAppRequests = request.billDetailUpdateAppRequests(); - - validateToken(token, bill); - validateBillDetailSize(billDetailUpdateAppRequests, bill); - validateTotalPrice(billDetailUpdateAppRequests, bill); - - List billDetails = bill.getBillDetails(); - - for (BillDetailUpdateAppRequest updateRequest : billDetailUpdateAppRequests) { - BillDetail detailToUpdate = billDetails.stream() - .filter(detail -> detail.isSameId(updateRequest.id())) - .findFirst() - .orElseThrow(() -> new HaengdongException(HaengdongErrorCode.BILL_DETAIL_NOT_FOUND)); - - detailToUpdate.updatePrice(updateRequest.price()); - detailToUpdate.updateIsFixed(updateRequest.isFixed()); - } - } - - private void validateBillDetailSize(List requests, Bill bill) { - List ids = requests.stream() - .map(BillDetailUpdateAppRequest::id) - .distinct() - .toList(); - if (bill.getBillDetails().size() != ids.size()) { - throw new HaengdongException(HaengdongErrorCode.BILL_DETAIL_NOT_FOUND); - } - } - - private void validateTotalPrice( - List billDetailUpdateAppRequests, - Bill bill - ) { - Long requestsPriceSum = calculateUpdatePriceSum(billDetailUpdateAppRequests); - if (!bill.isSamePrice(requestsPriceSum)) { - throw new HaengdongException(HaengdongErrorCode.BILL_PRICE_NOT_MATCHED); - } - } - - private Long calculateUpdatePriceSum(List billDetailUpdateAppRequests) { - return billDetailUpdateAppRequests.stream() - .map(BillDetailUpdateAppRequest::price) - .reduce(0L, Long::sum); - } - - private Event getEvent(String eventToken) { - return eventRepository.findByToken(eventToken) - .orElseThrow(() -> new HaengdongException(HaengdongErrorCode.EVENT_NOT_FOUND)); - } - - private Bill getBill(Long billId) { - return billRepository.findById(billId) - .orElseThrow(() -> new HaengdongException(HaengdongErrorCode.BILL_NOT_FOUND)); - } -} diff --git a/server/src/main/java/server/haengdong/application/request/BillDetailUpdateAppRequest.java b/server/src/main/java/server/haengdong/application/request/BillDetailUpdateAppRequest.java deleted file mode 100644 index 4e66b9215..000000000 --- a/server/src/main/java/server/haengdong/application/request/BillDetailUpdateAppRequest.java +++ /dev/null @@ -1,8 +0,0 @@ -package server.haengdong.application.request; - -public record BillDetailUpdateAppRequest( - Long id, - Long price, - boolean isFixed -) { -} diff --git a/server/src/main/java/server/haengdong/application/request/BillDetailsUpdateAppRequest.java b/server/src/main/java/server/haengdong/application/request/BillDetailsUpdateAppRequest.java deleted file mode 100644 index 7a6477e08..000000000 --- a/server/src/main/java/server/haengdong/application/request/BillDetailsUpdateAppRequest.java +++ /dev/null @@ -1,8 +0,0 @@ -package server.haengdong.application.request; - -import java.util.List; - -public record BillDetailsUpdateAppRequest( - List billDetailUpdateAppRequests -) { -} diff --git a/server/src/main/java/server/haengdong/application/request/MembersSaveAppRequest.java b/server/src/main/java/server/haengdong/application/request/MembersSaveAppRequest.java deleted file mode 100644 index ae0c9fc62..000000000 --- a/server/src/main/java/server/haengdong/application/request/MembersSaveAppRequest.java +++ /dev/null @@ -1,8 +0,0 @@ -package server.haengdong.application.request; - -import java.util.List; - -public record MembersSaveAppRequest( - List members -) { -} diff --git a/server/src/main/java/server/haengdong/application/response/EventImageAppResponse.java b/server/src/main/java/server/haengdong/application/response/EventImageAppResponse.java deleted file mode 100644 index 26e442403..000000000 --- a/server/src/main/java/server/haengdong/application/response/EventImageAppResponse.java +++ /dev/null @@ -1,7 +0,0 @@ -package server.haengdong.application.response; - -public record EventImageAppResponse( - Long id, - String url -) { -} diff --git a/server/src/main/java/server/haengdong/presentation/response/EventImageResponse.java b/server/src/main/java/server/haengdong/presentation/response/EventImageResponse.java deleted file mode 100644 index da807655f..000000000 --- a/server/src/main/java/server/haengdong/presentation/response/EventImageResponse.java +++ /dev/null @@ -1,13 +0,0 @@ -package server.haengdong.presentation.response; - -import server.haengdong.application.response.EventImageAppResponse; - -public record EventImageResponse( - Long id, - String url -) { - - public static EventImageResponse of(EventImageAppResponse response) { - return new EventImageResponse(response.id(), response.url()); - } -} diff --git a/server/src/main/resources/application.yml b/server/src/main/resources/application.yml index a6553aa14..a3dba47f5 100644 --- a/server/src/main/resources/application.yml +++ b/server/src/main/resources/application.yml @@ -44,7 +44,7 @@ cookie: image: bucket: techcourse-project-2024 directory: haeng-dong/s3-upload-test/ - base-url: https://d2unln22cedgp9.cloudfront.net/ + baseUrl: https://d2unln22cedgp9.cloudfront.net/ management: endpoints: diff --git a/server/src/test/java/server/haengdong/application/BillServiceTest.java b/server/src/test/java/haengdong/application/BillServiceTest.java similarity index 92% rename from server/src/test/java/server/haengdong/application/BillServiceTest.java rename to server/src/test/java/haengdong/application/BillServiceTest.java index 61be03598..1dff0da75 100644 --- a/server/src/test/java/server/haengdong/application/BillServiceTest.java +++ b/server/src/test/java/haengdong/application/BillServiceTest.java @@ -1,4 +1,4 @@ -package server.haengdong.application; +package haengdong.application; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatThrownBy; @@ -9,24 +9,25 @@ import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; -import server.haengdong.application.request.BillAppRequest; -import server.haengdong.application.request.BillDetailUpdateAppRequest; -import server.haengdong.application.request.BillDetailsUpdateAppRequest; -import server.haengdong.application.request.BillUpdateAppRequest; -import server.haengdong.application.response.BillAppResponse; -import server.haengdong.application.response.BillDetailAppResponse; -import server.haengdong.application.response.BillDetailsAppResponse; -import server.haengdong.application.response.MemberAppResponse; -import server.haengdong.application.response.StepAppResponse; -import server.haengdong.domain.bill.Bill; -import server.haengdong.domain.bill.BillDetail; -import server.haengdong.domain.bill.BillRepository; -import server.haengdong.domain.event.Event; -import server.haengdong.domain.event.EventRepository; -import server.haengdong.domain.eventmember.EventMember; -import server.haengdong.domain.eventmember.EventMemberRepository; -import server.haengdong.exception.HaengdongException; -import server.haengdong.support.fixture.Fixture; +import haengdong.event.application.BillService; +import haengdong.event.application.request.BillAppRequest; +import haengdong.event.application.request.BillDetailUpdateAppRequest; +import haengdong.event.application.request.BillDetailsUpdateAppRequest; +import haengdong.event.application.request.BillUpdateAppRequest; +import haengdong.event.application.response.BillAppResponse; +import haengdong.event.application.response.BillDetailAppResponse; +import haengdong.event.application.response.BillDetailsAppResponse; +import haengdong.event.application.response.MemberAppResponse; +import haengdong.event.application.response.StepAppResponse; +import haengdong.event.domain.bill.Bill; +import haengdong.event.domain.bill.BillDetail; +import haengdong.event.domain.bill.BillRepository; +import haengdong.event.domain.event.Event; +import haengdong.event.domain.event.EventRepository; +import haengdong.event.domain.event.member.EventMember; +import haengdong.event.domain.event.member.EventMemberRepository; +import haengdong.common.exception.HaengdongException; +import haengdong.support.fixture.Fixture; class BillServiceTest extends ServiceTestSupport { @@ -320,8 +321,8 @@ void updateBillDetailsTest2() { assertThat(foundBillDetails).hasSize(2) .extracting(BillDetail::getId, BillDetail::getPrice) .containsExactly( - tuple(billDetails.get(0).getId(), 3000L), - tuple(billDetails.get(1).getId(), 7000L) + tuple(3L, 3000L), + tuple(4L, 7000L) ); } diff --git a/server/src/test/java/server/haengdong/application/EventEventMemberServiceTest.java b/server/src/test/java/haengdong/application/EventEventMemberServiceTest.java similarity index 91% rename from server/src/test/java/server/haengdong/application/EventEventMemberServiceTest.java rename to server/src/test/java/haengdong/application/EventEventMemberServiceTest.java index 7b6552add..01e94e428 100644 --- a/server/src/test/java/server/haengdong/application/EventEventMemberServiceTest.java +++ b/server/src/test/java/haengdong/application/EventEventMemberServiceTest.java @@ -1,4 +1,4 @@ -package server.haengdong.application; +package haengdong.application; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatThrownBy; @@ -6,35 +6,36 @@ import static org.junit.jupiter.api.Assertions.assertAll; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; -import static server.haengdong.support.fixture.Fixture.BILL1; -import static server.haengdong.support.fixture.Fixture.EVENT1; -import static server.haengdong.support.fixture.Fixture.EVENT2; -import static server.haengdong.support.fixture.Fixture.EVENT_MEMBER_1; -import static server.haengdong.support.fixture.Fixture.EVENT_MEMBER_2; -import static server.haengdong.support.fixture.Fixture.EVENT_MEMBER_3; +import static haengdong.support.fixture.Fixture.BILL1; +import static haengdong.support.fixture.Fixture.EVENT1; +import static haengdong.support.fixture.Fixture.EVENT2; +import static haengdong.support.fixture.Fixture.EVENT_MEMBER_1; +import static haengdong.support.fixture.Fixture.EVENT_MEMBER_2; +import static haengdong.support.fixture.Fixture.EVENT_MEMBER_3; import java.util.List; import org.assertj.core.groups.Tuple; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; -import server.haengdong.application.request.MemberSaveAppRequest; -import server.haengdong.application.request.MemberUpdateAppRequest; -import server.haengdong.application.request.MembersSaveAppRequest; -import server.haengdong.application.request.MembersUpdateAppRequest; -import server.haengdong.application.response.MemberAppResponse; -import server.haengdong.application.response.MemberDepositAppResponse; -import server.haengdong.application.response.MemberSaveAppResponse; -import server.haengdong.application.response.MembersDepositAppResponse; -import server.haengdong.application.response.MembersSaveAppResponse; -import server.haengdong.domain.bill.Bill; -import server.haengdong.domain.bill.BillDetail; -import server.haengdong.domain.bill.BillRepository; -import server.haengdong.domain.event.Event; -import server.haengdong.domain.event.EventRepository; -import server.haengdong.domain.eventmember.EventMember; -import server.haengdong.domain.eventmember.EventMemberRepository; -import server.haengdong.exception.HaengdongException; +import haengdong.event.application.EventMemberService; +import haengdong.event.application.request.MemberSaveAppRequest; +import haengdong.event.application.request.MemberUpdateAppRequest; +import haengdong.event.application.request.MembersSaveAppRequest; +import haengdong.event.application.request.MembersUpdateAppRequest; +import haengdong.event.application.response.MemberAppResponse; +import haengdong.event.application.response.MemberDepositAppResponse; +import haengdong.event.application.response.MemberSaveAppResponse; +import haengdong.event.application.response.MembersDepositAppResponse; +import haengdong.event.application.response.MembersSaveAppResponse; +import haengdong.event.domain.bill.Bill; +import haengdong.event.domain.bill.BillDetail; +import haengdong.event.domain.bill.BillRepository; +import haengdong.event.domain.event.Event; +import haengdong.event.domain.event.EventRepository; +import haengdong.event.domain.event.member.EventMember; +import haengdong.event.domain.event.member.EventMemberRepository; +import haengdong.common.exception.HaengdongException; class EventEventMemberServiceTest extends ServiceTestSupport { diff --git a/server/src/test/java/server/haengdong/application/EventImageFacadeServiceTest.java b/server/src/test/java/haengdong/application/EventImageFacadeServiceTest.java similarity index 92% rename from server/src/test/java/server/haengdong/application/EventImageFacadeServiceTest.java rename to server/src/test/java/haengdong/application/EventImageFacadeServiceTest.java index 7cfee215d..b82561b72 100644 --- a/server/src/test/java/server/haengdong/application/EventImageFacadeServiceTest.java +++ b/server/src/test/java/haengdong/application/EventImageFacadeServiceTest.java @@ -1,4 +1,4 @@ -package server.haengdong.application; +package haengdong.application; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatThrownBy; @@ -19,13 +19,16 @@ import org.springframework.boot.test.mock.mockito.SpyBean; import org.springframework.mock.web.MockMultipartFile; import org.springframework.web.multipart.MultipartFile; -import server.haengdong.application.response.EventImageSaveAppResponse; -import server.haengdong.application.response.ImageInfo; -import server.haengdong.domain.event.Event; -import server.haengdong.domain.event.EventImageRepository; -import server.haengdong.domain.event.EventRepository; -import server.haengdong.exception.HaengdongException; -import server.haengdong.support.fixture.Fixture; +import haengdong.event.application.EventImageFacadeService; +import haengdong.event.application.EventService; +import haengdong.event.application.ImageService; +import haengdong.event.application.response.EventImageSaveAppResponse; +import haengdong.event.application.response.ImageInfo; +import haengdong.event.domain.event.Event; +import haengdong.event.domain.event.image.EventImageRepository; +import haengdong.event.domain.event.EventRepository; +import haengdong.common.exception.HaengdongException; +import haengdong.support.fixture.Fixture; class EventImageFacadeServiceTest extends ServiceTestSupport { diff --git a/server/src/test/java/server/haengdong/application/EventServiceTest.java b/server/src/test/java/haengdong/application/EventServiceTest.java similarity index 87% rename from server/src/test/java/server/haengdong/application/EventServiceTest.java rename to server/src/test/java/haengdong/application/EventServiceTest.java index aa8e88cc1..288cb775d 100644 --- a/server/src/test/java/server/haengdong/application/EventServiceTest.java +++ b/server/src/test/java/haengdong/application/EventServiceTest.java @@ -1,4 +1,4 @@ -package server.haengdong.application; +package haengdong.application; import static org.assertj.core.api.Assertions.assertThat; @@ -13,23 +13,24 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.test.mock.mockito.MockBean; -import server.haengdong.application.request.EventGuestAppRequest; -import server.haengdong.application.request.EventUpdateAppRequest; -import server.haengdong.application.response.EventAppResponse; -import server.haengdong.application.response.EventDetailAppResponse; -import server.haengdong.application.response.EventImageAppResponse; -import server.haengdong.application.response.MemberBillReportAppResponse; -import server.haengdong.domain.RandomValueProvider; -import server.haengdong.domain.bill.Bill; -import server.haengdong.domain.bill.BillRepository; -import server.haengdong.domain.event.Event; -import server.haengdong.domain.event.EventImage; -import server.haengdong.domain.event.EventImageRepository; -import server.haengdong.domain.event.EventRepository; -import server.haengdong.domain.eventmember.EventMember; -import server.haengdong.domain.eventmember.EventMemberRepository; -import server.haengdong.exception.HaengdongException; -import server.haengdong.support.fixture.Fixture; +import haengdong.event.application.EventService; +import haengdong.event.application.request.EventGuestAppRequest; +import haengdong.event.application.request.EventUpdateAppRequest; +import haengdong.event.application.response.EventAppResponse; +import haengdong.event.application.response.EventDetailAppResponse; +import haengdong.event.application.response.EventImageAppResponse; +import haengdong.event.application.response.MemberBillReportAppResponse; +import haengdong.event.domain.RandomValueProvider; +import haengdong.event.domain.bill.Bill; +import haengdong.event.domain.bill.BillRepository; +import haengdong.event.domain.event.Event; +import haengdong.event.domain.event.image.EventImage; +import haengdong.event.domain.event.image.EventImageRepository; +import haengdong.event.domain.event.EventRepository; +import haengdong.event.domain.event.member.EventMember; +import haengdong.event.domain.event.member.EventMemberRepository; +import haengdong.common.exception.HaengdongException; +import haengdong.support.fixture.Fixture; class EventServiceTest extends ServiceTestSupport { @@ -51,9 +52,6 @@ class EventServiceTest extends ServiceTestSupport { @MockBean private RandomValueProvider randomValueProvider; - @Value("${image.base-url}") - private String baseUrl; - @DisplayName("행사를 생성한다") @Test void saveEventGuestTest() { @@ -190,10 +188,10 @@ void findAllImages() { assertThat(responses) .hasSize(2) - .extracting(EventImageAppResponse::url) + .extracting(EventImageAppResponse::name) .containsExactlyInAnyOrder( - baseUrl + "image1.jpg", - baseUrl + "image2.jpg" + "image1.jpg", + "image2.jpg" ); } diff --git a/server/src/test/java/server/haengdong/application/ImageServiceTest.java b/server/src/test/java/haengdong/application/ImageServiceTest.java similarity index 96% rename from server/src/test/java/server/haengdong/application/ImageServiceTest.java rename to server/src/test/java/haengdong/application/ImageServiceTest.java index f155ba579..bbcd5e642 100644 --- a/server/src/test/java/server/haengdong/application/ImageServiceTest.java +++ b/server/src/test/java/haengdong/application/ImageServiceTest.java @@ -1,4 +1,4 @@ -package server.haengdong.application; +package haengdong.application; import static org.assertj.core.api.Assertions.assertThatThrownBy; import static org.mockito.ArgumentMatchers.any; @@ -14,6 +14,7 @@ import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.mock.web.MockMultipartFile; import org.springframework.web.multipart.MultipartFile; +import haengdong.event.application.ImageService; import software.amazon.awssdk.core.sync.RequestBody; import software.amazon.awssdk.services.s3.S3Client; import software.amazon.awssdk.services.s3.model.DeleteObjectRequest; diff --git a/server/src/test/java/server/haengdong/application/ServiceTestSupport.java b/server/src/test/java/haengdong/application/ServiceTestSupport.java similarity index 75% rename from server/src/test/java/server/haengdong/application/ServiceTestSupport.java rename to server/src/test/java/haengdong/application/ServiceTestSupport.java index 008ba1035..451391731 100644 --- a/server/src/test/java/server/haengdong/application/ServiceTestSupport.java +++ b/server/src/test/java/haengdong/application/ServiceTestSupport.java @@ -1,9 +1,9 @@ -package server.haengdong.application; +package haengdong.application; import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; -import server.haengdong.support.extension.DatabaseCleanerExtension; +import haengdong.support.extension.DatabaseCleanerExtension; @ExtendWith(DatabaseCleanerExtension.class) @SpringBootTest(webEnvironment = WebEnvironment.NONE) diff --git a/server/src/test/java/server/haengdong/docs/AdminBillControllerDocsTest.java b/server/src/test/java/haengdong/docs/AdminBillControllerDocsTest.java similarity index 94% rename from server/src/test/java/server/haengdong/docs/AdminBillControllerDocsTest.java rename to server/src/test/java/haengdong/docs/AdminBillControllerDocsTest.java index d6e796dd9..afdc82294 100644 --- a/server/src/test/java/server/haengdong/docs/AdminBillControllerDocsTest.java +++ b/server/src/test/java/haengdong/docs/AdminBillControllerDocsTest.java @@ -1,4 +1,4 @@ -package server.haengdong.docs; +package haengdong.docs; import static org.mockito.Mockito.mock; import static org.springframework.restdocs.cookies.CookieDocumentation.cookieWithName; @@ -16,20 +16,20 @@ import static org.springframework.restdocs.request.RequestDocumentation.pathParameters; import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; -import static server.haengdong.support.fixture.Fixture.EVENT_COOKIE; +import static haengdong.support.fixture.Fixture.EVENT_COOKIE; import java.util.List; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; import org.springframework.http.MediaType; import org.springframework.restdocs.payload.JsonFieldType; -import server.haengdong.application.BillService; -import server.haengdong.presentation.admin.AdminBillController; -import server.haengdong.presentation.request.BillDetailUpdateRequest; -import server.haengdong.presentation.request.BillDetailsUpdateRequest; -import server.haengdong.presentation.request.BillSaveRequest; -import server.haengdong.presentation.request.BillUpdateRequest; -import server.haengdong.support.fixture.Fixture; +import haengdong.event.application.BillService; +import haengdong.event.presentation.admin.AdminBillController; +import haengdong.event.presentation.request.BillDetailUpdateRequest; +import haengdong.event.presentation.request.BillDetailsUpdateRequest; +import haengdong.event.presentation.request.BillSaveRequest; +import haengdong.event.presentation.request.BillUpdateRequest; +import haengdong.support.fixture.Fixture; class AdminBillControllerDocsTest extends RestDocsSupport { diff --git a/server/src/test/java/server/haengdong/docs/AdminEventControllerDocsTest.java b/server/src/test/java/haengdong/docs/AdminEventControllerDocsTest.java similarity index 94% rename from server/src/test/java/server/haengdong/docs/AdminEventControllerDocsTest.java rename to server/src/test/java/haengdong/docs/AdminEventControllerDocsTest.java index 71f18fe58..0c70615c8 100644 --- a/server/src/test/java/server/haengdong/docs/AdminEventControllerDocsTest.java +++ b/server/src/test/java/haengdong/docs/AdminEventControllerDocsTest.java @@ -1,4 +1,4 @@ -package server.haengdong.docs; +package haengdong.docs; import static org.mockito.ArgumentMatchers.any; import static org.mockito.BDDMockito.given; @@ -22,21 +22,21 @@ import static org.springframework.restdocs.request.RequestDocumentation.requestParts; import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; -import static server.haengdong.support.fixture.Fixture.EVENT_COOKIE; +import static haengdong.support.fixture.Fixture.EVENT_COOKIE; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; import org.springframework.http.MediaType; import org.springframework.mock.web.MockMultipartFile; import org.springframework.restdocs.payload.JsonFieldType; -import server.haengdong.application.EventImageFacadeService; -import server.haengdong.application.EventService; -import server.haengdong.application.request.EventAppRequest; -import server.haengdong.application.response.EventAppResponse; -import server.haengdong.presentation.admin.AdminEventController; -import server.haengdong.presentation.request.EventSaveRequest; -import server.haengdong.presentation.request.EventUpdateRequest; -import server.haengdong.support.fixture.Fixture; +import haengdong.event.application.EventImageFacadeService; +import haengdong.event.application.EventService; +import haengdong.event.application.request.EventAppRequest; +import haengdong.event.application.response.EventAppResponse; +import haengdong.event.presentation.admin.AdminEventController; +import haengdong.event.presentation.request.EventSaveRequest; +import haengdong.event.presentation.request.EventUpdateRequest; +import haengdong.support.fixture.Fixture; class AdminEventControllerDocsTest extends RestDocsSupport { diff --git a/server/src/test/java/server/haengdong/docs/AdminEventEventMemberControllerDocsTest.java b/server/src/test/java/haengdong/docs/AdminEventEventMemberControllerDocsTest.java similarity index 93% rename from server/src/test/java/server/haengdong/docs/AdminEventEventMemberControllerDocsTest.java rename to server/src/test/java/haengdong/docs/AdminEventEventMemberControllerDocsTest.java index 8353d9b8d..3d4e7ee6d 100644 --- a/server/src/test/java/server/haengdong/docs/AdminEventEventMemberControllerDocsTest.java +++ b/server/src/test/java/haengdong/docs/AdminEventEventMemberControllerDocsTest.java @@ -1,4 +1,4 @@ -package server.haengdong.docs; +package haengdong.docs; import static org.hamcrest.Matchers.equalTo; import static org.mockito.BDDMockito.given; @@ -19,7 +19,7 @@ import static org.springframework.restdocs.request.RequestDocumentation.pathParameters; import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; -import static server.haengdong.support.fixture.Fixture.EVENT_COOKIE; +import static haengdong.support.fixture.Fixture.EVENT_COOKIE; import java.util.List; import org.junit.jupiter.api.DisplayName; @@ -27,14 +27,14 @@ import org.springframework.http.MediaType; import org.springframework.restdocs.payload.JsonFieldType; import org.springframework.test.web.servlet.result.MockMvcResultMatchers; -import server.haengdong.application.EventMemberService; -import server.haengdong.application.response.MemberSaveAppResponse; -import server.haengdong.application.response.MembersSaveAppResponse; -import server.haengdong.presentation.admin.AdminMemberController; -import server.haengdong.presentation.request.MemberSaveRequest; -import server.haengdong.presentation.request.MemberUpdateRequest; -import server.haengdong.presentation.request.MembersSaveRequest; -import server.haengdong.presentation.request.MembersUpdateRequest; +import haengdong.event.application.EventMemberService; +import haengdong.event.application.response.MemberSaveAppResponse; +import haengdong.event.application.response.MembersSaveAppResponse; +import haengdong.event.presentation.admin.AdminMemberController; +import haengdong.event.presentation.request.MemberSaveRequest; +import haengdong.event.presentation.request.MemberUpdateRequest; +import haengdong.event.presentation.request.MembersSaveRequest; +import haengdong.event.presentation.request.MembersUpdateRequest; class AdminEventEventMemberControllerDocsTest extends RestDocsSupport { diff --git a/server/src/test/java/server/haengdong/docs/BillControllerDocsTest.java b/server/src/test/java/haengdong/docs/BillControllerDocsTest.java similarity index 91% rename from server/src/test/java/server/haengdong/docs/BillControllerDocsTest.java rename to server/src/test/java/haengdong/docs/BillControllerDocsTest.java index 33baef08b..cfbbf6ed5 100644 --- a/server/src/test/java/server/haengdong/docs/BillControllerDocsTest.java +++ b/server/src/test/java/haengdong/docs/BillControllerDocsTest.java @@ -1,4 +1,4 @@ -package server.haengdong.docs; +package haengdong.docs; import static org.mockito.ArgumentMatchers.anyLong; import static org.mockito.ArgumentMatchers.anyString; @@ -20,16 +20,16 @@ import java.util.List; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; -import server.haengdong.application.BillService; -import server.haengdong.application.response.BillAppResponse; -import server.haengdong.application.response.BillDetailAppResponse; -import server.haengdong.application.response.BillDetailsAppResponse; -import server.haengdong.application.response.MemberAppResponse; -import server.haengdong.application.response.StepAppResponse; -import server.haengdong.domain.bill.Bill; -import server.haengdong.domain.eventmember.EventMember; -import server.haengdong.presentation.BillController; -import server.haengdong.support.fixture.Fixture; +import haengdong.event.application.BillService; +import haengdong.event.application.response.BillAppResponse; +import haengdong.event.application.response.BillDetailAppResponse; +import haengdong.event.application.response.BillDetailsAppResponse; +import haengdong.event.application.response.MemberAppResponse; +import haengdong.event.application.response.StepAppResponse; +import haengdong.event.domain.bill.Bill; +import haengdong.event.domain.event.member.EventMember; +import haengdong.event.presentation.BillController; +import haengdong.support.fixture.Fixture; class BillControllerDocsTest extends RestDocsSupport { diff --git a/server/src/test/java/server/haengdong/docs/EventControllerDocsTest.java b/server/src/test/java/haengdong/docs/EventControllerDocsTest.java similarity index 90% rename from server/src/test/java/server/haengdong/docs/EventControllerDocsTest.java rename to server/src/test/java/haengdong/docs/EventControllerDocsTest.java index 461756a4b..6087648ae 100644 --- a/server/src/test/java/server/haengdong/docs/EventControllerDocsTest.java +++ b/server/src/test/java/haengdong/docs/EventControllerDocsTest.java @@ -1,4 +1,4 @@ -package server.haengdong.docs; +package haengdong.docs; import static org.hamcrest.Matchers.equalTo; import static org.mockito.ArgumentMatchers.any; @@ -22,6 +22,18 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; +import haengdong.common.auth.application.AuthService; +import haengdong.common.properties.CookieProperties; +import haengdong.event.application.EventImageFacadeService; +import haengdong.event.application.EventService; +import haengdong.event.application.request.EventGuestAppRequest; +import haengdong.event.application.response.EventAppResponse; +import haengdong.event.application.response.EventDetailAppResponse; +import haengdong.event.application.response.EventImageUrlAppResponse; +import haengdong.event.application.response.MemberBillReportAppResponse; +import haengdong.event.presentation.EventController; +import haengdong.event.presentation.request.EventGuestSaveRequest; +import haengdong.event.presentation.request.EventLoginRequest; import java.time.Duration; import java.util.List; import org.junit.jupiter.api.DisplayName; @@ -29,17 +41,6 @@ import org.springframework.http.MediaType; import org.springframework.restdocs.payload.JsonFieldType; import org.springframework.test.web.servlet.result.MockMvcResultMatchers; -import server.haengdong.application.AuthService; -import server.haengdong.application.EventService; -import server.haengdong.application.request.EventGuestAppRequest; -import server.haengdong.application.response.EventAppResponse; -import server.haengdong.application.response.EventDetailAppResponse; -import server.haengdong.application.response.EventImageAppResponse; -import server.haengdong.application.response.MemberBillReportAppResponse; -import server.haengdong.infrastructure.auth.CookieProperties; -import server.haengdong.presentation.EventController; -import server.haengdong.presentation.request.EventGuestSaveRequest; -import server.haengdong.presentation.request.EventLoginRequest; class EventControllerDocsTest extends RestDocsSupport { @@ -48,10 +49,11 @@ class EventControllerDocsTest extends RestDocsSupport { private final CookieProperties cookieProperties = new CookieProperties( true, true, "domain", "path", "none", Duration.ofDays(7) ); + private final EventImageFacadeService eventImageFacadeService = mock(EventImageFacadeService.class); @Override protected Object initController() { - return new EventController(eventService, authService, cookieProperties); + return new EventController(eventService, authService, cookieProperties, eventImageFacadeService); } @DisplayName("토큰으로 행사를 조회한다.") @@ -201,12 +203,12 @@ void loginEvent() throws Exception { @Test void findAllImages() throws Exception { String token = "TOKEN"; - List imageNameAppResponses = List.of( - new EventImageAppResponse(1L, "https://host.com/image1.jpg"), - new EventImageAppResponse(2L, "https://host.com/image2.jpg"), - new EventImageAppResponse(3L, "https://host.com/zeze.jpg") + List imageNameAppResponses = List.of( + new EventImageUrlAppResponse(1L, "https://host.com/image1.jpg"), + new EventImageUrlAppResponse(2L, "https://host.com/image2.jpg"), + new EventImageUrlAppResponse(3L, "https://host.com/zeze.jpg") ); - given(eventService.findImages(token)).willReturn(imageNameAppResponses); + given(eventImageFacadeService.findImages(token)).willReturn(imageNameAppResponses); mockMvc.perform(get("/api/events/{eventId}/images", token)) .andDo(print()) diff --git a/server/src/test/java/server/haengdong/docs/EventEventMemberControllerDocsTest.java b/server/src/test/java/haengdong/docs/EventEventMemberControllerDocsTest.java similarity index 94% rename from server/src/test/java/server/haengdong/docs/EventEventMemberControllerDocsTest.java rename to server/src/test/java/haengdong/docs/EventEventMemberControllerDocsTest.java index c725f186c..8e7ab72c9 100644 --- a/server/src/test/java/server/haengdong/docs/EventEventMemberControllerDocsTest.java +++ b/server/src/test/java/haengdong/docs/EventEventMemberControllerDocsTest.java @@ -1,4 +1,4 @@ -package server.haengdong.docs; +package haengdong.docs; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyString; @@ -21,11 +21,11 @@ import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; import org.springframework.restdocs.payload.JsonFieldType; -import server.haengdong.application.EventMemberService; -import server.haengdong.application.response.MemberAppResponse; -import server.haengdong.application.response.MemberDepositAppResponse; -import server.haengdong.application.response.MembersDepositAppResponse; -import server.haengdong.presentation.EventMemberController; +import haengdong.event.application.EventMemberService; +import haengdong.event.application.response.MemberAppResponse; +import haengdong.event.application.response.MemberDepositAppResponse; +import haengdong.event.application.response.MembersDepositAppResponse; +import haengdong.event.presentation.EventMemberController; class EventEventMemberControllerDocsTest extends RestDocsSupport { diff --git a/server/src/test/java/server/haengdong/docs/RestDocsSupport.java b/server/src/test/java/haengdong/docs/RestDocsSupport.java similarity index 96% rename from server/src/test/java/server/haengdong/docs/RestDocsSupport.java rename to server/src/test/java/haengdong/docs/RestDocsSupport.java index 3e6901ba8..b882d5f31 100644 --- a/server/src/test/java/server/haengdong/docs/RestDocsSupport.java +++ b/server/src/test/java/haengdong/docs/RestDocsSupport.java @@ -1,4 +1,4 @@ -package server.haengdong.docs; +package haengdong.docs; import static org.springframework.restdocs.mockmvc.MockMvcRestDocumentation.documentationConfiguration; diff --git a/server/src/test/java/server/haengdong/domain/bill/BillTest.java b/server/src/test/java/haengdong/domain/bill/BillTest.java similarity index 55% rename from server/src/test/java/server/haengdong/domain/bill/BillTest.java rename to server/src/test/java/haengdong/domain/bill/BillTest.java index 3e56daac9..7ddac243b 100644 --- a/server/src/test/java/server/haengdong/domain/bill/BillTest.java +++ b/server/src/test/java/haengdong/domain/bill/BillTest.java @@ -1,17 +1,18 @@ -package server.haengdong.domain.bill; +package haengdong.domain.bill; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatThrownBy; import static org.junit.jupiter.api.Assertions.assertAll; -import static server.haengdong.support.fixture.Fixture.EVENT1; +import static haengdong.support.fixture.Fixture.EVENT1; import java.util.List; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.ValueSource; -import server.haengdong.domain.eventmember.EventMember; -import server.haengdong.exception.HaengdongException; +import haengdong.event.domain.bill.Bill; +import haengdong.event.domain.event.member.EventMember; +import haengdong.common.exception.HaengdongException; class BillTest { @@ -59,40 +60,4 @@ void isFixed1() { assertThat(fixedBill.isFixed()).isEqualTo(false); } - - @DisplayName("같은 멤버 목록을 가지고 있는지 비교한다.") - @Test - void isSameMember1() { - EventMember eventMember1 = new EventMember(1L, EVENT1, "감자", false); - EventMember eventMember2 = new EventMember(2L, EVENT1, "고구마", false); - EventMember eventMember3 = new EventMember(3L, EVENT1, "당근", false); - - List members1 = List.of(eventMember1, eventMember2, eventMember3); - List members2 = List.of(eventMember2, eventMember3, eventMember1); - - Bill bill1 = Bill.create(EVENT1, "뽕족", 20_000L, members1); - Bill bill2 = Bill.create(EVENT1, "인생네컷", 30_000L, members2); - - boolean isSameMembers = bill1.isSameMembers(bill2); - - assertThat(isSameMembers).isTrue(); - } - - @DisplayName("같은 멤버 목록을 가지고 있는지 비교한다.") - @Test - void isSameMember2() { - EventMember eventMember1 = new EventMember(1L, EVENT1, "감자", false); - EventMember eventMember2 = new EventMember(2L, EVENT1, "고구마", false); - EventMember eventMember3 = new EventMember(3L, EVENT1, "당근", false); - - List members1 = List.of(eventMember1, eventMember2, eventMember3); - List members2 = List.of(eventMember2, eventMember1); - - Bill bill1 = Bill.create(EVENT1, "뽕족", 20_000L, members1); - Bill bill2 = Bill.create(EVENT1, "인생네컷", 30_000L, members2); - - boolean isSameMembers = bill1.isSameMembers(bill2); - - assertThat(isSameMembers).isFalse(); - } } diff --git a/server/src/test/java/server/haengdong/domain/event/EventTest.java b/server/src/test/java/haengdong/domain/event/EventTest.java similarity index 98% rename from server/src/test/java/server/haengdong/domain/event/EventTest.java rename to server/src/test/java/haengdong/domain/event/EventTest.java index 67c5420b0..dc9810493 100644 --- a/server/src/test/java/server/haengdong/domain/event/EventTest.java +++ b/server/src/test/java/haengdong/domain/event/EventTest.java @@ -1,4 +1,4 @@ -package server.haengdong.domain.event; +package haengdong.domain.event; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatCode; @@ -9,7 +9,8 @@ import org.junit.jupiter.api.Test; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.ValueSource; -import server.haengdong.exception.HaengdongException; +import haengdong.event.domain.event.Event; +import haengdong.common.exception.HaengdongException; class EventTest { diff --git a/server/src/test/java/server/haengdong/domain/event/PasswordTest.java b/server/src/test/java/haengdong/domain/event/PasswordTest.java similarity index 80% rename from server/src/test/java/server/haengdong/domain/event/PasswordTest.java rename to server/src/test/java/haengdong/domain/event/PasswordTest.java index c504d3aa2..acd518e86 100644 --- a/server/src/test/java/server/haengdong/domain/event/PasswordTest.java +++ b/server/src/test/java/haengdong/domain/event/PasswordTest.java @@ -1,11 +1,12 @@ -package server.haengdong.domain.event; +package haengdong.domain.event; import static org.assertj.core.api.Assertions.assertThatCode; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.ValueSource; -import server.haengdong.exception.HaengdongException; +import haengdong.event.domain.event.Password; +import haengdong.common.exception.HaengdongException; class PasswordTest { diff --git a/server/src/test/java/server/haengdong/domain/eventmember/EventMemberBillReportTest.java b/server/src/test/java/haengdong/domain/eventmember/EventMemberBillReportTest.java similarity index 84% rename from server/src/test/java/server/haengdong/domain/eventmember/EventMemberBillReportTest.java rename to server/src/test/java/haengdong/domain/eventmember/EventMemberBillReportTest.java index 6d9eef909..3b056e60d 100644 --- a/server/src/test/java/server/haengdong/domain/eventmember/EventMemberBillReportTest.java +++ b/server/src/test/java/haengdong/domain/eventmember/EventMemberBillReportTest.java @@ -1,4 +1,4 @@ -package server.haengdong.domain.eventmember; +package haengdong.domain.eventmember; import static org.assertj.core.api.Assertions.assertThat; @@ -6,10 +6,11 @@ import java.util.Map; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; -import server.haengdong.domain.bill.Bill; -import server.haengdong.domain.event.Event; -import server.haengdong.domain.bill.MemberBillReport; -import server.haengdong.support.fixture.Fixture; +import haengdong.event.domain.bill.Bill; +import haengdong.event.domain.event.Event; +import haengdong.event.domain.bill.MemberBillReport; +import haengdong.event.domain.event.member.EventMember; +import haengdong.support.fixture.Fixture; class EventMemberBillReportTest { diff --git a/server/src/test/java/server/haengdong/domain/eventmember/UpdatedMembersTest.java b/server/src/test/java/haengdong/domain/eventmember/UpdatedMembersTest.java similarity index 96% rename from server/src/test/java/server/haengdong/domain/eventmember/UpdatedMembersTest.java rename to server/src/test/java/haengdong/domain/eventmember/UpdatedMembersTest.java index 35cfc5f92..3979d02ac 100644 --- a/server/src/test/java/server/haengdong/domain/eventmember/UpdatedMembersTest.java +++ b/server/src/test/java/haengdong/domain/eventmember/UpdatedMembersTest.java @@ -1,4 +1,4 @@ -package server.haengdong.domain.eventmember; +package haengdong.domain.eventmember; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatCode; @@ -7,8 +7,10 @@ import java.util.List; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; -import server.haengdong.domain.event.Event; -import server.haengdong.exception.HaengdongException; +import haengdong.event.domain.event.Event; +import haengdong.event.domain.event.member.EventMember; +import haengdong.event.domain.event.member.UpdatedMembers; +import haengdong.common.exception.HaengdongException; class UpdatedMembersTest { diff --git a/server/src/test/java/server/haengdong/domain/step/StepTest.java b/server/src/test/java/haengdong/domain/step/StepTest.java similarity index 87% rename from server/src/test/java/server/haengdong/domain/step/StepTest.java rename to server/src/test/java/haengdong/domain/step/StepTest.java index 53421d511..d1dfa69a2 100644 --- a/server/src/test/java/server/haengdong/domain/step/StepTest.java +++ b/server/src/test/java/haengdong/domain/step/StepTest.java @@ -1,15 +1,16 @@ -package server.haengdong.domain.step; +package haengdong.domain.step; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatThrownBy; -import static server.haengdong.support.fixture.Fixture.EVENT1; +import static haengdong.support.fixture.Fixture.EVENT1; import java.util.List; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; -import server.haengdong.domain.bill.Bill; -import server.haengdong.domain.eventmember.EventMember; -import server.haengdong.exception.HaengdongException; +import haengdong.event.domain.bill.Bill; +import haengdong.event.domain.event.member.EventMember; +import haengdong.event.domain.step.Step; +import haengdong.common.exception.HaengdongException; class StepTest { diff --git a/server/src/test/java/server/haengdong/domain/step/StepsTest.java b/server/src/test/java/haengdong/domain/step/StepsTest.java similarity index 89% rename from server/src/test/java/server/haengdong/domain/step/StepsTest.java rename to server/src/test/java/haengdong/domain/step/StepsTest.java index e0b3df857..33edb2124 100644 --- a/server/src/test/java/server/haengdong/domain/step/StepsTest.java +++ b/server/src/test/java/haengdong/domain/step/StepsTest.java @@ -1,14 +1,16 @@ -package server.haengdong.domain.step; +package haengdong.domain.step; import static org.assertj.core.api.Assertions.assertThat; import static org.junit.jupiter.api.Assertions.assertAll; -import static server.haengdong.support.fixture.Fixture.EVENT1; +import static haengdong.support.fixture.Fixture.EVENT1; import java.util.List; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; -import server.haengdong.domain.bill.Bill; -import server.haengdong.domain.eventmember.EventMember; +import haengdong.event.domain.bill.Bill; +import haengdong.event.domain.event.member.EventMember; +import haengdong.event.domain.step.Step; +import haengdong.event.domain.step.Steps; class StepsTest { diff --git a/server/src/test/java/server/haengdong/presentation/BillControllerTest.java b/server/src/test/java/haengdong/presentation/BillControllerTest.java similarity index 85% rename from server/src/test/java/server/haengdong/presentation/BillControllerTest.java rename to server/src/test/java/haengdong/presentation/BillControllerTest.java index 8bf5539d7..c8fe55ddf 100644 --- a/server/src/test/java/server/haengdong/presentation/BillControllerTest.java +++ b/server/src/test/java/haengdong/presentation/BillControllerTest.java @@ -1,4 +1,4 @@ -package server.haengdong.presentation; +package haengdong.presentation; import static org.mockito.ArgumentMatchers.anyLong; import static org.mockito.ArgumentMatchers.anyString; @@ -11,14 +11,14 @@ import java.util.List; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; -import server.haengdong.application.response.BillAppResponse; -import server.haengdong.application.response.BillDetailAppResponse; -import server.haengdong.application.response.BillDetailsAppResponse; -import server.haengdong.application.response.MemberAppResponse; -import server.haengdong.application.response.StepAppResponse; -import server.haengdong.domain.bill.Bill; -import server.haengdong.domain.eventmember.EventMember; -import server.haengdong.support.fixture.Fixture; +import haengdong.event.application.response.BillAppResponse; +import haengdong.event.application.response.BillDetailAppResponse; +import haengdong.event.application.response.BillDetailsAppResponse; +import haengdong.event.application.response.MemberAppResponse; +import haengdong.event.application.response.StepAppResponse; +import haengdong.event.domain.bill.Bill; +import haengdong.event.domain.event.member.EventMember; +import haengdong.support.fixture.Fixture; class BillControllerTest extends ControllerTestSupport { diff --git a/server/src/test/java/server/haengdong/presentation/ControllerTestSupport.java b/server/src/test/java/haengdong/presentation/ControllerTestSupport.java similarity index 67% rename from server/src/test/java/server/haengdong/presentation/ControllerTestSupport.java rename to server/src/test/java/haengdong/presentation/ControllerTestSupport.java index c215715f4..b855a061a 100644 --- a/server/src/test/java/server/haengdong/presentation/ControllerTestSupport.java +++ b/server/src/test/java/haengdong/presentation/ControllerTestSupport.java @@ -1,4 +1,4 @@ -package server.haengdong.presentation; +package haengdong.presentation; import com.fasterxml.jackson.databind.ObjectMapper; import org.springframework.beans.factory.annotation.Autowired; @@ -8,15 +8,18 @@ import org.springframework.context.annotation.FilterType; import org.springframework.test.web.servlet.MockMvc; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; -import server.haengdong.application.AuthService; -import server.haengdong.application.BillService; -import server.haengdong.application.EventImageFacadeService; -import server.haengdong.application.EventService; -import server.haengdong.application.EventMemberService; -import server.haengdong.application.UserService; -import server.haengdong.presentation.admin.AdminBillController; -import server.haengdong.presentation.admin.AdminEventController; -import server.haengdong.presentation.admin.AdminMemberController; +import haengdong.common.auth.application.AuthService; +import haengdong.event.application.BillService; +import haengdong.event.application.EventImageFacadeService; +import haengdong.event.application.EventService; +import haengdong.event.application.EventMemberService; +import haengdong.user.application.UserService; +import haengdong.event.presentation.BillController; +import haengdong.event.presentation.EventController; +import haengdong.event.presentation.EventMemberController; +import haengdong.event.presentation.admin.AdminBillController; +import haengdong.event.presentation.admin.AdminEventController; +import haengdong.event.presentation.admin.AdminMemberController; @WebMvcTest( controllers = { diff --git a/server/src/test/java/server/haengdong/presentation/EventControllerTest.java b/server/src/test/java/haengdong/presentation/EventControllerTest.java similarity index 91% rename from server/src/test/java/server/haengdong/presentation/EventControllerTest.java rename to server/src/test/java/haengdong/presentation/EventControllerTest.java index f7a471f38..056a5b5bc 100644 --- a/server/src/test/java/server/haengdong/presentation/EventControllerTest.java +++ b/server/src/test/java/haengdong/presentation/EventControllerTest.java @@ -1,4 +1,4 @@ -package server.haengdong.presentation; +package haengdong.presentation; import static org.hamcrest.Matchers.equalTo; import static org.mockito.ArgumentMatchers.any; @@ -16,12 +16,12 @@ import org.springframework.http.MediaType; import org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders; import org.springframework.test.web.servlet.result.MockMvcResultMatchers; -import server.haengdong.application.request.EventGuestAppRequest; -import server.haengdong.application.response.EventAppResponse; -import server.haengdong.application.response.EventDetailAppResponse; -import server.haengdong.application.response.EventImageAppResponse; -import server.haengdong.application.response.MemberBillReportAppResponse; -import server.haengdong.presentation.request.EventGuestSaveRequest; +import haengdong.event.application.request.EventGuestAppRequest; +import haengdong.event.application.response.EventAppResponse; +import haengdong.event.application.response.EventDetailAppResponse; +import haengdong.event.application.response.EventImageAppResponse; +import haengdong.event.application.response.MemberBillReportAppResponse; +import haengdong.event.presentation.request.EventGuestSaveRequest; class EventControllerTest extends ControllerTestSupport { diff --git a/server/src/test/java/server/haengdong/presentation/EventEventMemberControllerTest.java b/server/src/test/java/haengdong/presentation/EventEventMemberControllerTest.java similarity index 87% rename from server/src/test/java/server/haengdong/presentation/EventEventMemberControllerTest.java rename to server/src/test/java/haengdong/presentation/EventEventMemberControllerTest.java index 89bda729c..aedb5b0ef 100644 --- a/server/src/test/java/server/haengdong/presentation/EventEventMemberControllerTest.java +++ b/server/src/test/java/haengdong/presentation/EventEventMemberControllerTest.java @@ -1,4 +1,4 @@ -package server.haengdong.presentation; +package haengdong.presentation; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyString; @@ -7,18 +7,18 @@ import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; -import static server.haengdong.support.fixture.Fixture.EVENT_MEMBER_1; -import static server.haengdong.support.fixture.Fixture.EVENT_MEMBER_2; -import static server.haengdong.support.fixture.Fixture.EVENT_MEMBER_3; +import static haengdong.support.fixture.Fixture.EVENT_MEMBER_1; +import static haengdong.support.fixture.Fixture.EVENT_MEMBER_2; +import static haengdong.support.fixture.Fixture.EVENT_MEMBER_3; import java.util.List; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; import org.springframework.http.MediaType; -import server.haengdong.application.response.MemberAppResponse; -import server.haengdong.application.response.MemberDepositAppResponse; -import server.haengdong.application.response.MembersDepositAppResponse; -import server.haengdong.domain.eventmember.EventMember; +import haengdong.event.application.response.MemberAppResponse; +import haengdong.event.application.response.MemberDepositAppResponse; +import haengdong.event.application.response.MembersDepositAppResponse; +import haengdong.event.domain.event.member.EventMember; class EventEventMemberControllerTest extends ControllerTestSupport { diff --git a/server/src/test/java/server/haengdong/presentation/admin/AdminBillControllerTest.java b/server/src/test/java/haengdong/presentation/admin/AdminBillControllerTest.java similarity index 88% rename from server/src/test/java/server/haengdong/presentation/admin/AdminBillControllerTest.java rename to server/src/test/java/haengdong/presentation/admin/AdminBillControllerTest.java index e3599a9ee..32ec84ffc 100644 --- a/server/src/test/java/server/haengdong/presentation/admin/AdminBillControllerTest.java +++ b/server/src/test/java/haengdong/presentation/admin/AdminBillControllerTest.java @@ -1,4 +1,4 @@ -package server.haengdong.presentation.admin; +package haengdong.presentation.admin; import static org.mockito.ArgumentMatchers.any; @@ -8,19 +8,19 @@ import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; -import static server.haengdong.support.fixture.Fixture.EVENT_COOKIE; +import static haengdong.support.fixture.Fixture.EVENT_COOKIE; import java.util.List; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; import org.springframework.http.MediaType; -import server.haengdong.exception.HaengdongErrorCode; -import server.haengdong.exception.HaengdongException; -import server.haengdong.presentation.ControllerTestSupport; -import server.haengdong.presentation.request.BillDetailUpdateRequest; -import server.haengdong.presentation.request.BillDetailsUpdateRequest; -import server.haengdong.presentation.request.BillSaveRequest; -import server.haengdong.presentation.request.BillUpdateRequest; +import haengdong.common.exception.HaengdongErrorCode; +import haengdong.common.exception.HaengdongException; +import haengdong.presentation.ControllerTestSupport; +import haengdong.event.presentation.request.BillDetailUpdateRequest; +import haengdong.event.presentation.request.BillDetailsUpdateRequest; +import haengdong.event.presentation.request.BillSaveRequest; +import haengdong.event.presentation.request.BillUpdateRequest; class AdminBillControllerTest extends ControllerTestSupport { diff --git a/server/src/test/java/server/haengdong/presentation/admin/AdminEventControllerTest.java b/server/src/test/java/haengdong/presentation/admin/AdminEventControllerTest.java similarity index 89% rename from server/src/test/java/server/haengdong/presentation/admin/AdminEventControllerTest.java rename to server/src/test/java/haengdong/presentation/admin/AdminEventControllerTest.java index e071d70d3..b36476e01 100644 --- a/server/src/test/java/server/haengdong/presentation/admin/AdminEventControllerTest.java +++ b/server/src/test/java/haengdong/presentation/admin/AdminEventControllerTest.java @@ -1,17 +1,17 @@ -package server.haengdong.presentation.admin; +package haengdong.presentation.admin; import static org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders.multipart; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.patch; import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; -import static server.haengdong.support.fixture.Fixture.EVENT_COOKIE; +import static haengdong.support.fixture.Fixture.EVENT_COOKIE; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; import org.springframework.http.MediaType; import org.springframework.mock.web.MockMultipartFile; -import server.haengdong.presentation.ControllerTestSupport; -import server.haengdong.presentation.request.EventUpdateRequest; +import haengdong.presentation.ControllerTestSupport; +import haengdong.event.presentation.request.EventUpdateRequest; class AdminEventControllerTest extends ControllerTestSupport { diff --git a/server/src/test/java/server/haengdong/presentation/admin/AdminEventEventMemberControllerTest.java b/server/src/test/java/haengdong/presentation/admin/AdminEventEventMemberControllerTest.java similarity index 86% rename from server/src/test/java/server/haengdong/presentation/admin/AdminEventEventMemberControllerTest.java rename to server/src/test/java/haengdong/presentation/admin/AdminEventEventMemberControllerTest.java index f00dd6059..e1c35f8ff 100644 --- a/server/src/test/java/server/haengdong/presentation/admin/AdminEventEventMemberControllerTest.java +++ b/server/src/test/java/haengdong/presentation/admin/AdminEventEventMemberControllerTest.java @@ -1,4 +1,4 @@ -package server.haengdong.presentation.admin; +package haengdong.presentation.admin; import static org.hamcrest.Matchers.equalTo; import static org.mockito.BDDMockito.given; @@ -7,20 +7,20 @@ import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.put; import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; -import static server.haengdong.support.fixture.Fixture.EVENT_COOKIE; +import static haengdong.support.fixture.Fixture.EVENT_COOKIE; import java.util.List; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; import org.springframework.http.MediaType; import org.springframework.test.web.servlet.result.MockMvcResultMatchers; -import server.haengdong.application.response.MemberSaveAppResponse; -import server.haengdong.application.response.MembersSaveAppResponse; -import server.haengdong.presentation.ControllerTestSupport; -import server.haengdong.presentation.request.MemberSaveRequest; -import server.haengdong.presentation.request.MemberUpdateRequest; -import server.haengdong.presentation.request.MembersSaveRequest; -import server.haengdong.presentation.request.MembersUpdateRequest; +import haengdong.event.application.response.MemberSaveAppResponse; +import haengdong.event.application.response.MembersSaveAppResponse; +import haengdong.presentation.ControllerTestSupport; +import haengdong.event.presentation.request.MemberSaveRequest; +import haengdong.event.presentation.request.MemberUpdateRequest; +import haengdong.event.presentation.request.MembersSaveRequest; +import haengdong.event.presentation.request.MembersUpdateRequest; class AdminEventEventMemberControllerTest extends ControllerTestSupport { diff --git a/server/src/test/java/server/haengdong/support/extension/DatabaseCleaner.java b/server/src/test/java/haengdong/support/extension/DatabaseCleaner.java similarity index 97% rename from server/src/test/java/server/haengdong/support/extension/DatabaseCleaner.java rename to server/src/test/java/haengdong/support/extension/DatabaseCleaner.java index 346e81d2d..bc069869a 100644 --- a/server/src/test/java/server/haengdong/support/extension/DatabaseCleaner.java +++ b/server/src/test/java/haengdong/support/extension/DatabaseCleaner.java @@ -1,4 +1,4 @@ -package server.haengdong.support.extension; +package haengdong.support.extension; import jakarta.annotation.PostConstruct; import jakarta.persistence.EntityManager; diff --git a/server/src/test/java/server/haengdong/support/extension/DatabaseCleanerExtension.java b/server/src/test/java/haengdong/support/extension/DatabaseCleanerExtension.java similarity index 93% rename from server/src/test/java/server/haengdong/support/extension/DatabaseCleanerExtension.java rename to server/src/test/java/haengdong/support/extension/DatabaseCleanerExtension.java index 653ecadb3..5cd9bcc99 100644 --- a/server/src/test/java/server/haengdong/support/extension/DatabaseCleanerExtension.java +++ b/server/src/test/java/haengdong/support/extension/DatabaseCleanerExtension.java @@ -1,4 +1,4 @@ -package server.haengdong.support.extension; +package haengdong.support.extension; import org.junit.jupiter.api.extension.AfterEachCallback; import org.junit.jupiter.api.extension.ExtensionContext; diff --git a/server/src/test/java/server/haengdong/support/fixture/Fixture.java b/server/src/test/java/haengdong/support/fixture/Fixture.java similarity index 80% rename from server/src/test/java/server/haengdong/support/fixture/Fixture.java rename to server/src/test/java/haengdong/support/fixture/Fixture.java index 0bb7ea555..93ed52ad2 100644 --- a/server/src/test/java/server/haengdong/support/fixture/Fixture.java +++ b/server/src/test/java/haengdong/support/fixture/Fixture.java @@ -1,9 +1,9 @@ -package server.haengdong.support.fixture; +package haengdong.support.fixture; import jakarta.servlet.http.Cookie; -import server.haengdong.domain.bill.Bill; -import server.haengdong.domain.eventmember.EventMember; -import server.haengdong.domain.event.Event; +import haengdong.event.domain.bill.Bill; +import haengdong.event.domain.event.member.EventMember; +import haengdong.event.domain.event.Event; public class Fixture {