From b14a0ed7a86793d23bf24b5cfcc4980b5e8689b4 Mon Sep 17 00:00:00 2001 From: BaeJunho Date: Thu, 19 Sep 2024 19:54:07 +0900 Subject: [PATCH 01/23] =?UTF-8?q?feat=20:=20=EB=8F=84=EB=A9=94=EC=9D=B8=20?= =?UTF-8?q?=EC=B4=88=EA=B8=B0=20=EC=84=A4=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 비즈니스 로직을 추가하지 않은 단순 도메인 클래스 생성 및 더미 데이터 삽입 --- .../inplace/video/entity/Influencer.java | 17 ++++++++++++++ .../team7/inplace/video/entity/Place.java | 17 ++++++++++++++ .../team7/inplace/video/entity/Video.java | 22 +++++++++++++++++++ 3 files changed, 56 insertions(+) create mode 100644 src/main/java/team7/inplace/video/entity/Influencer.java create mode 100644 src/main/java/team7/inplace/video/entity/Place.java create mode 100644 src/main/java/team7/inplace/video/entity/Video.java diff --git a/src/main/java/team7/inplace/video/entity/Influencer.java b/src/main/java/team7/inplace/video/entity/Influencer.java new file mode 100644 index 00000000..c8524430 --- /dev/null +++ b/src/main/java/team7/inplace/video/entity/Influencer.java @@ -0,0 +1,17 @@ +package team7.inplace.video.entity; + +import jakarta.persistence.Entity; +import jakarta.persistence.Id; + +@Entity +public class Influencer { + /* + * 더미 데이터 입니다 !!! + */ + @Id + private Long id; + + protected Influencer() { + + } +} diff --git a/src/main/java/team7/inplace/video/entity/Place.java b/src/main/java/team7/inplace/video/entity/Place.java new file mode 100644 index 00000000..f3284515 --- /dev/null +++ b/src/main/java/team7/inplace/video/entity/Place.java @@ -0,0 +1,17 @@ +package team7.inplace.video.entity; + +import jakarta.persistence.Entity; +import jakarta.persistence.Id; + +@Entity +public class Place { + /* + * 더미 데이터 입니다 !!! + */ + @Id + private Long id; + + protected Place(){ + + } +} diff --git a/src/main/java/team7/inplace/video/entity/Video.java b/src/main/java/team7/inplace/video/entity/Video.java new file mode 100644 index 00000000..da5fafd0 --- /dev/null +++ b/src/main/java/team7/inplace/video/entity/Video.java @@ -0,0 +1,22 @@ +package team7.inplace.video.entity; + +import jakarta.persistence.*; +import lombok.Getter; +import lombok.NoArgsConstructor; + +@Entity +@Getter +@NoArgsConstructor(access = lombok.AccessLevel.PROTECTED) +public class Video { + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Long id; + @Column(name="video_url") + private String videoUrl; + @ManyToOne + @JoinColumn(name = "influencer_id") + private Influencer influencer; + @ManyToOne + @JoinColumn(name = "place_id") + private Place place; +} From 91a0d11271233c66315bacae46ed11442c98196d Mon Sep 17 00:00:00 2001 From: dong_yxxn Date: Thu, 19 Sep 2024 20:03:06 +0900 Subject: [PATCH 02/23] =?UTF-8?q?[feat]=20place=20=EC=97=94=ED=8B=B0?= =?UTF-8?q?=ED=8B=B0=20=EA=B5=AC=ED=98=84=20place=20=EC=97=94=ED=8B=B0?= =?UTF-8?q?=ED=8B=B0=EB=A5=BC=20=EA=B5=AC=ED=98=84=ED=96=88=EC=8A=B5?= =?UTF-8?q?=EB=8B=88=EB=8B=A4.=20category=EB=A5=BC=20enum=ED=83=80?= =?UTF-8?q?=EC=9E=85=EC=9C=BC=EB=A1=9C=20=EC=B6=94=EA=B0=80=ED=95=A0=20?= =?UTF-8?q?=EC=98=88=EC=A0=95=EC=9E=85=EB=8B=88=EB=8B=A4.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 관련이슈: #7 --- .../team7/inplace/place/domain/place.java | 64 +++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 src/main/java/team7/inplace/place/domain/place.java diff --git a/src/main/java/team7/inplace/place/domain/place.java b/src/main/java/team7/inplace/place/domain/place.java new file mode 100644 index 00000000..0adea2d9 --- /dev/null +++ b/src/main/java/team7/inplace/place/domain/place.java @@ -0,0 +1,64 @@ +package team7.inplace.place.domain; + +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Id; +import lombok.Getter; +import org.hibernate.annotations.ColumnDefault; + +@Entity +@Getter +public class place { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(nullable = false, columnDefinition = "BIGINT(20)") + private Long placeId; + + @Column(nullable = false, columnDefinition = "varchar(50)") + private String name; + + @ColumnDefault("false") + @Column(nullable = false) + private boolean pet; + + @ColumnDefault("false") + @Column(nullable = false) + private boolean wifi; + + @ColumnDefault("false") + @Column(nullable = false) + private boolean parking; + + @ColumnDefault("false") + @Column(nullable = false) + private boolean fordisabled; + + @ColumnDefault("false") + @Column(nullable = false) + private boolean nursery; + + @ColumnDefault("false") + @Column(nullable = false) + private boolean smokingroom; + + @Column(nullable = false, columnDefinition = "varchar(50)") + private String address1; + + @Column(nullable = false, columnDefinition = "varchar(50)") + private String address2; + + @Column(nullable = false, columnDefinition = "varchar(50)") + private String address3; + + @Column + private String menuImgUrl; + + @Column(nullable = false, columnDefinition = "TEXT") + private String longitude; + + @Column(nullable = false, columnDefinition = "TEXT") + private String latitude; +} From 6cb2fc1f1f023af3e662c713776ca441251ee906 Mon Sep 17 00:00:00 2001 From: dong_yxxn Date: Thu, 19 Sep 2024 20:05:54 +0900 Subject: [PATCH 03/23] =?UTF-8?q?[feat]=20Category=20enum=20=EA=B5=AC?= =?UTF-8?q?=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit place 클래스에서 Category를 이용할 수 있도록 enum으로 구현했습니다. 관련 이슈: #7 --- src/main/java/team7/inplace/place/domain/Category.java | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 src/main/java/team7/inplace/place/domain/Category.java diff --git a/src/main/java/team7/inplace/place/domain/Category.java b/src/main/java/team7/inplace/place/domain/Category.java new file mode 100644 index 00000000..974d1ea7 --- /dev/null +++ b/src/main/java/team7/inplace/place/domain/Category.java @@ -0,0 +1,8 @@ +package team7.inplace.place.domain; + +public enum Category { + CAFE, + WESTERN, + JAPANESE, + KOREAN +} From e90d172553848699c126398f247bfb256e92ed67 Mon Sep 17 00:00:00 2001 From: dong_yxxn Date: Thu, 19 Sep 2024 20:15:01 +0900 Subject: [PATCH 04/23] =?UTF-8?q?[feat]=20Category=20=EB=A9=A4=EB=B2=84?= =?UTF-8?q?=EB=B3=80=EC=88=98=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Category를 String으로 DB에 저장될수있도록 했습니다. 관련 이슈: #7 --- src/main/java/team7/inplace/place/domain/place.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main/java/team7/inplace/place/domain/place.java b/src/main/java/team7/inplace/place/domain/place.java index 0adea2d9..72c6a0dd 100644 --- a/src/main/java/team7/inplace/place/domain/place.java +++ b/src/main/java/team7/inplace/place/domain/place.java @@ -2,6 +2,8 @@ import jakarta.persistence.Column; import jakarta.persistence.Entity; +import jakarta.persistence.EnumType; +import jakarta.persistence.Enumerated; import jakarta.persistence.GeneratedValue; import jakarta.persistence.GenerationType; import jakarta.persistence.Id; @@ -56,6 +58,10 @@ public class place { @Column private String menuImgUrl; + @Enumerated(EnumType.STRING) + @Column(nullable = false) + private Category category; + @Column(nullable = false, columnDefinition = "TEXT") private String longitude; From 2d51fef9dfaf3ba447966f961abb52e909a86433 Mon Sep 17 00:00:00 2001 From: dong_yxxn Date: Thu, 19 Sep 2024 20:17:00 +0900 Subject: [PATCH 05/23] =?UTF-8?q?[refactor]=20menuImgUrl=20=ED=83=80?= =?UTF-8?q?=EC=9E=85=EC=9D=84=20TEXT=EB=A1=9C=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 기존 String으로 저장되던것을 TEXT로 저장되도록 변경함 관련 이슈: #7 --- src/main/java/team7/inplace/place/domain/place.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/team7/inplace/place/domain/place.java b/src/main/java/team7/inplace/place/domain/place.java index 72c6a0dd..d1fad613 100644 --- a/src/main/java/team7/inplace/place/domain/place.java +++ b/src/main/java/team7/inplace/place/domain/place.java @@ -55,7 +55,7 @@ public class place { @Column(nullable = false, columnDefinition = "varchar(50)") private String address3; - @Column + @Column(columnDefinition = "TEXT") private String menuImgUrl; @Enumerated(EnumType.STRING) From e02ac4ac899da734c4d9175ed4b031a8289dc5c9 Mon Sep 17 00:00:00 2001 From: dong_yxxn Date: Thu, 19 Sep 2024 20:19:11 +0900 Subject: [PATCH 06/23] =?UTF-8?q?[refactor]=20=ED=81=B4=EB=9E=98=EC=8A=A4?= =?UTF-8?q?=EC=9D=B4=EB=A6=84=20=EC=B2=AB=EA=B8=80=EC=9E=90=20=EB=8C=80?= =?UTF-8?q?=EB=AC=B8=EC=9E=90=EB=A1=9C=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit place -> Place로 이름 첫글자를 대문자로 바꿨습니다. 관련 이슈: #7 --- .../java/team7/inplace/place/domain/{place.java => Place.java} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename src/main/java/team7/inplace/place/domain/{place.java => Place.java} (98%) diff --git a/src/main/java/team7/inplace/place/domain/place.java b/src/main/java/team7/inplace/place/domain/Place.java similarity index 98% rename from src/main/java/team7/inplace/place/domain/place.java rename to src/main/java/team7/inplace/place/domain/Place.java index d1fad613..295be5b1 100644 --- a/src/main/java/team7/inplace/place/domain/place.java +++ b/src/main/java/team7/inplace/place/domain/Place.java @@ -12,7 +12,7 @@ @Entity @Getter -public class place { +public class Place { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) From 7623f8a61a7af3c5c7a182db53061e20f6435383 Mon Sep 17 00:00:00 2001 From: dong_yxxn Date: Thu, 19 Sep 2024 20:21:59 +0900 Subject: [PATCH 07/23] =?UTF-8?q?[feat]=20Place=20=EB=A6=AC=ED=8D=BC?= =?UTF-8?q?=EC=A7=80=ED=86=A0=EB=A6=AC=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Place의 Repository를 구현했습니다. 관련 이슈: #7 --- .../inplace/place/repository/PlaceRepository.java | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 src/main/java/team7/inplace/place/repository/PlaceRepository.java diff --git a/src/main/java/team7/inplace/place/repository/PlaceRepository.java b/src/main/java/team7/inplace/place/repository/PlaceRepository.java new file mode 100644 index 00000000..30488a18 --- /dev/null +++ b/src/main/java/team7/inplace/place/repository/PlaceRepository.java @@ -0,0 +1,10 @@ +package team7.inplace.place.repository; + +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.stereotype.Repository; +import team7.inplace.place.domain.Place; + +@Repository +public interface PlaceRepository extends JpaRepository { + +} From efffe9ab9c677267bb5f6e145c3b260b078b76f2 Mon Sep 17 00:00:00 2001 From: dong_yxxn Date: Thu, 19 Sep 2024 20:34:08 +0900 Subject: [PATCH 08/23] =?UTF-8?q?[feat]=20Place=20=EC=83=9D=EC=84=B1?= =?UTF-8?q?=EC=9E=90=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Place 클래스 생성자를 추가했습니다. 관련 이슈: #7 --- .../team7/inplace/place/domain/Place.java | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/src/main/java/team7/inplace/place/domain/Place.java b/src/main/java/team7/inplace/place/domain/Place.java index 295be5b1..4022af2b 100644 --- a/src/main/java/team7/inplace/place/domain/Place.java +++ b/src/main/java/team7/inplace/place/domain/Place.java @@ -7,6 +7,7 @@ import jakarta.persistence.GeneratedValue; import jakarta.persistence.GenerationType; import jakarta.persistence.Id; +import lombok.Builder; import lombok.Getter; import org.hibernate.annotations.ColumnDefault; @@ -67,4 +68,28 @@ public class Place { @Column(nullable = false, columnDefinition = "TEXT") private String latitude; + + //Constructor + protected Place() { + } + + @Builder + public Place(String name, boolean pet, boolean wifi, boolean parking, boolean fordisabled, + boolean nursery, boolean smokingroom, String address1, String address2, + String address3, String menuImgUrl, Category category, String longitude, String latitude) { + this.name = name; + this.pet = pet; + this.wifi = wifi; + this.parking = parking; + this.fordisabled = fordisabled; + this.nursery = nursery; + this.smokingroom = smokingroom; + this.address1 = address1; + this.address2 = address2; + this.address3 = address3; + this.menuImgUrl = menuImgUrl; + this.category = category; + this.longitude = longitude; + this.latitude = latitude; + } } From 8808544e40974eaaa863c06beafa656006fe063d Mon Sep 17 00:00:00 2001 From: dong_yxxn Date: Thu, 19 Sep 2024 20:39:58 +0900 Subject: [PATCH 09/23] =?UTF-8?q?[refactor]=20Place=20Table=EC=96=B4?= =?UTF-8?q?=EB=85=B8=ED=85=8C=EC=9D=B4=EC=85=98=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Place 클래스에 Table 어노테이션을 추가해서 places 로 지정하였습니다. 관련 이슈: #7 --- .../java/team7/inplace/place/controller/PlaceController.java | 2 ++ src/main/java/team7/inplace/place/domain/Place.java | 2 ++ 2 files changed, 4 insertions(+) create mode 100644 src/main/java/team7/inplace/place/controller/PlaceController.java diff --git a/src/main/java/team7/inplace/place/controller/PlaceController.java b/src/main/java/team7/inplace/place/controller/PlaceController.java new file mode 100644 index 00000000..2661f5b6 --- /dev/null +++ b/src/main/java/team7/inplace/place/controller/PlaceController.java @@ -0,0 +1,2 @@ +package team7.inplace.place.controller;public class PlaceController { +} diff --git a/src/main/java/team7/inplace/place/domain/Place.java b/src/main/java/team7/inplace/place/domain/Place.java index 4022af2b..f786050a 100644 --- a/src/main/java/team7/inplace/place/domain/Place.java +++ b/src/main/java/team7/inplace/place/domain/Place.java @@ -7,11 +7,13 @@ import jakarta.persistence.GeneratedValue; import jakarta.persistence.GenerationType; import jakarta.persistence.Id; +import jakarta.persistence.Table; import lombok.Builder; import lombok.Getter; import org.hibernate.annotations.ColumnDefault; @Entity +@Table(name = "places") @Getter public class Place { From 7e01efcd52413a55193e948adb836b2b82d0c249 Mon Sep 17 00:00:00 2001 From: dong_yxxn Date: Thu, 19 Sep 2024 20:51:33 +0900 Subject: [PATCH 10/23] =?UTF-8?q?[feat]=20=EC=B9=B4=ED=85=8C=EA=B3=A0?= =?UTF-8?q?=EB=A6=AC=20=EB=A6=AC=EC=8A=A4=ED=8A=B8=20=EB=B0=98=ED=99=98=20?= =?UTF-8?q?=EA=B8=B0=EB=8A=A5=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Category 리스트를 반환받을 수 있도록 컨트롤러 구현했습니다. 관련 이슈: #7 --- .../place/controller/PlaceController.java | 30 ++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/src/main/java/team7/inplace/place/controller/PlaceController.java b/src/main/java/team7/inplace/place/controller/PlaceController.java index 2661f5b6..3e622125 100644 --- a/src/main/java/team7/inplace/place/controller/PlaceController.java +++ b/src/main/java/team7/inplace/place/controller/PlaceController.java @@ -1,2 +1,30 @@ -package team7.inplace.place.controller;public class PlaceController { +package team7.inplace.place.controller; + +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import team7.inplace.place.domain.Category; + +@RestController +@RequestMapping("/places") +public class PlaceController { + + @GetMapping("/categories") + public ResponseEntity>> getCategories() { + List categories = Arrays.stream(Category.values()) + .map(Enum::name) + .collect(Collectors.toList()); + + Map> response = new HashMap<>(); + response.put("categories", categories); + + return new ResponseEntity<>(response, HttpStatus.OK); + } } From adaedd128862f67a7ad34bd54396581a7dbb051a Mon Sep 17 00:00:00 2001 From: dong_yxxn Date: Thu, 19 Sep 2024 21:17:37 +0900 Subject: [PATCH 11/23] =?UTF-8?q?[feat]=20PlaceService=20=EC=9D=B8?= =?UTF-8?q?=ED=84=B0=ED=8E=98=EC=9D=B4=EC=8A=A4=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/team7/inplace/place/service/PlaceService.java | 8 ++++++++ .../team7/inplace/place/service/PlaceServiceImpl.java | 2 ++ 2 files changed, 10 insertions(+) create mode 100644 src/main/java/team7/inplace/place/service/PlaceService.java create mode 100644 src/main/java/team7/inplace/place/service/PlaceServiceImpl.java diff --git a/src/main/java/team7/inplace/place/service/PlaceService.java b/src/main/java/team7/inplace/place/service/PlaceService.java new file mode 100644 index 00000000..6a16f49a --- /dev/null +++ b/src/main/java/team7/inplace/place/service/PlaceService.java @@ -0,0 +1,8 @@ +package team7.inplace.place.service; + +import java.util.List; +import org.springframework.stereotype.Service; + +public interface PlaceService { + List getCategories(); +} diff --git a/src/main/java/team7/inplace/place/service/PlaceServiceImpl.java b/src/main/java/team7/inplace/place/service/PlaceServiceImpl.java new file mode 100644 index 00000000..d36effb0 --- /dev/null +++ b/src/main/java/team7/inplace/place/service/PlaceServiceImpl.java @@ -0,0 +1,2 @@ +package team7.inplace.place.service;public class PlaceServiceImpl { +} From 62ef1fe226f4634ad3b0881315bbb82d7a70a45c Mon Sep 17 00:00:00 2001 From: dong_yxxn Date: Thu, 19 Sep 2024 21:19:07 +0900 Subject: [PATCH 12/23] =?UTF-8?q?[feat]=20=EC=B9=B4=ED=85=8C=EB=A1=9C?= =?UTF-8?q?=EB=A6=AC=20=EB=AA=A9=EB=A1=9D=20=EB=B0=98=ED=99=98=20=EA=B8=B0?= =?UTF-8?q?=EB=8A=A5=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 카테고리 enum의 값들을 String으로 변환 후, 리스트로 반환하였습니다. 관련 이슈: #7 --- .../place/service/PlaceServiceImpl.java | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/main/java/team7/inplace/place/service/PlaceServiceImpl.java b/src/main/java/team7/inplace/place/service/PlaceServiceImpl.java index d36effb0..aa652e06 100644 --- a/src/main/java/team7/inplace/place/service/PlaceServiceImpl.java +++ b/src/main/java/team7/inplace/place/service/PlaceServiceImpl.java @@ -1,2 +1,18 @@ -package team7.inplace.place.service;public class PlaceServiceImpl { +package team7.inplace.place.service; + +import java.util.Arrays; +import java.util.List; +import java.util.stream.Collectors; +import org.springframework.stereotype.Service; +import team7.inplace.place.domain.Category; + +@Service +public class PlaceServiceImpl implements PlaceService{ + + @Override + public List getCategories() { + return Arrays.stream(Category.values()) + .map(Enum::name) + .collect(Collectors.toList()); + } } From 8177c74b7a76543fc05839a8cc646d7d05413226 Mon Sep 17 00:00:00 2001 From: dong_yxxn Date: Thu, 19 Sep 2024 21:20:29 +0900 Subject: [PATCH 13/23] =?UTF-8?q?[refactor]=20=EC=B9=B4=ED=85=8C=EA=B3=A0?= =?UTF-8?q?=EB=A6=AC=20=EB=AA=A9=EB=A1=9D=20=EB=B0=98=ED=99=98=20=EB=A1=9C?= =?UTF-8?q?=EC=A7=81=20=EC=84=9C=EB=B9=84=EC=8A=A4=EB=8B=A8=EC=9C=BC?= =?UTF-8?q?=EB=A1=9C=20=EC=9D=B4=EB=8F=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Category 목록 반환 로직을 Service 단에서 반환받도록 수정하였습니다. 관련 이슈: #7 --- .../inplace/place/controller/PlaceController.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/main/java/team7/inplace/place/controller/PlaceController.java b/src/main/java/team7/inplace/place/controller/PlaceController.java index 3e622125..75065e84 100644 --- a/src/main/java/team7/inplace/place/controller/PlaceController.java +++ b/src/main/java/team7/inplace/place/controller/PlaceController.java @@ -5,22 +5,27 @@ import java.util.List; import java.util.Map; import java.util.stream.Collectors; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import team7.inplace.place.domain.Category; +import team7.inplace.place.service.PlaceService; @RestController @RequestMapping("/places") public class PlaceController { + private final PlaceService placeService; + @Autowired + public PlaceController(PlaceService placeService) { + this.placeService = placeService; + } @GetMapping("/categories") public ResponseEntity>> getCategories() { - List categories = Arrays.stream(Category.values()) - .map(Enum::name) - .collect(Collectors.toList()); + List categories = placeService.getCategories(); Map> response = new HashMap<>(); response.put("categories", categories); From 8d97209260813f1b23c432977edf1d7027ecfe4d Mon Sep 17 00:00:00 2001 From: dong_yxxn Date: Thu, 19 Sep 2024 21:45:37 +0900 Subject: [PATCH 14/23] =?UTF-8?q?[refactor]=20Category=20=EB=AA=A9?= =?UTF-8?q?=EB=A1=9D=20=EB=B0=98=ED=99=98=EC=97=90=20DTO=20=EC=A0=81?= =?UTF-8?q?=EC=9A=A9=20Category=20=EB=AA=A9=EB=A1=9D=20=EB=B0=98=ED=99=98?= =?UTF-8?q?=EC=97=90=EC=84=9C=20Controller=EC=99=80=20Service=EA=B0=84?= =?UTF-8?q?=EC=97=90=20CategoryListDTO=EB=A5=BC=20=EC=A0=81=EC=9A=A9?= =?UTF-8?q?=ED=95=B4=EC=84=9C=20=EC=B2=98=EB=A6=AC=ED=95=98=EC=98=80?= =?UTF-8?q?=EC=8A=B5=EB=8B=88=EB=8B=A4.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 관련 이슈: #7 --- .../inplace/place/controller/PlaceController.java | 3 ++- .../team7/inplace/place/domain/CategoryListDTO.java | 7 +++++++ .../java/team7/inplace/place/service/PlaceService.java | 3 ++- .../team7/inplace/place/service/PlaceServiceImpl.java | 10 ++++++---- 4 files changed, 17 insertions(+), 6 deletions(-) create mode 100644 src/main/java/team7/inplace/place/domain/CategoryListDTO.java diff --git a/src/main/java/team7/inplace/place/controller/PlaceController.java b/src/main/java/team7/inplace/place/controller/PlaceController.java index 75065e84..d0d9c300 100644 --- a/src/main/java/team7/inplace/place/controller/PlaceController.java +++ b/src/main/java/team7/inplace/place/controller/PlaceController.java @@ -12,6 +12,7 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import team7.inplace.place.domain.Category; +import team7.inplace.place.domain.CategoryListDTO; import team7.inplace.place.service.PlaceService; @RestController @@ -25,7 +26,7 @@ public PlaceController(PlaceService placeService) { } @GetMapping("/categories") public ResponseEntity>> getCategories() { - List categories = placeService.getCategories(); + CategoryListDTO categories = placeService.getCategories(); Map> response = new HashMap<>(); response.put("categories", categories); diff --git a/src/main/java/team7/inplace/place/domain/CategoryListDTO.java b/src/main/java/team7/inplace/place/domain/CategoryListDTO.java new file mode 100644 index 00000000..713d12f3 --- /dev/null +++ b/src/main/java/team7/inplace/place/domain/CategoryListDTO.java @@ -0,0 +1,7 @@ +package team7.inplace.place.domain; + +import java.util.List; + +public record CategoryListDTO(List categories) { + +} diff --git a/src/main/java/team7/inplace/place/service/PlaceService.java b/src/main/java/team7/inplace/place/service/PlaceService.java index 6a16f49a..694477c1 100644 --- a/src/main/java/team7/inplace/place/service/PlaceService.java +++ b/src/main/java/team7/inplace/place/service/PlaceService.java @@ -2,7 +2,8 @@ import java.util.List; import org.springframework.stereotype.Service; +import team7.inplace.place.domain.CategoryListDTO; public interface PlaceService { - List getCategories(); + CategoryListDTO getCategories(); } diff --git a/src/main/java/team7/inplace/place/service/PlaceServiceImpl.java b/src/main/java/team7/inplace/place/service/PlaceServiceImpl.java index aa652e06..1f1569dc 100644 --- a/src/main/java/team7/inplace/place/service/PlaceServiceImpl.java +++ b/src/main/java/team7/inplace/place/service/PlaceServiceImpl.java @@ -5,14 +5,16 @@ import java.util.stream.Collectors; import org.springframework.stereotype.Service; import team7.inplace.place.domain.Category; +import team7.inplace.place.domain.CategoryListDTO; @Service public class PlaceServiceImpl implements PlaceService{ @Override - public List getCategories() { - return Arrays.stream(Category.values()) - .map(Enum::name) - .collect(Collectors.toList()); + public CategoryListDTO getCategories() { + List categories = Arrays.stream(Category.values()) + .map(Enum::name) + .toList(); + return new CategoryListDTO(categories); } } From 10ea9a57767ae67f6abc0e5bf54c28d20297b639 Mon Sep 17 00:00:00 2001 From: dong_yxxn Date: Thu, 19 Sep 2024 21:49:18 +0900 Subject: [PATCH 15/23] =?UTF-8?q?[fix]=20response=EC=97=90=EC=84=9C=20Map?= =?UTF-8?q?=20=ED=8C=8C=EB=9D=BC=EB=AF=B8=ED=84=B0=EC=97=90=20CategoryList?= =?UTF-8?q?DTO=20=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Map 파라미터에서 List을 DTO 적용에 따라 CategoryListDTO로 변경하였습니다. 관련 이슈: #7 --- .../java/team7/inplace/place/controller/PlaceController.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/team7/inplace/place/controller/PlaceController.java b/src/main/java/team7/inplace/place/controller/PlaceController.java index d0d9c300..b0de5981 100644 --- a/src/main/java/team7/inplace/place/controller/PlaceController.java +++ b/src/main/java/team7/inplace/place/controller/PlaceController.java @@ -25,10 +25,10 @@ public PlaceController(PlaceService placeService) { this.placeService = placeService; } @GetMapping("/categories") - public ResponseEntity>> getCategories() { + public ResponseEntity> getCategories() { CategoryListDTO categories = placeService.getCategories(); - Map> response = new HashMap<>(); + Map response = new HashMap<>(); response.put("categories", categories); return new ResponseEntity<>(response, HttpStatus.OK); From e21600d189504991034c78b37e4f9996d2b88af3 Mon Sep 17 00:00:00 2001 From: dong_yxxn Date: Thu, 19 Sep 2024 21:55:56 +0900 Subject: [PATCH 16/23] =?UTF-8?q?[refactor]=20Category=20=EB=AA=A9?= =?UTF-8?q?=EB=A1=9D=20DTO=EB=A1=9C=20=EB=B0=98=ED=99=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Category 목록을 반환하는데 DTO를 바로 적용시켰습니다. 관련 이슈: #7 --- .../team7/inplace/place/controller/PlaceController.java | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/main/java/team7/inplace/place/controller/PlaceController.java b/src/main/java/team7/inplace/place/controller/PlaceController.java index b0de5981..37dda102 100644 --- a/src/main/java/team7/inplace/place/controller/PlaceController.java +++ b/src/main/java/team7/inplace/place/controller/PlaceController.java @@ -25,11 +25,8 @@ public PlaceController(PlaceService placeService) { this.placeService = placeService; } @GetMapping("/categories") - public ResponseEntity> getCategories() { - CategoryListDTO categories = placeService.getCategories(); - - Map response = new HashMap<>(); - response.put("categories", categories); + public ResponseEntity getCategories() { + CategoryListDTO response = placeService.getCategories(); return new ResponseEntity<>(response, HttpStatus.OK); } From 2c198de1eb152de81a0a7c0a048e0bceb751ccb5 Mon Sep 17 00:00:00 2001 From: BaeJunho Date: Fri, 20 Sep 2024 14:28:56 +0900 Subject: [PATCH 17/23] =?UTF-8?q?feat=20:=20#4=20=ED=98=95=EC=8B=9D?= =?UTF-8?q?=EC=97=90=20=EB=A7=9E=EA=B2=8C=20=EB=B9=84=EB=94=94=EC=98=A4=20?= =?UTF-8?q?=EC=A0=95=EB=B3=B4=EB=A5=BC=20=EB=B0=98=ED=99=98=ED=95=98?= =?UTF-8?q?=EB=8A=94=20=EA=B8=B0=EB=8A=A5=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 비디오 별로 새로운 Alias를 지어주는 부분 외, 정보를 조회하고 API 문서에 맞는 형식으로 반환하는 기능을 구현 --- .../inplace/video/DTO/PlaceForVideo.java | 4 ++ .../team7/inplace/video/DTO/VideoData.java | 4 ++ .../inplace/video/DTO/VideoResponse.java | 7 +++ .../video/controller/VideoController.java | 32 +++++++++++++ .../inplace/video/entity/Influencer.java | 9 ++++ .../team7/inplace/video/entity/Place.java | 5 +++ .../repository/InfluencerRepository.java | 15 +++++++ .../video/repository/VideoRepository.java | 10 +++++ .../inplace/video/service/VideoService.java | 45 +++++++++++++++++++ 9 files changed, 131 insertions(+) create mode 100644 src/main/java/team7/inplace/video/DTO/PlaceForVideo.java create mode 100644 src/main/java/team7/inplace/video/DTO/VideoData.java create mode 100644 src/main/java/team7/inplace/video/DTO/VideoResponse.java create mode 100644 src/main/java/team7/inplace/video/controller/VideoController.java create mode 100644 src/main/java/team7/inplace/video/repository/InfluencerRepository.java create mode 100644 src/main/java/team7/inplace/video/repository/VideoRepository.java create mode 100644 src/main/java/team7/inplace/video/service/VideoService.java diff --git a/src/main/java/team7/inplace/video/DTO/PlaceForVideo.java b/src/main/java/team7/inplace/video/DTO/PlaceForVideo.java new file mode 100644 index 00000000..9ab2c42a --- /dev/null +++ b/src/main/java/team7/inplace/video/DTO/PlaceForVideo.java @@ -0,0 +1,4 @@ +package team7.inplace.video.DTO; + +public record PlaceForVideo(Long placeId, String placeName) { +} diff --git a/src/main/java/team7/inplace/video/DTO/VideoData.java b/src/main/java/team7/inplace/video/DTO/VideoData.java new file mode 100644 index 00000000..c371c49d --- /dev/null +++ b/src/main/java/team7/inplace/video/DTO/VideoData.java @@ -0,0 +1,4 @@ +package team7.inplace.video.DTO; + +public record VideoData(Long videoId, String videoAlias, String videoUrl, PlaceForVideo place) { +} diff --git a/src/main/java/team7/inplace/video/DTO/VideoResponse.java b/src/main/java/team7/inplace/video/DTO/VideoResponse.java new file mode 100644 index 00000000..0ce3f9b8 --- /dev/null +++ b/src/main/java/team7/inplace/video/DTO/VideoResponse.java @@ -0,0 +1,7 @@ +package team7.inplace.video.DTO; + +public record VideoResponse(Long videoId, String videoAlias, String videoUrl, PlaceForVideo place) { + public VideoResponse(VideoData videoData) { + this(videoData.videoId(), videoData.videoAlias(), videoData.videoUrl(), videoData.place()); + } +} diff --git a/src/main/java/team7/inplace/video/controller/VideoController.java b/src/main/java/team7/inplace/video/controller/VideoController.java new file mode 100644 index 00000000..7522e5cd --- /dev/null +++ b/src/main/java/team7/inplace/video/controller/VideoController.java @@ -0,0 +1,32 @@ +package team7.inplace.video.controller; + +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; +import team7.inplace.video.DTO.VideoData; +import team7.inplace.video.DTO.VideoResponse; +import team7.inplace.video.service.VideoService; + +import java.util.List; +import java.util.stream.Collectors; + +@RestController +public class VideoController { + private final VideoService videoService; + + public VideoController(VideoService videoService) { + this.videoService = videoService; + } + + // 내 인플루언서가 방문한 그 곳 + @GetMapping("video") + public ResponseEntity> readByInfluencer( + @RequestParam(name="influencer", required = false) List influencers + ){ + List videoDatas = videoService.findByInfluencer(influencers); + List videoInfo = videoDatas.stream().map(VideoResponse::new).toList(); + return new ResponseEntity<>(videoInfo, HttpStatus.OK); + } +} diff --git a/src/main/java/team7/inplace/video/entity/Influencer.java b/src/main/java/team7/inplace/video/entity/Influencer.java index c8524430..0cc69f8d 100644 --- a/src/main/java/team7/inplace/video/entity/Influencer.java +++ b/src/main/java/team7/inplace/video/entity/Influencer.java @@ -1,15 +1,24 @@ package team7.inplace.video.entity; +import jakarta.persistence.Column; import jakarta.persistence.Entity; import jakarta.persistence.Id; +import lombok.Getter; @Entity +@Getter public class Influencer { /* * 더미 데이터 입니다 !!! */ @Id private Long id; + @Column + private String name; + @Column + private String job; + @Column + private String imgUrl; protected Influencer() { diff --git a/src/main/java/team7/inplace/video/entity/Place.java b/src/main/java/team7/inplace/video/entity/Place.java index f3284515..cce24170 100644 --- a/src/main/java/team7/inplace/video/entity/Place.java +++ b/src/main/java/team7/inplace/video/entity/Place.java @@ -1,15 +1,20 @@ package team7.inplace.video.entity; +import jakarta.persistence.Column; import jakarta.persistence.Entity; import jakarta.persistence.Id; +import lombok.Getter; @Entity +@Getter public class Place { /* * 더미 데이터 입니다 !!! */ @Id private Long id; + @Column + private String name; protected Place(){ diff --git a/src/main/java/team7/inplace/video/repository/InfluencerRepository.java b/src/main/java/team7/inplace/video/repository/InfluencerRepository.java new file mode 100644 index 00000000..7d7d12f6 --- /dev/null +++ b/src/main/java/team7/inplace/video/repository/InfluencerRepository.java @@ -0,0 +1,15 @@ +package team7.inplace.video.repository; + +import org.springframework.data.jpa.repository.JpaRepository; +import team7.inplace.video.entity.Influencer; + +import java.util.List; + +public interface InfluencerRepository extends JpaRepository { + // 더미 데이터 입니다!! + + @Override + List findAllById(Iterable longs); + + List findByNameIn(List names); +} diff --git a/src/main/java/team7/inplace/video/repository/VideoRepository.java b/src/main/java/team7/inplace/video/repository/VideoRepository.java new file mode 100644 index 00000000..7bc34a59 --- /dev/null +++ b/src/main/java/team7/inplace/video/repository/VideoRepository.java @@ -0,0 +1,10 @@ +package team7.inplace.video.repository; + +import org.springframework.data.jpa.repository.JpaRepository; +import team7.inplace.video.entity.Video; + +import java.util.List; + +public interface VideoRepository extends JpaRepository { + List