-
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 #6 from Capstone-Walking/feat/refactor-data-entity
Refactor: #4의 DataEntity 구현을 수정합니다
- Loading branch information
Showing
18 changed files
with
138 additions
and
169 deletions.
There are no files selected for viewing
2 changes: 1 addition & 1 deletion
2
...b/repository/member/MemberRepository.java → ...i/repository/member/MemberRepository.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
2 changes: 1 addition & 1 deletion
2
...itory/member/PathFavoritesRepository.java → ...itory/member/PathFavoritesRepository.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
2 changes: 1 addition & 1 deletion
2
...ry/member/TrafficFavoritesRepository.java → ...ry/member/TrafficFavoritesRepository.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
2 changes: 1 addition & 1 deletion
2
...repository/traffic/TrafficRepository.java → ...repository/traffic/TrafficRepository.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
This file was deleted.
Oops, something went wrong.
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
5 changes: 5 additions & 0 deletions
5
data/src/main/java/com/walking/data/entity/member/CertificationSubject.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.walking.data.entity.member; | ||
|
||
public enum CertificationSubject { | ||
KAKAO, | ||
} |
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
18 changes: 18 additions & 0 deletions
18
data/src/main/java/com/walking/data/entity/member/MemberStatus.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,18 @@ | ||
package com.walking.data.entity.member; | ||
|
||
import lombok.ToString; | ||
|
||
@ToString | ||
public enum MemberStatus { | ||
REGULAR("정회원"), | ||
ASSOCIATE("준회원"), | ||
SEPARATE("장기미이용 회원"), | ||
WITHDRAWN("탈퇴회원"), | ||
; | ||
|
||
private final String description; | ||
|
||
MemberStatus(String description) { | ||
this.description = description; | ||
} | ||
} |
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
12 changes: 12 additions & 0 deletions
12
...c/main/java/com/walking/data/entity/support/listener/TrafficEntitySoftDeleteListener.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,12 @@ | ||
package com.walking.data.entity.support.listener; | ||
|
||
import com.walking.data.entity.traffic.TrafficEntity; | ||
import javax.persistence.PreRemove; | ||
|
||
public class TrafficEntitySoftDeleteListener { | ||
|
||
@PreRemove | ||
private void preRemove(TrafficEntity entity) { | ||
entity.delete(); | ||
} | ||
} |
39 changes: 34 additions & 5 deletions
39
data/src/main/java/com/walking/data/entity/traffic/TrafficEntity.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,32 +1,61 @@ | ||
package com.walking.data.entity.traffic; | ||
|
||
import com.walking.data.entity.BaseEntity; | ||
import com.walking.data.entity.support.listener.TrafficEntitySoftDeleteListener; | ||
import java.time.LocalDateTime; | ||
import javax.persistence.Column; | ||
import javax.persistence.Entity; | ||
import javax.persistence.EntityListeners; | ||
import javax.persistence.GeneratedValue; | ||
import javax.persistence.GenerationType; | ||
import javax.persistence.Id; | ||
import javax.persistence.Table; | ||
import lombok.AccessLevel; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
import lombok.experimental.SuperBuilder; | ||
import org.hibernate.annotations.SQLDelete; | ||
import org.locationtech.jts.geom.Point; | ||
import org.springframework.data.annotation.CreatedDate; | ||
import org.springframework.data.annotation.LastModifiedDate; | ||
import org.springframework.data.jpa.domain.support.AuditingEntityListener; | ||
|
||
@Getter | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
@AllArgsConstructor(access = AccessLevel.PRIVATE) | ||
@Entity | ||
@SuperBuilder(toBuilder = true) | ||
@EntityListeners({AuditingEntityListener.class, TrafficEntitySoftDeleteListener.class}) | ||
@Builder(toBuilder = true) | ||
@Table(name = "traffic") | ||
@SQLDelete(sql = "UPDATE traffic SET deleted=true where id=?") | ||
public class TrafficEntity extends BaseEntity { | ||
public class TrafficEntity { | ||
|
||
@Column(nullable = false, updatable = false) | ||
private String detail; | ||
|
||
@Column(nullable = false) | ||
private String name; | ||
|
||
@Column(columnDefinition = "POINT SRID 4326", nullable = false) | ||
@Column(nullable = false, columnDefinition = "POINT SRID 4326") | ||
private Point point; | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.SEQUENCE) | ||
private Long id; | ||
|
||
@Column(nullable = false, updatable = false) | ||
@CreatedDate | ||
private LocalDateTime createdAt; | ||
|
||
@Column(nullable = false) | ||
@LastModifiedDate | ||
private LocalDateTime updatedAt; | ||
|
||
@Builder.Default | ||
@Column(nullable = false) | ||
private Boolean deleted = false; | ||
|
||
public void delete() { | ||
this.deleted = true; | ||
} | ||
} |
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
Oops, something went wrong.