-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: CenterPosition, Path 중간 테이블 추가
WalkRecord 과 oneToone, oneTomany를 위한 중간 테이블 추가 related to : #38
- Loading branch information
Showing
2 changed files
with
79 additions
and
0 deletions.
There are no files selected for viewing
45 changes: 45 additions & 0 deletions
45
be/src/main/java/buddyguard/mybuddyguard/walk/entity/WalkRecordCenterPosition.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,45 @@ | ||
package buddyguard.mybuddyguard.walk.entity; | ||
|
||
import jakarta.persistence.Column; | ||
import jakarta.persistence.ConstraintMode; | ||
import jakarta.persistence.Entity; | ||
import jakarta.persistence.FetchType; | ||
import jakarta.persistence.ForeignKey; | ||
import jakarta.persistence.GeneratedValue; | ||
import jakarta.persistence.GenerationType; | ||
import jakarta.persistence.Id; | ||
import jakarta.persistence.JoinColumn; | ||
import jakarta.persistence.OneToOne; | ||
import jakarta.persistence.Table; | ||
import lombok.AccessLevel; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Entity | ||
@Table(name = "WALK_RECORD_CENTER_POSITION") | ||
@Getter | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
@AllArgsConstructor | ||
@Builder | ||
public class WalkRecordCenterPosition { | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long id; | ||
|
||
// WalkRecord와 1:1 관계 설정 | ||
@OneToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "walk_record_id", foreignKey = @ForeignKey(ConstraintMode.NO_CONSTRAINT)) | ||
private WalkRecord walkRecord; | ||
|
||
// 위도 정보 | ||
@Column(name = "latitude", nullable = false) | ||
private Double latitude; | ||
|
||
// 경도 정보 | ||
@Column(name = "longitude", nullable = false) | ||
private Double longitude; | ||
|
||
} |
34 changes: 34 additions & 0 deletions
34
be/src/main/java/buddyguard/mybuddyguard/walk/entity/WalkRecordPath.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,34 @@ | ||
package buddyguard.mybuddyguard.walk.entity; | ||
|
||
import jakarta.persistence.Column; | ||
import jakarta.persistence.Entity; | ||
import jakarta.persistence.GeneratedValue; | ||
import jakarta.persistence.GenerationType; | ||
import jakarta.persistence.Id; | ||
import jakarta.persistence.Table; | ||
import lombok.AccessLevel; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Entity | ||
@Table(name = "WALK_RECORD_PATH") | ||
@Getter | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
@AllArgsConstructor | ||
@Builder | ||
public class WalkRecordPath { | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long id; | ||
|
||
// 경로의 위도 | ||
@Column(name = "latitude", nullable = false) | ||
private Double latitude; | ||
|
||
// 경로의 경도 | ||
@Column(name = "longitude", nullable = false) | ||
private Double longitude; | ||
} |