-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #20 from lotteon2/dev-user-refactor
fix: fix the updating the updatedAt when init the store-user status
Showing
5 changed files
with
25 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 19 additions & 4 deletions
23
src/main/java/com/bit/lotte/flower/user/store/service/StoreManagerServiceImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,42 @@ | ||
package com.bit.lotte.flower.user.store.service; | ||
|
||
import com.bit.lotte.flower.user.common.valueobject.StoreId; | ||
import com.bit.lotte.flower.user.common.valueobject.UserId; | ||
import com.bit.lotte.flower.user.store.entity.StoreManager; | ||
import com.bit.lotte.flower.user.store.mapper.StoreManagerMapper; | ||
import com.bit.lotte.flower.user.store.repository.StoreManagerJpaRepository; | ||
import java.time.LocalDateTime; | ||
import javax.persistence.EntityManager; | ||
import lombok.RequiredArgsConstructor; | ||
import lombok.extern.slf4j.Slf4j; | ||
import net.bytebuddy.asm.Advice.AssignReturned.ToReturned; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.stereotype.Service; | ||
import org.springframework.transaction.annotation.Transactional; | ||
|
||
@RequiredArgsConstructor | ||
@Service | ||
@Slf4j | ||
public class StoreManagerServiceImpl implements | ||
StoreManagerService<UserId> { | ||
|
||
private final StoreManagerJpaRepository repository; | ||
private final FindStoreMangerService findStoreMangerByIdService; | ||
private final EntityManager entityManager; | ||
|
||
|
||
@Transactional | ||
@Override | ||
public UserId updateBusinessNumber(String email, String businessNumberImage) { | ||
StoreManager storeManager = findStoreMangerByIdService.findByEmail(email); | ||
repository.save(StoreManagerMapper.storeManagerUpdatedPhoneNumber( | ||
storeManager, businessNumberImage)); | ||
StoreManager updatedManager = repository.save( | ||
StoreManagerMapper.storeManagerUpdatedBusinessNumber( | ||
storeManager, businessNumberImage)); | ||
|
||
entityManager.detach(storeManager); | ||
updatedManager.setUpdatedAt(LocalDateTime.now()); | ||
|
||
storeManager = entityManager.merge(storeManager); | ||
|
||
return new UserId(storeManager.getId()); | ||
return new UserId(storeManager.getId()); | ||
} | ||
} |
60 changes: 0 additions & 60 deletions
60
...test/java/com/bit/lotte/flower/user/store/service/mypage/StoreManagerServiceImplTest.java
This file was deleted.
Oops, something went wrong.