-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Feature/#15
- Loading branch information
Showing
7 changed files
with
163 additions
and
4 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
30 changes: 30 additions & 0 deletions
30
src/main/java/Journey/Together/domain/member/dto/InterestDto.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,30 @@ | ||
package Journey.Together.domain.member.dto; | ||
|
||
import com.fasterxml.jackson.annotation.JsonInclude; | ||
import jakarta.validation.constraints.Null; | ||
import lombok.Builder; | ||
|
||
@Builder | ||
@JsonInclude(JsonInclude.Include.NON_NULL) | ||
public record InterestDto ( | ||
Boolean isPysical, | ||
Boolean isHear, | ||
Boolean isVisual, | ||
Boolean isElderly, | ||
Boolean isChild | ||
){ | ||
public static InterestDto of( Boolean isPysical, | ||
Boolean isHear, | ||
Boolean isVisual, | ||
Boolean isElderly, | ||
Boolean isChild){ | ||
return InterestDto.builder() | ||
.isPysical(isPysical) | ||
.isHear(isHear) | ||
.isChild(isChild) | ||
.isElderly(isElderly) | ||
.isVisual(isVisual) | ||
.build(); | ||
} | ||
|
||
} |
56 changes: 56 additions & 0 deletions
56
src/main/java/Journey/Together/domain/member/entity/Interest.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,56 @@ | ||
package Journey.Together.domain.member.entity; | ||
|
||
import Journey.Together.domain.member.dto.InterestDto; | ||
import Journey.Together.global.common.BaseTimeEntity; | ||
import jakarta.persistence.*; | ||
import lombok.*; | ||
|
||
@Setter | ||
@Getter | ||
@Entity | ||
@Table(name = "interest") | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
@AllArgsConstructor | ||
public class Interest extends BaseTimeEntity { | ||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
@Column(name = "interest_id", columnDefinition = "bigint") | ||
private Long interestId; | ||
|
||
@ManyToOne(targetEntity = Member.class, fetch = FetchType.LAZY) | ||
@JoinColumn(name = "member_id") | ||
private Member member; | ||
|
||
@Column(name = "pysical") | ||
private Boolean isPysical; | ||
|
||
@Column(name = "hear") | ||
private Boolean isHear; | ||
|
||
@Column(name = "visual") | ||
private Boolean isVisual; | ||
|
||
@Column(name = "child") | ||
private Boolean isChild; | ||
|
||
@Column(name = "elderly") | ||
private Boolean isElderly; | ||
|
||
public void update(InterestDto interestDto) { | ||
this.isPysical=interestDto.isPysical(); | ||
this.isHear=interestDto.isHear(); | ||
this.isVisual=interestDto.isVisual(); | ||
this.isChild=interestDto.isChild(); | ||
this.isElderly = interestDto.isElderly(); | ||
} | ||
|
||
@Builder | ||
public Interest(Member member, Boolean isPysical, Boolean isHear, Boolean isVisual, Boolean isElderly, Boolean isChild){ | ||
this.member = member; | ||
this.isPysical=isPysical; | ||
this.isHear=isHear; | ||
this.isVisual=isVisual; | ||
this.isChild=isChild; | ||
this.isElderly = isElderly; | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
src/main/java/Journey/Together/domain/member/repository/InterestRepository.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 Journey.Together.domain.member.repository; | ||
|
||
import Journey.Together.domain.member.entity.Interest; | ||
import Journey.Together.domain.member.entity.Member; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
|
||
public interface InterestRepository extends JpaRepository<Interest,Long> { | ||
Interest findByMemberAndDeletedAtIsNull(Member member); | ||
|
||
} |
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