-
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.
Merge pull request #30 from 29sungdong/feat/walk
[feat] 산책 경로 생성 API 구현
- Loading branch information
Showing
25 changed files
with
315 additions
and
69 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
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
3 changes: 0 additions & 3 deletions
3
src/main/java/sungdong29/backend/domain/badge/service/BadgeService.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 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
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
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
42 changes: 13 additions & 29 deletions
42
src/main/java/sungdong29/backend/domain/walk/domain/Walk.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,47 +1,31 @@ | ||
package sungdong29.backend.domain.walk.domain; | ||
|
||
import jakarta.persistence.*; | ||
import jakarta.validation.constraints.NotNull; | ||
import jakarta.validation.constraints.Size; | ||
import lombok.AccessLevel; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
import org.springframework.data.annotation.CreatedDate; | ||
import org.springframework.data.jpa.domain.support.AuditingEntityListener; | ||
import sungdong29.backend.domain.place.domain.Place; | ||
import sungdong29.backend.domain.user.domain.User; | ||
|
||
import java.time.LocalDateTime; | ||
|
||
@Getter | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
@Entity | ||
@EntityListeners(AuditingEntityListener.class) | ||
public class Walk { | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
@Column(name = "walk_id") | ||
private Long id; | ||
|
||
@ManyToOne | ||
@JoinColumn(name="user_id") | ||
private User user; | ||
|
||
@ManyToOne | ||
@JoinColumn(name="place_id") | ||
private Place place; | ||
|
||
@CreatedDate | ||
private LocalDateTime createdAt; | ||
@NotNull | ||
@Size(max = 20) | ||
private String name; | ||
|
||
@Builder | ||
private Walk(User user, Place place) { | ||
this.user=user; | ||
this.place=place; | ||
} | ||
@NotNull | ||
@Size(max = 50) | ||
private String xCoordinate; | ||
|
||
public static Walk of(User user, Place place) { | ||
return Walk.builder() | ||
.user(user) | ||
.place(place) | ||
.build(); | ||
} | ||
@NotNull | ||
@Size(max = 50) | ||
private String yCoordinate; | ||
} |
47 changes: 47 additions & 0 deletions
47
src/main/java/sungdong29/backend/domain/walk/domain/WalkHistory.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,47 @@ | ||
package sungdong29.backend.domain.walk.domain; | ||
|
||
import jakarta.persistence.*; | ||
import lombok.AccessLevel; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
import org.springframework.data.annotation.CreatedDate; | ||
import org.springframework.data.jpa.domain.support.AuditingEntityListener; | ||
import sungdong29.backend.domain.place.domain.Place; | ||
import sungdong29.backend.domain.user.domain.User; | ||
|
||
import java.time.LocalDateTime; | ||
|
||
@Getter | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
@Entity | ||
@EntityListeners(AuditingEntityListener.class) | ||
public class WalkHistory { | ||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long id; | ||
|
||
@ManyToOne | ||
@JoinColumn(name="user_id") | ||
private User user; | ||
|
||
@ManyToOne | ||
@JoinColumn(name="place_id") | ||
private Place place; | ||
|
||
@CreatedDate | ||
private LocalDateTime createdAt; | ||
|
||
@Builder | ||
private WalkHistory(User user, Place place) { | ||
this.user=user; | ||
this.place=place; | ||
} | ||
|
||
public static WalkHistory of(User user, Place place) { | ||
return WalkHistory.builder() | ||
.user(user) | ||
.place(place) | ||
.build(); | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
src/main/java/sungdong29/backend/domain/walk/dto/response/WalkPathListResponseDTO.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,22 @@ | ||
package sungdong29.backend.domain.walk.dto.response; | ||
|
||
import lombok.Builder; | ||
import sungdong29.backend.domain.walk.vo.WalkPathVo; | ||
|
||
import java.util.List; | ||
|
||
public class WalkPathListResponseDTO { | ||
|
||
List<WalkPathVo> walkPathList; | ||
|
||
@Builder | ||
private WalkPathListResponseDTO(List<WalkPathVo> walkPathList) { | ||
this.walkPathList = walkPathList; | ||
} | ||
|
||
public static WalkPathListResponseDTO from(List<WalkPathVo> walkPathList) { | ||
return WalkPathListResponseDTO.builder() | ||
.walkPathList(walkPathList) | ||
.build(); | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
src/main/java/sungdong29/backend/domain/walk/dto/response/WalkPathResponseDTO.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,33 @@ | ||
package sungdong29.backend.domain.walk.dto.response; | ||
|
||
import lombok.Builder; | ||
import lombok.Getter; | ||
import sungdong29.backend.domain.walk.domain.Walk; | ||
|
||
import java.util.List; | ||
|
||
@Getter | ||
public class WalkPathResponseDTO { | ||
|
||
private Long id; | ||
private String name; | ||
private List<String> lineString; | ||
|
||
@Builder | ||
private WalkPathResponseDTO( | ||
Long id, | ||
String name, | ||
List<String> lineString) { | ||
this.id = id; | ||
this.name = name; | ||
this.lineString = lineString; | ||
} | ||
|
||
public static WalkPathResponseDTO of(Walk walk, List<String> lineString) { | ||
return WalkPathResponseDTO.builder() | ||
.id(walk.getId()) | ||
.name(walk.getName()) | ||
.lineString(lineString) | ||
.build(); | ||
} | ||
} |
Oops, something went wrong.