Skip to content

Commit

Permalink
Merge pull request #207 from miIlicon/bugFix/207-bulkInsert
Browse files Browse the repository at this point in the history
[#207] id매칭 하드코딩 제거
  • Loading branch information
angelSuho authored Sep 14, 2023
2 parents 0069dd1 + 79e6b7c commit 9587d47
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions src/main/java/com/festival/common/data/Data.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ CommandLineRunner initData(
if (initDataDone) return;

initDataDone = true;
memberService.join(MemberJoinReq.of("user", "1234", "ADMIN"));
imageRepository.save(Image.builder()
Long memberId = memberService.join(MemberJoinReq.of("user", "1234", "ADMIN"));
Long imageId = imageRepository.save(Image.builder()
.mainFilePath("")
.subFilePaths(List.of("")).build());
.subFilePaths(List.of("")).build()).getId();

int cnt = 1;
long start = System.currentTimeMillis();
Expand All @@ -54,8 +54,8 @@ CommandLineRunner initData(
.longitude(50L)
.latitude(50L)
.type("PUB")
.imageId(1L)
.memberId(1L)
.imageId(imageId)
.memberId(memberId)
.lastModifiedBy("user")
.createdBy("user")
.build());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@ public class MemberService {
private final AuthenticationManagerBuilder authenticationManagerBuilder;

@Transactional
public void join(MemberJoinReq memberJoinReq) {
public Long join(MemberJoinReq memberJoinReq) {
if (isLoginIdSave(memberJoinReq.getUsername())) {
throw new DuplicationException(DUPLICATION_ID);
}
Member member = Member.of(memberJoinReq, passwordEncoder.encode(memberJoinReq.getPassword()));
Member savedMember = memberRepository.save(member);
return memberRepository.save(member).getId();
}

public JwtTokenRes login(MemberLoginReq loginReq) {
Expand Down

0 comments on commit 9587d47

Please sign in to comment.