-
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 #15 from PawWithU/feat/13-entity-divide
[Feature] 이동봉사자, 이동봉사 중개 Entity 분리
- Loading branch information
Showing
15 changed files
with
144 additions
and
105 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
25 changes: 0 additions & 25 deletions
25
src/main/java/com/pawwithu/connectdog/domain/auth/dto/request/SignUpRequest.java
This file was deleted.
Oops, something went wrong.
17 changes: 17 additions & 0 deletions
17
src/main/java/com/pawwithu/connectdog/domain/auth/dto/request/VolunteerSignUpRequest.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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package com.pawwithu.connectdog.domain.auth.dto.request; | ||
|
||
import com.pawwithu.connectdog.domain.volunteer.entity.Volunteer; | ||
import com.pawwithu.connectdog.domain.volunteer.entity.VolunteerRole; | ||
|
||
public record VolunteerSignUpRequest(String email, String password, String nickname, Boolean isOptionAgr) { | ||
|
||
public Volunteer toEntity() { | ||
return Volunteer.builder() | ||
.email(email) | ||
.password(password) | ||
.nickname(nickname) | ||
.isOptionAgr(isOptionAgr) | ||
.role(VolunteerRole.USER) | ||
.build(); | ||
} | ||
} |
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
40 changes: 40 additions & 0 deletions
40
src/main/java/com/pawwithu/connectdog/domain/intermediary/entity/Intermediary.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 |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package com.pawwithu.connectdog.domain.intermediary.entity; | ||
|
||
import jakarta.persistence.*; | ||
import lombok.*; | ||
import org.springframework.security.crypto.password.PasswordEncoder; | ||
|
||
@Getter | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
@AllArgsConstructor | ||
@Entity | ||
public class Intermediary { | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long id; | ||
private String email; // 이메일 | ||
private String password; // 비밀번호 | ||
@Column(length = 20, nullable = false) | ||
private String name; // 중개자 이름/중개 단체명 | ||
private String url; // 이동봉사 계정 링크 | ||
private String authImage; // 인증 사진 | ||
@Enumerated(EnumType.STRING) | ||
private IntermediaryRole role; // 권한 | ||
private Boolean isOptionAgr; // 선택 이용약관 체크 여부 | ||
|
||
@Builder | ||
public Intermediary(String email, String password, String name, String url, String authImage, IntermediaryRole role, Boolean isOptionAgr) { | ||
this.email = email; | ||
this.password = password; | ||
this.name = name; | ||
this.url = url; | ||
this.authImage = authImage; | ||
this.role = role; | ||
this.isOptionAgr = isOptionAgr; | ||
} | ||
|
||
public void passwordEncode(PasswordEncoder passwordEncoder) { | ||
this.password = passwordEncoder.encode(this.password); | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
src/main/java/com/pawwithu/connectdog/domain/intermediary/entity/IntermediaryRole.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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package com.pawwithu.connectdog.domain.intermediary.entity; | ||
|
||
import lombok.Getter; | ||
import lombok.RequiredArgsConstructor; | ||
|
||
@Getter | ||
@RequiredArgsConstructor | ||
public enum IntermediaryRole { | ||
|
||
INTERMEDIARY("ROLE_INTERMEDIARY"), AUTH_INTERMEDIARY("ROLE_AUTH_INTERMEDIARY"); | ||
|
||
private final String key; | ||
} |
10 changes: 10 additions & 0 deletions
10
...n/java/com/pawwithu/connectdog/domain/intermediary/repository/IntermediaryRepository.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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package com.pawwithu.connectdog.domain.intermediary.repository; | ||
|
||
import com.pawwithu.connectdog.domain.intermediary.entity.Intermediary; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
|
||
public interface IntermediaryRepository extends JpaRepository<Intermediary, Long> { | ||
|
||
Boolean existsByEmail(String email); | ||
Boolean existsByName(String name); | ||
} |
15 changes: 0 additions & 15 deletions
15
src/main/java/com/pawwithu/connectdog/domain/member/entity/Role.java
This file was deleted.
Oops, something went wrong.
5 changes: 0 additions & 5 deletions
5
src/main/java/com/pawwithu/connectdog/domain/member/entity/SocialType.java
This file was deleted.
Oops, something went wrong.
20 changes: 0 additions & 20 deletions
20
src/main/java/com/pawwithu/connectdog/domain/member/repository/MemberRepository.java
This file was deleted.
Oops, something went wrong.
5 changes: 5 additions & 0 deletions
5
src/main/java/com/pawwithu/connectdog/domain/volunteer/entity/SocialType.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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package com.pawwithu.connectdog.domain.volunteer.entity; | ||
|
||
public enum SocialType { | ||
KAKAO, NAVER | ||
} |
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
14 changes: 14 additions & 0 deletions
14
src/main/java/com/pawwithu/connectdog/domain/volunteer/entity/VolunteerRole.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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package com.pawwithu.connectdog.domain.volunteer.entity; | ||
|
||
import lombok.Getter; | ||
import lombok.RequiredArgsConstructor; | ||
|
||
@Getter | ||
@RequiredArgsConstructor | ||
public enum VolunteerRole { | ||
|
||
USER("ROLE_USER"), AUTH_USER("ROLE_AUTH_USER"); | ||
|
||
private final String key; | ||
|
||
} |
16 changes: 16 additions & 0 deletions
16
src/main/java/com/pawwithu/connectdog/domain/volunteer/repository/VolunteerRepository.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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package com.pawwithu.connectdog.domain.volunteer.repository; | ||
|
||
import com.pawwithu.connectdog.domain.volunteer.entity.Volunteer; | ||
import com.pawwithu.connectdog.domain.volunteer.entity.SocialType; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
|
||
import java.util.Optional; | ||
|
||
public interface VolunteerRepository extends JpaRepository<Volunteer, Long> { | ||
|
||
// 소셜 타입과 소셜의 식별값으로 회원 찾는 메소드 -> 추가 정보를 입력받아 회원가입 진행 시 이용 | ||
Optional<Volunteer> findBySocialTypeAndSocialId(SocialType socialType, String socialId); | ||
Boolean existsByEmail(String email); | ||
Boolean existsByNickname(String nickname); | ||
|
||
} |
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