From 019909eed748a090aeed1380d0ce596a3c472fa8 Mon Sep 17 00:00:00 2001 From: daeun084 <030804jk@naver.com> Date: Tue, 16 Jan 2024 18:57:32 +0900 Subject: [PATCH 01/36] add: Artist entity, enums --- .../shop/domain/artist/entity/Artist.java | 55 +++++++++++++++++++ .../artist/entity/enums/AvailableTime.java | 4 ++ .../domain/artist/entity/enums/Gender.java | 5 ++ .../artist/entity/enums/MakeupLocation.java | 4 ++ .../domain/artist/entity/enums/Region.java | 4 ++ .../artist/entity/enums/Specialization.java | 4 ++ .../artist/entity/enums/WorkExperience.java | 4 ++ 7 files changed, 80 insertions(+) create mode 100644 src/main/java/umc/meme/shop/domain/artist/entity/Artist.java create mode 100644 src/main/java/umc/meme/shop/domain/artist/entity/enums/AvailableTime.java create mode 100644 src/main/java/umc/meme/shop/domain/artist/entity/enums/Gender.java create mode 100644 src/main/java/umc/meme/shop/domain/artist/entity/enums/MakeupLocation.java create mode 100644 src/main/java/umc/meme/shop/domain/artist/entity/enums/Region.java create mode 100644 src/main/java/umc/meme/shop/domain/artist/entity/enums/Specialization.java create mode 100644 src/main/java/umc/meme/shop/domain/artist/entity/enums/WorkExperience.java diff --git a/src/main/java/umc/meme/shop/domain/artist/entity/Artist.java b/src/main/java/umc/meme/shop/domain/artist/entity/Artist.java new file mode 100644 index 0000000..187087e --- /dev/null +++ b/src/main/java/umc/meme/shop/domain/artist/entity/Artist.java @@ -0,0 +1,55 @@ +package umc.meme.shop.domain.artist.entity; + +import jakarta.persistence.*; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import umc.meme.shop.domain.artist.entity.enums.*; + +import java.util.Date; + +@Getter +@AllArgsConstructor +@NoArgsConstructor +@Entity +public class Artist { + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Long artistId; + + @Column(nullable = false) + private String name; + + @Column(nullable = false) + private Gender gender; + + @Column(nullable = false) + private String email; + + @Column(nullable = false) + private String nickname; + + @Column(nullable = false) + private String profileImg; + + @Column(nullable = false) + private String introduction; + + @Column(nullable = false) + private WorkExperience workExperience; + + @Column(nullable = false) + private Region region; + + @Column(nullable = false) + private Specialization specialization; + + @Column(nullable = false) + private MakeupLocation makeupLocation; + + @Column(nullable = true) + private Date inactiveDate; + + @Column(nullable = true) + private AvailableTime availableTime; +} diff --git a/src/main/java/umc/meme/shop/domain/artist/entity/enums/AvailableTime.java b/src/main/java/umc/meme/shop/domain/artist/entity/enums/AvailableTime.java new file mode 100644 index 0000000..8adf9ac --- /dev/null +++ b/src/main/java/umc/meme/shop/domain/artist/entity/enums/AvailableTime.java @@ -0,0 +1,4 @@ +package umc.meme.shop.domain.artist.entity.enums; + +public enum AvailableTime { +} diff --git a/src/main/java/umc/meme/shop/domain/artist/entity/enums/Gender.java b/src/main/java/umc/meme/shop/domain/artist/entity/enums/Gender.java new file mode 100644 index 0000000..cdbc18a --- /dev/null +++ b/src/main/java/umc/meme/shop/domain/artist/entity/enums/Gender.java @@ -0,0 +1,5 @@ +package umc.meme.shop.domain.artist.entity.enums; + +public enum Gender { + MALE, FEMALE +} diff --git a/src/main/java/umc/meme/shop/domain/artist/entity/enums/MakeupLocation.java b/src/main/java/umc/meme/shop/domain/artist/entity/enums/MakeupLocation.java new file mode 100644 index 0000000..eb5ab3a --- /dev/null +++ b/src/main/java/umc/meme/shop/domain/artist/entity/enums/MakeupLocation.java @@ -0,0 +1,4 @@ +package umc.meme.shop.domain.artist.entity.enums; + +public enum MakeupLocation { +} diff --git a/src/main/java/umc/meme/shop/domain/artist/entity/enums/Region.java b/src/main/java/umc/meme/shop/domain/artist/entity/enums/Region.java new file mode 100644 index 0000000..f59bae1 --- /dev/null +++ b/src/main/java/umc/meme/shop/domain/artist/entity/enums/Region.java @@ -0,0 +1,4 @@ +package umc.meme.shop.domain.artist.entity.enums; + +public enum Region { +} diff --git a/src/main/java/umc/meme/shop/domain/artist/entity/enums/Specialization.java b/src/main/java/umc/meme/shop/domain/artist/entity/enums/Specialization.java new file mode 100644 index 0000000..d23f3e0 --- /dev/null +++ b/src/main/java/umc/meme/shop/domain/artist/entity/enums/Specialization.java @@ -0,0 +1,4 @@ +package umc.meme.shop.domain.artist.entity.enums; + +public enum Specialization { +} diff --git a/src/main/java/umc/meme/shop/domain/artist/entity/enums/WorkExperience.java b/src/main/java/umc/meme/shop/domain/artist/entity/enums/WorkExperience.java new file mode 100644 index 0000000..0b4abc3 --- /dev/null +++ b/src/main/java/umc/meme/shop/domain/artist/entity/enums/WorkExperience.java @@ -0,0 +1,4 @@ +package umc.meme.shop.domain.artist.entity.enums; + +public enum WorkExperience { +} From 01a9098b069274bb494e15fea0a8640debb3a3f5 Mon Sep 17 00:00:00 2001 From: daeun084 <030804jk@naver.com> Date: Tue, 16 Jan 2024 19:40:46 +0900 Subject: [PATCH 02/36] add: Model entity, enums --- .../meme/shop/domain/model/entity/Model.java | 47 +++++++++++++++++++ .../model/entity/enums/PersonalColor.java | 4 ++ .../domain/model/entity/enums/SkinType.java | 4 ++ 3 files changed, 55 insertions(+) create mode 100644 src/main/java/umc/meme/shop/domain/model/entity/Model.java create mode 100644 src/main/java/umc/meme/shop/domain/model/entity/enums/PersonalColor.java create mode 100644 src/main/java/umc/meme/shop/domain/model/entity/enums/SkinType.java diff --git a/src/main/java/umc/meme/shop/domain/model/entity/Model.java b/src/main/java/umc/meme/shop/domain/model/entity/Model.java new file mode 100644 index 0000000..5f123ff --- /dev/null +++ b/src/main/java/umc/meme/shop/domain/model/entity/Model.java @@ -0,0 +1,47 @@ +package umc.meme.shop.domain.model.entity; + +import jakarta.persistence.*; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import umc.meme.shop.domain.artist.entity.enums.Gender; +import umc.meme.shop.domain.model.entity.enums.PersonalColor; +import umc.meme.shop.domain.model.entity.enums.SkinType; + +import java.util.Date; + +@Getter +@AllArgsConstructor +@NoArgsConstructor +@Entity +public class Model { + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Long modelId; + + @Column(nullable = false) + private String name; + + @Column(nullable = false) + private Gender gender; + + @Column(nullable = false) + private String email; + + @Column(nullable = false) + private String nickname; + + @Column(nullable = false) + private String profileImg; + + @Column(nullable = false) + private String introduction; + + @Column(nullable = false) + private SkinType skinType; + + @Column(nullable = false) + private PersonalColor personalColor; + + private Date inactive; +} diff --git a/src/main/java/umc/meme/shop/domain/model/entity/enums/PersonalColor.java b/src/main/java/umc/meme/shop/domain/model/entity/enums/PersonalColor.java new file mode 100644 index 0000000..faff714 --- /dev/null +++ b/src/main/java/umc/meme/shop/domain/model/entity/enums/PersonalColor.java @@ -0,0 +1,4 @@ +package umc.meme.shop.domain.model.entity.enums; + +public enum PersonalColor { +} diff --git a/src/main/java/umc/meme/shop/domain/model/entity/enums/SkinType.java b/src/main/java/umc/meme/shop/domain/model/entity/enums/SkinType.java new file mode 100644 index 0000000..be85bfc --- /dev/null +++ b/src/main/java/umc/meme/shop/domain/model/entity/enums/SkinType.java @@ -0,0 +1,4 @@ +package umc.meme.shop.domain.model.entity.enums; + +public enum SkinType { +} From 04f79a1798759fa4d730dd0e3ec3c9a25733949f Mon Sep 17 00:00:00 2001 From: daeun084 <030804jk@naver.com> Date: Tue, 16 Jan 2024 20:00:11 +0900 Subject: [PATCH 03/36] add: Portfolio, Reservation entity, enums --- .../domain/portfolio/entity/Portfolio.java | 33 +++++++++++++++++++ .../portfolio/entity/enums/Category.java | 4 +++ .../reservation/entity/Reservation.java | 32 ++++++++++++++++++ .../entity/enums/ReservationTime.java | 4 +++ .../reservation/entity/enums/Status.java | 5 +++ 5 files changed, 78 insertions(+) create mode 100644 src/main/java/umc/meme/shop/domain/portfolio/entity/Portfolio.java create mode 100644 src/main/java/umc/meme/shop/domain/portfolio/entity/enums/Category.java create mode 100644 src/main/java/umc/meme/shop/domain/reservation/entity/Reservation.java create mode 100644 src/main/java/umc/meme/shop/domain/reservation/entity/enums/ReservationTime.java create mode 100644 src/main/java/umc/meme/shop/domain/reservation/entity/enums/Status.java diff --git a/src/main/java/umc/meme/shop/domain/portfolio/entity/Portfolio.java b/src/main/java/umc/meme/shop/domain/portfolio/entity/Portfolio.java new file mode 100644 index 0000000..95b81fe --- /dev/null +++ b/src/main/java/umc/meme/shop/domain/portfolio/entity/Portfolio.java @@ -0,0 +1,33 @@ +package umc.meme.shop.domain.portfolio.entity; + +import jakarta.persistence.*; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import umc.meme.shop.domain.portfolio.entity.enums.Category; + + +@Getter +@AllArgsConstructor +@NoArgsConstructor +@Entity +public class Portfolio { + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Long portfolioId; + + @Column(nullable = false) + private Category category; + + @Column(nullable = false) + private String makeupName; + + @Column(nullable = false) + private int price; + + @Column(nullable = false) + private String info; + + @Column(nullable = false) + private boolean isBlock; +} diff --git a/src/main/java/umc/meme/shop/domain/portfolio/entity/enums/Category.java b/src/main/java/umc/meme/shop/domain/portfolio/entity/enums/Category.java new file mode 100644 index 0000000..3ff3e42 --- /dev/null +++ b/src/main/java/umc/meme/shop/domain/portfolio/entity/enums/Category.java @@ -0,0 +1,4 @@ +package umc.meme.shop.domain.portfolio.entity.enums; + +public enum Category { +} diff --git a/src/main/java/umc/meme/shop/domain/reservation/entity/Reservation.java b/src/main/java/umc/meme/shop/domain/reservation/entity/Reservation.java new file mode 100644 index 0000000..e4c8f57 --- /dev/null +++ b/src/main/java/umc/meme/shop/domain/reservation/entity/Reservation.java @@ -0,0 +1,32 @@ +package umc.meme.shop.domain.reservation.entity; + +import jakarta.persistence.*; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import umc.meme.shop.domain.reservation.entity.enums.ReservationTime; +import umc.meme.shop.domain.reservation.entity.enums.Status; + +import java.util.Date; + +@Getter +@AllArgsConstructor +@NoArgsConstructor +@Entity +public class Reservation { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Long reservationId; + @Column(nullable = false) + private Status status; + + @Column(nullable = false) + private boolean isReview; + + @Column(nullable = false) + private ReservationTime reservationTime; + + @Column(nullable = false) + private Date reservationDate; +} diff --git a/src/main/java/umc/meme/shop/domain/reservation/entity/enums/ReservationTime.java b/src/main/java/umc/meme/shop/domain/reservation/entity/enums/ReservationTime.java new file mode 100644 index 0000000..2ad11d3 --- /dev/null +++ b/src/main/java/umc/meme/shop/domain/reservation/entity/enums/ReservationTime.java @@ -0,0 +1,4 @@ +package umc.meme.shop.domain.reservation.entity.enums; + +public enum ReservationTime { +} diff --git a/src/main/java/umc/meme/shop/domain/reservation/entity/enums/Status.java b/src/main/java/umc/meme/shop/domain/reservation/entity/enums/Status.java new file mode 100644 index 0000000..07c9cdf --- /dev/null +++ b/src/main/java/umc/meme/shop/domain/reservation/entity/enums/Status.java @@ -0,0 +1,5 @@ +package umc.meme.shop.domain.reservation.entity.enums; + +public enum Status { + EXPECTED, COMPLETE, CANCEL +} From 03bb6a0c594bd60702c0b2f551e1ad9f05733735 Mon Sep 17 00:00:00 2001 From: daeun084 <030804jk@naver.com> Date: Tue, 16 Jan 2024 20:23:42 +0900 Subject: [PATCH 04/36] add: Review entity, enums --- .../shop/domain/review/entity/Review.java | 26 +++++++++++++++++++ .../shop/domain/review/entity/ReviewImg.java | 19 ++++++++++++++ .../shop/domain/review/entity/enums/Star.java | 5 ++++ 3 files changed, 50 insertions(+) create mode 100644 src/main/java/umc/meme/shop/domain/review/entity/Review.java create mode 100644 src/main/java/umc/meme/shop/domain/review/entity/ReviewImg.java create mode 100644 src/main/java/umc/meme/shop/domain/review/entity/enums/Star.java diff --git a/src/main/java/umc/meme/shop/domain/review/entity/Review.java b/src/main/java/umc/meme/shop/domain/review/entity/Review.java new file mode 100644 index 0000000..5232c86 --- /dev/null +++ b/src/main/java/umc/meme/shop/domain/review/entity/Review.java @@ -0,0 +1,26 @@ +package umc.meme.shop.domain.review.entity; + +import jakarta.persistence.*; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import umc.meme.shop.domain.review.entity.enums.Star; + +@Getter +@AllArgsConstructor +@NoArgsConstructor +@Entity +public class Review { + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Long reviewId; + + @Column(nullable = false) + private Star star; + + @Column(nullable = true) + private String comment; + + @Column(nullable = false) + private boolean isBlock; +} diff --git a/src/main/java/umc/meme/shop/domain/review/entity/ReviewImg.java b/src/main/java/umc/meme/shop/domain/review/entity/ReviewImg.java new file mode 100644 index 0000000..5860ab4 --- /dev/null +++ b/src/main/java/umc/meme/shop/domain/review/entity/ReviewImg.java @@ -0,0 +1,19 @@ +package umc.meme.shop.domain.review.entity; + +import jakarta.persistence.*; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; + +@Getter +@AllArgsConstructor +@NoArgsConstructor +@Entity +public class ReviewImg { + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Long reviewImgId; + + @Column(nullable = false) + private String src; +} diff --git a/src/main/java/umc/meme/shop/domain/review/entity/enums/Star.java b/src/main/java/umc/meme/shop/domain/review/entity/enums/Star.java new file mode 100644 index 0000000..e3e6dec --- /dev/null +++ b/src/main/java/umc/meme/shop/domain/review/entity/enums/Star.java @@ -0,0 +1,5 @@ +package umc.meme.shop.domain.review.entity.enums; + +public enum Star { + +} From 26b8c08cdda108d6c21a187851c351728ce819ef Mon Sep 17 00:00:00 2001 From: daeun084 <030804jk@naver.com> Date: Tue, 16 Jan 2024 20:31:27 +0900 Subject: [PATCH 05/36] add: Favorite Artist, Portfolio entity --- .../shop/domain/artist/entity/Artist.java | 1 + .../favorite/entity/Favorite_Artist.java | 25 +++++++++++++++++++ .../favorite/entity/Favorite_Portfolio.java | 25 +++++++++++++++++++ .../meme/shop/domain/model/entity/Model.java | 1 + .../domain/portfolio/entity/Portfolio.java | 1 + 5 files changed, 53 insertions(+) create mode 100644 src/main/java/umc/meme/shop/domain/favorite/entity/Favorite_Artist.java create mode 100644 src/main/java/umc/meme/shop/domain/favorite/entity/Favorite_Portfolio.java diff --git a/src/main/java/umc/meme/shop/domain/artist/entity/Artist.java b/src/main/java/umc/meme/shop/domain/artist/entity/Artist.java index 187087e..b673174 100644 --- a/src/main/java/umc/meme/shop/domain/artist/entity/Artist.java +++ b/src/main/java/umc/meme/shop/domain/artist/entity/Artist.java @@ -15,6 +15,7 @@ public class Artist { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "artist_id") private Long artistId; @Column(nullable = false) diff --git a/src/main/java/umc/meme/shop/domain/favorite/entity/Favorite_Artist.java b/src/main/java/umc/meme/shop/domain/favorite/entity/Favorite_Artist.java new file mode 100644 index 0000000..6319157 --- /dev/null +++ b/src/main/java/umc/meme/shop/domain/favorite/entity/Favorite_Artist.java @@ -0,0 +1,25 @@ +package umc.meme.shop.domain.favorite.entity; + +import jakarta.persistence.Entity; +import jakarta.persistence.JoinColumn; +import jakarta.persistence.ManyToOne; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import umc.meme.shop.domain.artist.entity.Artist; +import umc.meme.shop.domain.model.entity.Model; + +@Getter +@AllArgsConstructor +@NoArgsConstructor +@Entity +public class Favorite_Artist { + + @ManyToOne + @JoinColumn(name="model_id", nullable = false) + private Model model; + + @ManyToOne + @JoinColumn(name="artist_id", nullable = false) + private Artist artist; +} diff --git a/src/main/java/umc/meme/shop/domain/favorite/entity/Favorite_Portfolio.java b/src/main/java/umc/meme/shop/domain/favorite/entity/Favorite_Portfolio.java new file mode 100644 index 0000000..52273a9 --- /dev/null +++ b/src/main/java/umc/meme/shop/domain/favorite/entity/Favorite_Portfolio.java @@ -0,0 +1,25 @@ +package umc.meme.shop.domain.favorite.entity; + +import jakarta.persistence.Entity; +import jakarta.persistence.JoinColumn; +import jakarta.persistence.ManyToOne; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import umc.meme.shop.domain.model.entity.Model; +import umc.meme.shop.domain.portfolio.entity.Portfolio; + +@Getter +@AllArgsConstructor +@NoArgsConstructor +@Entity +public class Favorite_Portfolio { + + @ManyToOne + @JoinColumn(name="model_id", nullable = false) + private Model model; + + @ManyToOne + @JoinColumn(name="portfolio_id", nullable = false) + private Portfolio portfolio; +} diff --git a/src/main/java/umc/meme/shop/domain/model/entity/Model.java b/src/main/java/umc/meme/shop/domain/model/entity/Model.java index 5f123ff..332ed80 100644 --- a/src/main/java/umc/meme/shop/domain/model/entity/Model.java +++ b/src/main/java/umc/meme/shop/domain/model/entity/Model.java @@ -17,6 +17,7 @@ public class Model { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "model_id") private Long modelId; @Column(nullable = false) diff --git a/src/main/java/umc/meme/shop/domain/portfolio/entity/Portfolio.java b/src/main/java/umc/meme/shop/domain/portfolio/entity/Portfolio.java index 95b81fe..ab6d513 100644 --- a/src/main/java/umc/meme/shop/domain/portfolio/entity/Portfolio.java +++ b/src/main/java/umc/meme/shop/domain/portfolio/entity/Portfolio.java @@ -14,6 +14,7 @@ public class Portfolio { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "portfolio_id") private Long portfolioId; @Column(nullable = false) From 43bb3f89d498335c7f7596b1965e04934bfff233 Mon Sep 17 00:00:00 2001 From: daeun084 <030804jk@naver.com> Date: Tue, 16 Jan 2024 20:36:53 +0900 Subject: [PATCH 06/36] =?UTF-8?q?chore:=20=EC=97=B0=EA=B4=80=EA=B4=80?= =?UTF-8?q?=EA=B3=84=20=EC=84=A4=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/portfolio/entity/Portfolio.java | 5 ++++ .../domain/portfolio/entity/PortfolioImg.java | 23 +++++++++++++++++++ .../reservation/entity/Reservation.java | 11 +++++++++ .../shop/domain/review/entity/Review.java | 5 ++++ .../shop/domain/review/entity/ReviewImg.java | 4 ++++ 5 files changed, 48 insertions(+) create mode 100644 src/main/java/umc/meme/shop/domain/portfolio/entity/PortfolioImg.java diff --git a/src/main/java/umc/meme/shop/domain/portfolio/entity/Portfolio.java b/src/main/java/umc/meme/shop/domain/portfolio/entity/Portfolio.java index ab6d513..f01d783 100644 --- a/src/main/java/umc/meme/shop/domain/portfolio/entity/Portfolio.java +++ b/src/main/java/umc/meme/shop/domain/portfolio/entity/Portfolio.java @@ -4,6 +4,7 @@ import lombok.AllArgsConstructor; import lombok.Getter; import lombok.NoArgsConstructor; +import umc.meme.shop.domain.artist.entity.Artist; import umc.meme.shop.domain.portfolio.entity.enums.Category; @@ -17,6 +18,10 @@ public class Portfolio { @Column(name = "portfolio_id") private Long portfolioId; + @ManyToOne + @JoinColumn(name="artist_id", nullable = false) + private Artist artist; + @Column(nullable = false) private Category category; diff --git a/src/main/java/umc/meme/shop/domain/portfolio/entity/PortfolioImg.java b/src/main/java/umc/meme/shop/domain/portfolio/entity/PortfolioImg.java new file mode 100644 index 0000000..d7354f8 --- /dev/null +++ b/src/main/java/umc/meme/shop/domain/portfolio/entity/PortfolioImg.java @@ -0,0 +1,23 @@ +package umc.meme.shop.domain.portfolio.entity; + +import jakarta.persistence.*; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; + +@Getter +@AllArgsConstructor +@NoArgsConstructor +@Entity +public class PortfolioImg { + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Long portfolioImgId; + + @ManyToOne + @JoinColumn(name="portfolio_id", nullable = false) + private Portfolio portfolio; + + @Column(nullable = false) + private String src; +} diff --git a/src/main/java/umc/meme/shop/domain/reservation/entity/Reservation.java b/src/main/java/umc/meme/shop/domain/reservation/entity/Reservation.java index e4c8f57..4628841 100644 --- a/src/main/java/umc/meme/shop/domain/reservation/entity/Reservation.java +++ b/src/main/java/umc/meme/shop/domain/reservation/entity/Reservation.java @@ -4,6 +4,8 @@ import lombok.AllArgsConstructor; import lombok.Getter; import lombok.NoArgsConstructor; +import umc.meme.shop.domain.model.entity.Model; +import umc.meme.shop.domain.portfolio.entity.Portfolio; import umc.meme.shop.domain.reservation.entity.enums.ReservationTime; import umc.meme.shop.domain.reservation.entity.enums.Status; @@ -18,6 +20,15 @@ public class Reservation { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long reservationId; + + @OneToOne + @JoinColumn(name="model_id", nullable = false) + private Model model; + + @OneToOne + @JoinColumn(name="portfolio_id", nullable = false) + private Portfolio portfolio; + @Column(nullable = false) private Status status; diff --git a/src/main/java/umc/meme/shop/domain/review/entity/Review.java b/src/main/java/umc/meme/shop/domain/review/entity/Review.java index 5232c86..ef92849 100644 --- a/src/main/java/umc/meme/shop/domain/review/entity/Review.java +++ b/src/main/java/umc/meme/shop/domain/review/entity/Review.java @@ -4,6 +4,7 @@ import lombok.AllArgsConstructor; import lombok.Getter; import lombok.NoArgsConstructor; +import umc.meme.shop.domain.portfolio.entity.Portfolio; import umc.meme.shop.domain.review.entity.enums.Star; @Getter @@ -15,6 +16,10 @@ public class Review { @GeneratedValue(strategy = GenerationType.IDENTITY) private Long reviewId; + @ManyToOne + @JoinColumn(name="portfolio_id", nullable = false) + private Portfolio portfolio; + @Column(nullable = false) private Star star; diff --git a/src/main/java/umc/meme/shop/domain/review/entity/ReviewImg.java b/src/main/java/umc/meme/shop/domain/review/entity/ReviewImg.java index 5860ab4..7be0c2f 100644 --- a/src/main/java/umc/meme/shop/domain/review/entity/ReviewImg.java +++ b/src/main/java/umc/meme/shop/domain/review/entity/ReviewImg.java @@ -14,6 +14,10 @@ public class ReviewImg { @GeneratedValue(strategy = GenerationType.IDENTITY) private Long reviewImgId; + @ManyToOne + @JoinColumn(name="review_id", nullable = false) + private Review review; + @Column(nullable = false) private String src; } From 44b82e3b2b6c67350a9c1c54a5d26561e4c4878c Mon Sep 17 00:00:00 2001 From: daeun084 <030804jk@naver.com> Date: Tue, 16 Jan 2024 22:28:07 +0900 Subject: [PATCH 07/36] add: jpa Repository --- .../shop/domain/artist/repository/ArtistRepository.java | 7 +++++++ .../entity/{Favorite_Artist.java => FavoriteArtist.java} | 2 +- .../{Favorite_Portfolio.java => FavoritePortfolio.java} | 2 +- .../favorite/repository/FavoriteArtistRepository.java | 7 +++++++ .../favorite/repository/FavoritePortfolioRepository.java | 7 +++++++ .../meme/shop/domain/model/repository/ModelRepository.java | 7 +++++++ .../portfolio/repository/PortfolioImgRepository.java | 7 +++++++ .../domain/portfolio/repository/PortfolioRepository.java | 7 +++++++ .../reservation/repository/ReservationRepository.java | 7 +++++++ .../shop/domain/review/repository/ReviewImgRepository.java | 7 +++++++ .../shop/domain/review/repository/ReviewRepository.java | 7 +++++++ 11 files changed, 65 insertions(+), 2 deletions(-) create mode 100644 src/main/java/umc/meme/shop/domain/artist/repository/ArtistRepository.java rename src/main/java/umc/meme/shop/domain/favorite/entity/{Favorite_Artist.java => FavoriteArtist.java} (95%) rename src/main/java/umc/meme/shop/domain/favorite/entity/{Favorite_Portfolio.java => FavoritePortfolio.java} (94%) create mode 100644 src/main/java/umc/meme/shop/domain/favorite/repository/FavoriteArtistRepository.java create mode 100644 src/main/java/umc/meme/shop/domain/favorite/repository/FavoritePortfolioRepository.java create mode 100644 src/main/java/umc/meme/shop/domain/model/repository/ModelRepository.java create mode 100644 src/main/java/umc/meme/shop/domain/portfolio/repository/PortfolioImgRepository.java create mode 100644 src/main/java/umc/meme/shop/domain/portfolio/repository/PortfolioRepository.java create mode 100644 src/main/java/umc/meme/shop/domain/reservation/repository/ReservationRepository.java create mode 100644 src/main/java/umc/meme/shop/domain/review/repository/ReviewImgRepository.java create mode 100644 src/main/java/umc/meme/shop/domain/review/repository/ReviewRepository.java diff --git a/src/main/java/umc/meme/shop/domain/artist/repository/ArtistRepository.java b/src/main/java/umc/meme/shop/domain/artist/repository/ArtistRepository.java new file mode 100644 index 0000000..b753258 --- /dev/null +++ b/src/main/java/umc/meme/shop/domain/artist/repository/ArtistRepository.java @@ -0,0 +1,7 @@ +package umc.meme.shop.domain.artist.repository; + +import org.springframework.data.jpa.repository.JpaRepository; +import umc.meme.shop.domain.artist.entity.Artist; + +public interface ArtistRepository extends JpaRepository { +} diff --git a/src/main/java/umc/meme/shop/domain/favorite/entity/Favorite_Artist.java b/src/main/java/umc/meme/shop/domain/favorite/entity/FavoriteArtist.java similarity index 95% rename from src/main/java/umc/meme/shop/domain/favorite/entity/Favorite_Artist.java rename to src/main/java/umc/meme/shop/domain/favorite/entity/FavoriteArtist.java index 6319157..b65613f 100644 --- a/src/main/java/umc/meme/shop/domain/favorite/entity/Favorite_Artist.java +++ b/src/main/java/umc/meme/shop/domain/favorite/entity/FavoriteArtist.java @@ -13,7 +13,7 @@ @AllArgsConstructor @NoArgsConstructor @Entity -public class Favorite_Artist { +public class FavoriteArtist { @ManyToOne @JoinColumn(name="model_id", nullable = false) diff --git a/src/main/java/umc/meme/shop/domain/favorite/entity/Favorite_Portfolio.java b/src/main/java/umc/meme/shop/domain/favorite/entity/FavoritePortfolio.java similarity index 94% rename from src/main/java/umc/meme/shop/domain/favorite/entity/Favorite_Portfolio.java rename to src/main/java/umc/meme/shop/domain/favorite/entity/FavoritePortfolio.java index 52273a9..48e908b 100644 --- a/src/main/java/umc/meme/shop/domain/favorite/entity/Favorite_Portfolio.java +++ b/src/main/java/umc/meme/shop/domain/favorite/entity/FavoritePortfolio.java @@ -13,7 +13,7 @@ @AllArgsConstructor @NoArgsConstructor @Entity -public class Favorite_Portfolio { +public class FavoritePortfolio { @ManyToOne @JoinColumn(name="model_id", nullable = false) diff --git a/src/main/java/umc/meme/shop/domain/favorite/repository/FavoriteArtistRepository.java b/src/main/java/umc/meme/shop/domain/favorite/repository/FavoriteArtistRepository.java new file mode 100644 index 0000000..0ae6511 --- /dev/null +++ b/src/main/java/umc/meme/shop/domain/favorite/repository/FavoriteArtistRepository.java @@ -0,0 +1,7 @@ +package umc.meme.shop.domain.favorite.repository; + +import org.springframework.data.jpa.repository.JpaRepository; +import umc.meme.shop.domain.favorite.entity.FavoriteArtist; + +public interface FavoriteArtistRepository extends JpaRepository { +} diff --git a/src/main/java/umc/meme/shop/domain/favorite/repository/FavoritePortfolioRepository.java b/src/main/java/umc/meme/shop/domain/favorite/repository/FavoritePortfolioRepository.java new file mode 100644 index 0000000..8533af3 --- /dev/null +++ b/src/main/java/umc/meme/shop/domain/favorite/repository/FavoritePortfolioRepository.java @@ -0,0 +1,7 @@ +package umc.meme.shop.domain.favorite.repository; + +import org.springframework.data.jpa.repository.JpaRepository; +import umc.meme.shop.domain.favorite.entity.FavoritePortfolio; + +public interface FavoritePortfolioRepository extends JpaRepository { +} diff --git a/src/main/java/umc/meme/shop/domain/model/repository/ModelRepository.java b/src/main/java/umc/meme/shop/domain/model/repository/ModelRepository.java new file mode 100644 index 0000000..0dcf9ab --- /dev/null +++ b/src/main/java/umc/meme/shop/domain/model/repository/ModelRepository.java @@ -0,0 +1,7 @@ +package umc.meme.shop.domain.model.repository; + +import org.springframework.data.jpa.repository.JpaRepository; +import umc.meme.shop.domain.model.entity.Model; + +public interface ModelRepository extends JpaRepository { +} diff --git a/src/main/java/umc/meme/shop/domain/portfolio/repository/PortfolioImgRepository.java b/src/main/java/umc/meme/shop/domain/portfolio/repository/PortfolioImgRepository.java new file mode 100644 index 0000000..8c50f50 --- /dev/null +++ b/src/main/java/umc/meme/shop/domain/portfolio/repository/PortfolioImgRepository.java @@ -0,0 +1,7 @@ +package umc.meme.shop.domain.portfolio.repository; + +import org.springframework.data.jpa.repository.JpaRepository; +import umc.meme.shop.domain.portfolio.entity.PortfolioImg; + +public interface PortfolioImgRepository extends JpaRepository { +} diff --git a/src/main/java/umc/meme/shop/domain/portfolio/repository/PortfolioRepository.java b/src/main/java/umc/meme/shop/domain/portfolio/repository/PortfolioRepository.java new file mode 100644 index 0000000..b2a5a9e --- /dev/null +++ b/src/main/java/umc/meme/shop/domain/portfolio/repository/PortfolioRepository.java @@ -0,0 +1,7 @@ +package umc.meme.shop.domain.portfolio.repository; + +import org.springframework.data.jpa.repository.JpaRepository; +import umc.meme.shop.domain.portfolio.entity.Portfolio; + +public interface PortfolioRepository extends JpaRepository { +} diff --git a/src/main/java/umc/meme/shop/domain/reservation/repository/ReservationRepository.java b/src/main/java/umc/meme/shop/domain/reservation/repository/ReservationRepository.java new file mode 100644 index 0000000..a61e87e --- /dev/null +++ b/src/main/java/umc/meme/shop/domain/reservation/repository/ReservationRepository.java @@ -0,0 +1,7 @@ +package umc.meme.shop.domain.reservation.repository; + +import org.springframework.data.jpa.repository.JpaRepository; +import umc.meme.shop.domain.reservation.entity.Reservation; + +public interface ReservationRepository extends JpaRepository { +} diff --git a/src/main/java/umc/meme/shop/domain/review/repository/ReviewImgRepository.java b/src/main/java/umc/meme/shop/domain/review/repository/ReviewImgRepository.java new file mode 100644 index 0000000..45e0442 --- /dev/null +++ b/src/main/java/umc/meme/shop/domain/review/repository/ReviewImgRepository.java @@ -0,0 +1,7 @@ +package umc.meme.shop.domain.review.repository; + +import org.springframework.data.jpa.repository.JpaRepository; +import umc.meme.shop.domain.review.entity.ReviewImg; + +public interface ReviewImgRepository extends JpaRepository { +} diff --git a/src/main/java/umc/meme/shop/domain/review/repository/ReviewRepository.java b/src/main/java/umc/meme/shop/domain/review/repository/ReviewRepository.java new file mode 100644 index 0000000..b39f858 --- /dev/null +++ b/src/main/java/umc/meme/shop/domain/review/repository/ReviewRepository.java @@ -0,0 +1,7 @@ +package umc.meme.shop.domain.review.repository; + +import org.springframework.data.jpa.repository.JpaRepository; +import umc.meme.shop.domain.review.entity.Review; + +public interface ReviewRepository extends JpaRepository { +} From 099e81d2bfc550889b1a79f924802888f9dde68d Mon Sep 17 00:00:00 2001 From: daeun084 <030804jk@naver.com> Date: Wed, 17 Jan 2024 02:20:08 +0900 Subject: [PATCH 08/36] =?UTF-8?q?add:=20model/artist=20service,=20controll?= =?UTF-8?q?er=20=ED=8C=8C=EC=9D=BC=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/artist/controller/ArtistController.java | 11 +++++++++++ .../domain/artist/entity/enums/Specialization.java | 4 ---- .../shop/domain/artist/service/ArtistService.java | 11 +++++++++++ .../shop/domain/model/controller/ModelController.java | 11 +++++++++++ .../meme/shop/domain/model/service/ModelService.java | 11 +++++++++++ .../meme/shop/domain/review/entity/enums/Star.java | 5 ----- 6 files changed, 44 insertions(+), 9 deletions(-) create mode 100644 src/main/java/umc/meme/shop/domain/artist/controller/ArtistController.java delete mode 100644 src/main/java/umc/meme/shop/domain/artist/entity/enums/Specialization.java create mode 100644 src/main/java/umc/meme/shop/domain/artist/service/ArtistService.java create mode 100644 src/main/java/umc/meme/shop/domain/model/controller/ModelController.java create mode 100644 src/main/java/umc/meme/shop/domain/model/service/ModelService.java delete mode 100644 src/main/java/umc/meme/shop/domain/review/entity/enums/Star.java diff --git a/src/main/java/umc/meme/shop/domain/artist/controller/ArtistController.java b/src/main/java/umc/meme/shop/domain/artist/controller/ArtistController.java new file mode 100644 index 0000000..0ddd3b6 --- /dev/null +++ b/src/main/java/umc/meme/shop/domain/artist/controller/ArtistController.java @@ -0,0 +1,11 @@ +package umc.meme.shop.domain.artist.controller; + +import lombok.RequiredArgsConstructor; +import org.springframework.web.bind.annotation.RestController; +import umc.meme.shop.domain.artist.service.ArtistService; + +@RestController +@RequiredArgsConstructor +public class ArtistController { + private final ArtistService artistService; +} diff --git a/src/main/java/umc/meme/shop/domain/artist/entity/enums/Specialization.java b/src/main/java/umc/meme/shop/domain/artist/entity/enums/Specialization.java deleted file mode 100644 index d23f3e0..0000000 --- a/src/main/java/umc/meme/shop/domain/artist/entity/enums/Specialization.java +++ /dev/null @@ -1,4 +0,0 @@ -package umc.meme.shop.domain.artist.entity.enums; - -public enum Specialization { -} diff --git a/src/main/java/umc/meme/shop/domain/artist/service/ArtistService.java b/src/main/java/umc/meme/shop/domain/artist/service/ArtistService.java new file mode 100644 index 0000000..548de5e --- /dev/null +++ b/src/main/java/umc/meme/shop/domain/artist/service/ArtistService.java @@ -0,0 +1,11 @@ +package umc.meme.shop.domain.artist.service; + +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; +import umc.meme.shop.domain.artist.repository.ArtistRepository; + +@Service +@RequiredArgsConstructor +public class ArtistService { + private final ArtistRepository artistRepository; +} diff --git a/src/main/java/umc/meme/shop/domain/model/controller/ModelController.java b/src/main/java/umc/meme/shop/domain/model/controller/ModelController.java new file mode 100644 index 0000000..4ddd061 --- /dev/null +++ b/src/main/java/umc/meme/shop/domain/model/controller/ModelController.java @@ -0,0 +1,11 @@ +package umc.meme.shop.domain.model.controller; + +import lombok.RequiredArgsConstructor; +import org.springframework.web.bind.annotation.RestController; +import umc.meme.shop.domain.model.service.ModelService; + +@RestController +@RequiredArgsConstructor +public class ModelController { + private final ModelService modelService; +} diff --git a/src/main/java/umc/meme/shop/domain/model/service/ModelService.java b/src/main/java/umc/meme/shop/domain/model/service/ModelService.java new file mode 100644 index 0000000..39d50a9 --- /dev/null +++ b/src/main/java/umc/meme/shop/domain/model/service/ModelService.java @@ -0,0 +1,11 @@ +package umc.meme.shop.domain.model.service; + +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; +import umc.meme.shop.domain.model.repository.ModelRepository; + +@Service +@RequiredArgsConstructor +public class ModelService { + private final ModelRepository modelRepository; +} diff --git a/src/main/java/umc/meme/shop/domain/review/entity/enums/Star.java b/src/main/java/umc/meme/shop/domain/review/entity/enums/Star.java deleted file mode 100644 index e3e6dec..0000000 --- a/src/main/java/umc/meme/shop/domain/review/entity/enums/Star.java +++ /dev/null @@ -1,5 +0,0 @@ -package umc.meme.shop.domain.review.entity.enums; - -public enum Star { - -} From c15f2fb1036f86f068458bc48737029c931c1df0 Mon Sep 17 00:00:00 2001 From: daeun084 <030804jk@naver.com> Date: Wed, 17 Jan 2024 02:21:29 +0900 Subject: [PATCH 09/36] =?UTF-8?q?add:=20enum=20=EC=88=98=EC=A0=95,=20entit?= =?UTF-8?q?y=20=EC=86=8D=EC=84=B1=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/umc/meme/shop/ShopApplication.java | 2 ++ .../shop/domain/artist/entity/Artist.java | 30 +++++++++++++------ .../artist/entity/enums/AvailableTime.java | 1 + .../artist/entity/enums/MakeupLocation.java | 1 + .../domain/artist/entity/enums/Region.java | 1 + .../artist/entity/enums/WorkExperience.java | 3 ++ .../favorite/entity/FavoriteArtist.java | 8 +++-- .../favorite/entity/FavoritePortfolio.java | 8 +++-- .../meme/shop/domain/model/entity/Model.java | 25 +++++++++++++--- .../model/entity/enums/PersonalColor.java | 1 + .../domain/model/entity/enums/SkinType.java | 1 + .../domain/portfolio/entity/Portfolio.java | 3 +- .../portfolio/entity/enums/Category.java | 2 ++ .../reservation/entity/Reservation.java | 4 ++- .../entity/enums/ReservationTime.java | 1 + .../shop/domain/review/entity/Review.java | 7 ++--- 16 files changed, 73 insertions(+), 25 deletions(-) diff --git a/src/main/java/umc/meme/shop/ShopApplication.java b/src/main/java/umc/meme/shop/ShopApplication.java index d30915b..e4d47bc 100644 --- a/src/main/java/umc/meme/shop/ShopApplication.java +++ b/src/main/java/umc/meme/shop/ShopApplication.java @@ -2,8 +2,10 @@ import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.data.jpa.repository.config.EnableJpaAuditing; @SpringBootApplication +@EnableJpaAuditing public class ShopApplication { public static void main(String[] args) { diff --git a/src/main/java/umc/meme/shop/domain/artist/entity/Artist.java b/src/main/java/umc/meme/shop/domain/artist/entity/Artist.java index b673174..5c95080 100644 --- a/src/main/java/umc/meme/shop/domain/artist/entity/Artist.java +++ b/src/main/java/umc/meme/shop/domain/artist/entity/Artist.java @@ -5,8 +5,11 @@ import lombok.Getter; import lombok.NoArgsConstructor; import umc.meme.shop.domain.artist.entity.enums.*; +import umc.meme.shop.domain.portfolio.entity.Portfolio; +import umc.meme.shop.domain.portfolio.entity.enums.Category; import java.util.Date; +import java.util.List; @Getter @AllArgsConstructor @@ -18,39 +21,48 @@ public class Artist { @Column(name = "artist_id") private Long artistId; - @Column(nullable = false) + @Column(nullable = false, length = 20) private String name; + @Enumerated(EnumType.STRING) @Column(nullable = false) private Gender gender; - @Column(nullable = false) + @Column(nullable = false, length = 40) private String email; - @Column(nullable = false) + @Column(nullable = false, length = 40) private String nickname; @Column(nullable = false) private String profileImg; - @Column(nullable = false) - private String introduction; + @Column(nullable = false, length = 500) + private String introduction = "안녕하세요! 저는 ___입니다!"; + @Enumerated(EnumType.STRING) @Column(nullable = false) private WorkExperience workExperience; - @Column(nullable = false) - private Region region; +// @Enumerated(EnumType.STRING) +// @Column(nullable = false) + private List region; - @Column(nullable = false) - private Specialization specialization; +// @Enumerated(EnumType.STRING) +// @Column(nullable = false) + private List specialization; + @Enumerated(EnumType.STRING) @Column(nullable = false) private MakeupLocation makeupLocation; @Column(nullable = true) private Date inactiveDate; + @Enumerated(EnumType.STRING) @Column(nullable = true) private AvailableTime availableTime; + + @OneToMany(cascade = CascadeType.ALL, mappedBy = "artist") + private List portfolioList; } diff --git a/src/main/java/umc/meme/shop/domain/artist/entity/enums/AvailableTime.java b/src/main/java/umc/meme/shop/domain/artist/entity/enums/AvailableTime.java index 8adf9ac..e6deec3 100644 --- a/src/main/java/umc/meme/shop/domain/artist/entity/enums/AvailableTime.java +++ b/src/main/java/umc/meme/shop/domain/artist/entity/enums/AvailableTime.java @@ -1,4 +1,5 @@ package umc.meme.shop.domain.artist.entity.enums; public enum AvailableTime { + MON, TUE, WED, THU, FRI, SAT, SUN } diff --git a/src/main/java/umc/meme/shop/domain/artist/entity/enums/MakeupLocation.java b/src/main/java/umc/meme/shop/domain/artist/entity/enums/MakeupLocation.java index eb5ab3a..f6e3d45 100644 --- a/src/main/java/umc/meme/shop/domain/artist/entity/enums/MakeupLocation.java +++ b/src/main/java/umc/meme/shop/domain/artist/entity/enums/MakeupLocation.java @@ -1,4 +1,5 @@ package umc.meme.shop.domain.artist.entity.enums; public enum MakeupLocation { + SHOP, VISIT, BOTH } diff --git a/src/main/java/umc/meme/shop/domain/artist/entity/enums/Region.java b/src/main/java/umc/meme/shop/domain/artist/entity/enums/Region.java index f59bae1..6657f59 100644 --- a/src/main/java/umc/meme/shop/domain/artist/entity/enums/Region.java +++ b/src/main/java/umc/meme/shop/domain/artist/entity/enums/Region.java @@ -1,4 +1,5 @@ package umc.meme.shop.domain.artist.entity.enums; public enum Region { + SEOUL } diff --git a/src/main/java/umc/meme/shop/domain/artist/entity/enums/WorkExperience.java b/src/main/java/umc/meme/shop/domain/artist/entity/enums/WorkExperience.java index 0b4abc3..5bd7d94 100644 --- a/src/main/java/umc/meme/shop/domain/artist/entity/enums/WorkExperience.java +++ b/src/main/java/umc/meme/shop/domain/artist/entity/enums/WorkExperience.java @@ -1,4 +1,7 @@ package umc.meme.shop.domain.artist.entity.enums; public enum WorkExperience { + ONE, TWO, THREE, FOUR, + FIVE, SIX, SEVEN, EIGHT, + NINE, TEN } diff --git a/src/main/java/umc/meme/shop/domain/favorite/entity/FavoriteArtist.java b/src/main/java/umc/meme/shop/domain/favorite/entity/FavoriteArtist.java index b65613f..0003bf5 100644 --- a/src/main/java/umc/meme/shop/domain/favorite/entity/FavoriteArtist.java +++ b/src/main/java/umc/meme/shop/domain/favorite/entity/FavoriteArtist.java @@ -1,8 +1,6 @@ package umc.meme.shop.domain.favorite.entity; -import jakarta.persistence.Entity; -import jakarta.persistence.JoinColumn; -import jakarta.persistence.ManyToOne; +import jakarta.persistence.*; import lombok.AllArgsConstructor; import lombok.Getter; import lombok.NoArgsConstructor; @@ -15,6 +13,10 @@ @Entity public class FavoriteArtist { + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Long favoriteArtistId; + @ManyToOne @JoinColumn(name="model_id", nullable = false) private Model model; diff --git a/src/main/java/umc/meme/shop/domain/favorite/entity/FavoritePortfolio.java b/src/main/java/umc/meme/shop/domain/favorite/entity/FavoritePortfolio.java index 48e908b..bc96ea3 100644 --- a/src/main/java/umc/meme/shop/domain/favorite/entity/FavoritePortfolio.java +++ b/src/main/java/umc/meme/shop/domain/favorite/entity/FavoritePortfolio.java @@ -1,8 +1,6 @@ package umc.meme.shop.domain.favorite.entity; -import jakarta.persistence.Entity; -import jakarta.persistence.JoinColumn; -import jakarta.persistence.ManyToOne; +import jakarta.persistence.*; import lombok.AllArgsConstructor; import lombok.Getter; import lombok.NoArgsConstructor; @@ -15,6 +13,10 @@ @Entity public class FavoritePortfolio { + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Long favoritePortfolioId; + @ManyToOne @JoinColumn(name="model_id", nullable = false) private Model model; diff --git a/src/main/java/umc/meme/shop/domain/model/entity/Model.java b/src/main/java/umc/meme/shop/domain/model/entity/Model.java index 332ed80..89643a4 100644 --- a/src/main/java/umc/meme/shop/domain/model/entity/Model.java +++ b/src/main/java/umc/meme/shop/domain/model/entity/Model.java @@ -5,10 +5,15 @@ import lombok.Getter; import lombok.NoArgsConstructor; import umc.meme.shop.domain.artist.entity.enums.Gender; +import umc.meme.shop.domain.favorite.entity.FavoriteArtist; +import umc.meme.shop.domain.favorite.entity.FavoritePortfolio; import umc.meme.shop.domain.model.entity.enums.PersonalColor; import umc.meme.shop.domain.model.entity.enums.SkinType; +import umc.meme.shop.domain.portfolio.entity.Portfolio; +import umc.meme.shop.domain.reservation.entity.Reservation; import java.util.Date; +import java.util.List; @Getter @AllArgsConstructor @@ -20,29 +25,41 @@ public class Model { @Column(name = "model_id") private Long modelId; - @Column(nullable = false) + @Column(nullable = false, length = 20) private String name; + @Enumerated(EnumType.STRING) @Column(nullable = false) private Gender gender; - @Column(nullable = false) + @Column(nullable = false, length = 40) private String email; - @Column(nullable = false) + @Column(nullable = false, length = 40) private String nickname; @Column(nullable = false) private String profileImg; - @Column(nullable = false) + @Column(nullable = false, length = 500) private String introduction; + @Enumerated(EnumType.STRING) @Column(nullable = false) private SkinType skinType; + @Enumerated(EnumType.STRING) @Column(nullable = false) private PersonalColor personalColor; private Date inactive; + + @OneToMany(cascade = CascadeType.ALL, mappedBy = "model") + private List favoritePortfolioList; + + @OneToMany(cascade = CascadeType.ALL, mappedBy = "model") + private List favoriteArtistList; + + @OneToMany(cascade = CascadeType.ALL, mappedBy = "model") + private List reservationList; } diff --git a/src/main/java/umc/meme/shop/domain/model/entity/enums/PersonalColor.java b/src/main/java/umc/meme/shop/domain/model/entity/enums/PersonalColor.java index faff714..dadc7a1 100644 --- a/src/main/java/umc/meme/shop/domain/model/entity/enums/PersonalColor.java +++ b/src/main/java/umc/meme/shop/domain/model/entity/enums/PersonalColor.java @@ -1,4 +1,5 @@ package umc.meme.shop.domain.model.entity.enums; public enum PersonalColor { + SPRING, SUMMER, AUTUMN, WINTER } diff --git a/src/main/java/umc/meme/shop/domain/model/entity/enums/SkinType.java b/src/main/java/umc/meme/shop/domain/model/entity/enums/SkinType.java index be85bfc..6f169da 100644 --- a/src/main/java/umc/meme/shop/domain/model/entity/enums/SkinType.java +++ b/src/main/java/umc/meme/shop/domain/model/entity/enums/SkinType.java @@ -1,4 +1,5 @@ package umc.meme.shop.domain.model.entity.enums; public enum SkinType { + DRY, COMMON, OILY, COMBINATIONAL } diff --git a/src/main/java/umc/meme/shop/domain/portfolio/entity/Portfolio.java b/src/main/java/umc/meme/shop/domain/portfolio/entity/Portfolio.java index f01d783..4a2b9d4 100644 --- a/src/main/java/umc/meme/shop/domain/portfolio/entity/Portfolio.java +++ b/src/main/java/umc/meme/shop/domain/portfolio/entity/Portfolio.java @@ -22,6 +22,7 @@ public class Portfolio { @JoinColumn(name="artist_id", nullable = false) private Artist artist; + @Enumerated(EnumType.STRING) @Column(nullable = false) private Category category; @@ -34,6 +35,6 @@ public class Portfolio { @Column(nullable = false) private String info; - @Column(nullable = false) + @Column(nullable = false, columnDefinition = "TINYINT(1) default 0") private boolean isBlock; } diff --git a/src/main/java/umc/meme/shop/domain/portfolio/entity/enums/Category.java b/src/main/java/umc/meme/shop/domain/portfolio/entity/enums/Category.java index 3ff3e42..987051b 100644 --- a/src/main/java/umc/meme/shop/domain/portfolio/entity/enums/Category.java +++ b/src/main/java/umc/meme/shop/domain/portfolio/entity/enums/Category.java @@ -1,4 +1,6 @@ package umc.meme.shop.domain.portfolio.entity.enums; public enum Category { + DAILY, INTERVIEW, ACTOR, PARTY, + WEDDING, PROSTHETIC, STUDIO, ETC } diff --git a/src/main/java/umc/meme/shop/domain/reservation/entity/Reservation.java b/src/main/java/umc/meme/shop/domain/reservation/entity/Reservation.java index 4628841..9142d11 100644 --- a/src/main/java/umc/meme/shop/domain/reservation/entity/Reservation.java +++ b/src/main/java/umc/meme/shop/domain/reservation/entity/Reservation.java @@ -29,12 +29,14 @@ public class Reservation { @JoinColumn(name="portfolio_id", nullable = false) private Portfolio portfolio; + @Enumerated(EnumType.STRING) @Column(nullable = false) private Status status; @Column(nullable = false) - private boolean isReview; + private boolean isReview = false; + @Enumerated(EnumType.STRING) @Column(nullable = false) private ReservationTime reservationTime; diff --git a/src/main/java/umc/meme/shop/domain/reservation/entity/enums/ReservationTime.java b/src/main/java/umc/meme/shop/domain/reservation/entity/enums/ReservationTime.java index 2ad11d3..f45f290 100644 --- a/src/main/java/umc/meme/shop/domain/reservation/entity/enums/ReservationTime.java +++ b/src/main/java/umc/meme/shop/domain/reservation/entity/enums/ReservationTime.java @@ -1,4 +1,5 @@ package umc.meme.shop.domain.reservation.entity.enums; public enum ReservationTime { + MON, TUE, WED, THU, FRI, SAT, SUN } diff --git a/src/main/java/umc/meme/shop/domain/review/entity/Review.java b/src/main/java/umc/meme/shop/domain/review/entity/Review.java index ef92849..613b5d8 100644 --- a/src/main/java/umc/meme/shop/domain/review/entity/Review.java +++ b/src/main/java/umc/meme/shop/domain/review/entity/Review.java @@ -5,7 +5,6 @@ import lombok.Getter; import lombok.NoArgsConstructor; import umc.meme.shop.domain.portfolio.entity.Portfolio; -import umc.meme.shop.domain.review.entity.enums.Star; @Getter @AllArgsConstructor @@ -21,11 +20,11 @@ public class Review { private Portfolio portfolio; @Column(nullable = false) - private Star star; + private int star; - @Column(nullable = true) + @Column(nullable = true, length = 200) private String comment; - @Column(nullable = false) + @Column(nullable = false, columnDefinition = "TINYINT(1) default 0") private boolean isBlock; } From ce1228e9b38eba650cb08ec2177961971b7b465a Mon Sep 17 00:00:00 2001 From: daeun084 <030804jk@naver.com> Date: Wed, 17 Jan 2024 18:36:07 +0900 Subject: [PATCH 10/36] =?UTF-8?q?add:=20Region=20enum=20data=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../umc/meme/shop/domain/artist/entity/enums/Region.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/java/umc/meme/shop/domain/artist/entity/enums/Region.java b/src/main/java/umc/meme/shop/domain/artist/entity/enums/Region.java index 6657f59..757607e 100644 --- a/src/main/java/umc/meme/shop/domain/artist/entity/enums/Region.java +++ b/src/main/java/umc/meme/shop/domain/artist/entity/enums/Region.java @@ -1,5 +1,8 @@ package umc.meme.shop.domain.artist.entity.enums; public enum Region { - SEOUL + JONGNO, JUNG, YONGSAN, SEONGDONG, GWANGJIN, DONGDAEMUN, + JUNGNANG, SEONGBUK, GANGBUK, DOBONG, NOWON, EUNPYEONG, + SEODAEMUN, MAPO, YANGCHEON, GANGSEO, GURO, GEUMCHEON, + YEONGDEUNGPO, DONGJAK, GWANAK, SEOCHO, GANGNAM, SONGPA, GANGDONG } From c8213bfc97ad24ad564de58830d914055cafcfa7 Mon Sep 17 00:00:00 2001 From: daeun084 <030804jk@naver.com> Date: Wed, 17 Jan 2024 23:06:45 +0900 Subject: [PATCH 11/36] =?UTF-8?q?add:=20apiResponse,=20status=20=ED=8C=8C?= =?UTF-8?q?=EC=9D=BC=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../umc/meme/shop/global/ErrorStatus.java | 13 ++++++++ .../umc/meme/shop/global/SuccessStatus.java | 13 ++++++++ .../shop/global/response/ApiResponse.java | 30 +++++++++++++++++++ 3 files changed, 56 insertions(+) create mode 100644 src/main/java/umc/meme/shop/global/ErrorStatus.java create mode 100644 src/main/java/umc/meme/shop/global/SuccessStatus.java create mode 100644 src/main/java/umc/meme/shop/global/response/ApiResponse.java diff --git a/src/main/java/umc/meme/shop/global/ErrorStatus.java b/src/main/java/umc/meme/shop/global/ErrorStatus.java new file mode 100644 index 0000000..66804b4 --- /dev/null +++ b/src/main/java/umc/meme/shop/global/ErrorStatus.java @@ -0,0 +1,13 @@ +package umc.meme.shop.global; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +@Getter +@AllArgsConstructor +public enum ErrorStatus { + TEMP(500, "TEMP"); + + private final int code; + private final String message; +} diff --git a/src/main/java/umc/meme/shop/global/SuccessStatus.java b/src/main/java/umc/meme/shop/global/SuccessStatus.java new file mode 100644 index 0000000..6ee7d95 --- /dev/null +++ b/src/main/java/umc/meme/shop/global/SuccessStatus.java @@ -0,0 +1,13 @@ +package umc.meme.shop.global; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +@Getter +@AllArgsConstructor +public enum SuccessStatus { + TEMP(200, "TEMP"); + + private final int code; + private final String message; +} diff --git a/src/main/java/umc/meme/shop/global/response/ApiResponse.java b/src/main/java/umc/meme/shop/global/response/ApiResponse.java new file mode 100644 index 0000000..48ba492 --- /dev/null +++ b/src/main/java/umc/meme/shop/global/response/ApiResponse.java @@ -0,0 +1,30 @@ +package umc.meme.shop.global.response; + +import lombok.AllArgsConstructor; +import lombok.Getter; +import umc.meme.shop.global.ErrorStatus; +import umc.meme.shop.global.SuccessStatus; + +@Getter +@AllArgsConstructor +public class ApiResponse { + private final String isSuccess; + private final int statusCode; + private final String message; + private final T data; + + public static ApiResponse SuccessResponse(SuccessStatus status, T data){ + return new ApiResponse<>("SUCCESS", status.getCode(), status.getMessage(), data); + } + public static ApiResponse SuccessResponse(SuccessStatus status){ + return new ApiResponse<>("SUCCESS", status.getCode(), status.getMessage(), ""); + } + + public static ApiResponse FailureResponse(int statusCode, String message){ + return new ApiResponse<>("FAILURE", statusCode, message, ""); + } + + public static ApiResponse FailureResponse(ErrorStatus errorStatus){ + return new ApiResponse<>("FAILURE", errorStatus.getCode(), errorStatus.getMessage(), ""); + } +} From 5b50dd9cee96e6dcbfd6b36ffc55070fbd45451c Mon Sep 17 00:00:00 2001 From: daeun084 <030804jk@naver.com> Date: Wed, 17 Jan 2024 23:44:15 +0900 Subject: [PATCH 12/36] add: exception handling --- .../artist/controller/ArtistController.java | 22 +++++++++++++++++++ .../global/exception/GlobalException.java | 11 ++++++++++ .../exception/GlobalExceptionAdvice.java | 18 +++++++++++++++ .../exception/GlobalExceptionHandler.java | 9 ++++++++ .../shop/global/response/ApiResponse.java | 5 +++++ 5 files changed, 65 insertions(+) create mode 100644 src/main/java/umc/meme/shop/global/exception/GlobalException.java create mode 100644 src/main/java/umc/meme/shop/global/exception/GlobalExceptionAdvice.java create mode 100644 src/main/java/umc/meme/shop/global/exception/GlobalExceptionHandler.java diff --git a/src/main/java/umc/meme/shop/domain/artist/controller/ArtistController.java b/src/main/java/umc/meme/shop/domain/artist/controller/ArtistController.java index 0ddd3b6..264492a 100644 --- a/src/main/java/umc/meme/shop/domain/artist/controller/ArtistController.java +++ b/src/main/java/umc/meme/shop/domain/artist/controller/ArtistController.java @@ -1,11 +1,33 @@ package umc.meme.shop.domain.artist.controller; import lombok.RequiredArgsConstructor; +import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RestController; import umc.meme.shop.domain.artist.service.ArtistService; +import umc.meme.shop.global.ErrorStatus; +import umc.meme.shop.global.SuccessStatus; +import umc.meme.shop.global.exception.GlobalException; +import umc.meme.shop.global.exception.GlobalExceptionHandler; +import umc.meme.shop.global.response.ApiResponse; @RestController @RequiredArgsConstructor public class ArtistController { private final ArtistService artistService; + + //ApiResponse TEST + @GetMapping("/temp/success") + public ApiResponse tempSuccess(){ + return ApiResponse.SuccessResponse(SuccessStatus.TEMP); + } + @GetMapping("/temp/failure") + public ApiResponse tempFailure(){ + return ApiResponse.FailureResponse(ErrorStatus.TEMP); + } + + @GetMapping("/temp/exception") + public ApiResponse tempException(){ + throw new GlobalException(ErrorStatus.TEMP); +// return ApiResponse.SuccessResponse(SuccessStatus.TEMP); + } } diff --git a/src/main/java/umc/meme/shop/global/exception/GlobalException.java b/src/main/java/umc/meme/shop/global/exception/GlobalException.java new file mode 100644 index 0000000..46b60f3 --- /dev/null +++ b/src/main/java/umc/meme/shop/global/exception/GlobalException.java @@ -0,0 +1,11 @@ +package umc.meme.shop.global.exception; + +import lombok.AllArgsConstructor; +import lombok.Getter; +import umc.meme.shop.global.ErrorStatus; + +@Getter +@AllArgsConstructor +public class GlobalException extends RuntimeException { + private final ErrorStatus errorStatus; +} diff --git a/src/main/java/umc/meme/shop/global/exception/GlobalExceptionAdvice.java b/src/main/java/umc/meme/shop/global/exception/GlobalExceptionAdvice.java new file mode 100644 index 0000000..2c41381 --- /dev/null +++ b/src/main/java/umc/meme/shop/global/exception/GlobalExceptionAdvice.java @@ -0,0 +1,18 @@ +package umc.meme.shop.global.exception; + +import lombok.extern.slf4j.Slf4j; +import org.springframework.web.bind.annotation.ExceptionHandler; +import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.RestControllerAdvice; +import org.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler; +import umc.meme.shop.global.response.ApiResponse; + +@Slf4j +@RestControllerAdvice(annotations = {RestController.class}) +public class GlobalExceptionAdvice extends ResponseEntityExceptionHandler { + + @ExceptionHandler(value = { GlobalException.class }) + protected ApiResponse handleException(GlobalException e) { + return ApiResponse.FailureResponse(e.getErrorStatus()); + } +} diff --git a/src/main/java/umc/meme/shop/global/exception/GlobalExceptionHandler.java b/src/main/java/umc/meme/shop/global/exception/GlobalExceptionHandler.java new file mode 100644 index 0000000..5def7f5 --- /dev/null +++ b/src/main/java/umc/meme/shop/global/exception/GlobalExceptionHandler.java @@ -0,0 +1,9 @@ +package umc.meme.shop.global.exception; + +import umc.meme.shop.global.ErrorStatus; + +public class GlobalExceptionHandler extends GlobalException{ + public GlobalExceptionHandler(ErrorStatus errorStatus) { + super(errorStatus); + } +} diff --git a/src/main/java/umc/meme/shop/global/response/ApiResponse.java b/src/main/java/umc/meme/shop/global/response/ApiResponse.java index 48ba492..f883dbe 100644 --- a/src/main/java/umc/meme/shop/global/response/ApiResponse.java +++ b/src/main/java/umc/meme/shop/global/response/ApiResponse.java @@ -1,5 +1,7 @@ package umc.meme.shop.global.response; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; import lombok.AllArgsConstructor; import lombok.Getter; import umc.meme.shop.global.ErrorStatus; @@ -7,10 +9,13 @@ @Getter @AllArgsConstructor +@JsonPropertyOrder({"isSuccess", "statusCode", "message", "data"}) public class ApiResponse { + private final String isSuccess; private final int statusCode; private final String message; + @JsonInclude(JsonInclude.Include.NON_NULL) private final T data; public static ApiResponse SuccessResponse(SuccessStatus status, T data){ From 4921c211ad9c39f285fd39b90279be705eeb5d0d Mon Sep 17 00:00:00 2001 From: daeun084 <030804jk@naver.com> Date: Thu, 18 Jan 2024 00:09:16 +0900 Subject: [PATCH 13/36] add: mypage controller mapping --- .../mypage/controller/MyPageController.java | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 src/main/java/umc/meme/shop/domain/mypage/controller/MyPageController.java diff --git a/src/main/java/umc/meme/shop/domain/mypage/controller/MyPageController.java b/src/main/java/umc/meme/shop/domain/mypage/controller/MyPageController.java new file mode 100644 index 0000000..56e220a --- /dev/null +++ b/src/main/java/umc/meme/shop/domain/mypage/controller/MyPageController.java @@ -0,0 +1,36 @@ +package umc.meme.shop.domain.mypage.controller; + +import lombok.RequiredArgsConstructor; +import org.springframework.web.bind.annotation.*; +import umc.meme.shop.global.SuccessStatus; +import umc.meme.shop.global.response.ApiResponse; + +@RestController +@RequiredArgsConstructor +@RequestMapping("api/v1/mypage") +public class MyPageController { + +// @Operation(summary = "마이페이지") + @GetMapping("/{userId}") + public ApiResponse mypage(){ + return ApiResponse.SuccessResponse(SuccessStatus.TEMP, ""); + } + +// @Operation(summary = "내 정보 수정") + @PatchMapping("/{userId}/details") + public ApiResponse details(){ + return ApiResponse.SuccessResponse(SuccessStatus.TEMP, ""); + } + +// @Operation(summary = "약관 및 정책") + @GetMapping("/tos") + public ApiResponse tos(){ + return ApiResponse.SuccessResponse(SuccessStatus.TEMP, ""); + } + +// @Operation(summary = "문의하기") + @PostMapping("/contact") + public ApiResponse contact(){ + return ApiResponse.SuccessResponse(SuccessStatus.TEMP, ""); + } +} From 4aeca95fd5b119fb7c76a51d5e3f22da370b48b4 Mon Sep 17 00:00:00 2001 From: daeun084 <030804jk@naver.com> Date: Thu, 18 Jan 2024 00:35:24 +0900 Subject: [PATCH 14/36] add: artist, reservation controller mapping --- .../artist/controller/ArtistController.java | 41 ++++++++++++++++++- .../mypage/controller/MyPageController.java | 2 +- .../controller/ReservationController.java | 27 ++++++++++++ .../shop/global/response/ApiResponse.java | 12 +++--- 4 files changed, 73 insertions(+), 9 deletions(-) create mode 100644 src/main/java/umc/meme/shop/domain/reservation/controller/ReservationController.java diff --git a/src/main/java/umc/meme/shop/domain/artist/controller/ArtistController.java b/src/main/java/umc/meme/shop/domain/artist/controller/ArtistController.java index 264492a..fe61aa2 100644 --- a/src/main/java/umc/meme/shop/domain/artist/controller/ArtistController.java +++ b/src/main/java/umc/meme/shop/domain/artist/controller/ArtistController.java @@ -1,8 +1,7 @@ package umc.meme.shop.domain.artist.controller; import lombok.RequiredArgsConstructor; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; import umc.meme.shop.domain.artist.service.ArtistService; import umc.meme.shop.global.ErrorStatus; import umc.meme.shop.global.SuccessStatus; @@ -12,6 +11,7 @@ @RestController @RequiredArgsConstructor +@RequestMapping("/api/v1") public class ArtistController { private final ArtistService artistService; @@ -30,4 +30,41 @@ public ApiResponse tempException(){ throw new GlobalException(ErrorStatus.TEMP); // return ApiResponse.SuccessResponse(SuccessStatus.TEMP); } + + // @Operation(summary = "프로필 관리") + @PatchMapping("/mypage/{userId}/profile") + public ApiResponse profile(){ + return ApiResponse.SuccessResponse(SuccessStatus.TEMP); + } + + // @Operation(summary = "포트폴리오 조회") + @GetMapping("/mypage/{userId}/portfolio") + public ApiResponse getPortfolio(){ + return ApiResponse.SuccessResponse(SuccessStatus.TEMP, ""); + } + + // @Operation(summary = "포트폴리오 생성") + @PostMapping("/mypage/{userId}/portfolio") + public ApiResponse postPortfolio(){ + return ApiResponse.SuccessResponse(SuccessStatus.TEMP); + } + + // @Operation(summary = "포트폴리오 수정") + @PatchMapping("/mypage/{userId}/portfolio") + public ApiResponse patchPortfolio(){ + return ApiResponse.SuccessResponse(SuccessStatus.TEMP); + } + + // @Operation(summary = "예약 조회") + @GetMapping("/mypage/{userId}/reservation") + public ApiResponse reservation(){ + return ApiResponse.SuccessResponse(SuccessStatus.TEMP, ""); + } + + // @Operation(summary = "리뷰 관리") + @PatchMapping("/artist/review") + public ApiResponse review(){ + return ApiResponse.SuccessResponse(SuccessStatus.TEMP); + } + } diff --git a/src/main/java/umc/meme/shop/domain/mypage/controller/MyPageController.java b/src/main/java/umc/meme/shop/domain/mypage/controller/MyPageController.java index 56e220a..1112ddd 100644 --- a/src/main/java/umc/meme/shop/domain/mypage/controller/MyPageController.java +++ b/src/main/java/umc/meme/shop/domain/mypage/controller/MyPageController.java @@ -7,7 +7,7 @@ @RestController @RequiredArgsConstructor -@RequestMapping("api/v1/mypage") +@RequestMapping("/api/v1/mypage") public class MyPageController { // @Operation(summary = "마이페이지") diff --git a/src/main/java/umc/meme/shop/domain/reservation/controller/ReservationController.java b/src/main/java/umc/meme/shop/domain/reservation/controller/ReservationController.java new file mode 100644 index 0000000..efc6e2e --- /dev/null +++ b/src/main/java/umc/meme/shop/domain/reservation/controller/ReservationController.java @@ -0,0 +1,27 @@ +package umc.meme.shop.domain.reservation.controller; + +import lombok.RequiredArgsConstructor; +import org.springframework.web.bind.annotation.PatchMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import umc.meme.shop.global.SuccessStatus; +import umc.meme.shop.global.response.ApiResponse; + +@RestController +@RequiredArgsConstructor +@RequestMapping("/api/v1/reservation") +public class ReservationController { + + // @Operation(summary = "예약 상태 변경") + @PatchMapping("/alteration") + public ApiResponse alteration(){ + return ApiResponse.SuccessResponse(SuccessStatus.TEMP); + } + + // @Operation(summary = "예약하기") + @PostMapping("/") + public ApiResponse reservation(){ + return ApiResponse.SuccessResponse(SuccessStatus.TEMP); + } +} diff --git a/src/main/java/umc/meme/shop/global/response/ApiResponse.java b/src/main/java/umc/meme/shop/global/response/ApiResponse.java index f883dbe..cef2163 100644 --- a/src/main/java/umc/meme/shop/global/response/ApiResponse.java +++ b/src/main/java/umc/meme/shop/global/response/ApiResponse.java @@ -9,27 +9,27 @@ @Getter @AllArgsConstructor -@JsonPropertyOrder({"isSuccess", "statusCode", "message", "data"}) +@JsonPropertyOrder({"code", "result", "message", "data"}) public class ApiResponse { - private final String isSuccess; private final int statusCode; + private final String result; private final String message; @JsonInclude(JsonInclude.Include.NON_NULL) private final T data; public static ApiResponse SuccessResponse(SuccessStatus status, T data){ - return new ApiResponse<>("SUCCESS", status.getCode(), status.getMessage(), data); + return new ApiResponse<>(status.getCode(), "SUCCESS", status.getMessage(), data); } public static ApiResponse SuccessResponse(SuccessStatus status){ - return new ApiResponse<>("SUCCESS", status.getCode(), status.getMessage(), ""); + return new ApiResponse<>(status.getCode(), "SUCCESS", status.getMessage(), ""); } public static ApiResponse FailureResponse(int statusCode, String message){ - return new ApiResponse<>("FAILURE", statusCode, message, ""); + return new ApiResponse<>(statusCode, "FAILURE", message, ""); } public static ApiResponse FailureResponse(ErrorStatus errorStatus){ - return new ApiResponse<>("FAILURE", errorStatus.getCode(), errorStatus.getMessage(), ""); + return new ApiResponse<>(errorStatus.getCode(), "FAILURE", errorStatus.getMessage(), ""); } } From 09703bec91cbdf6f6a8d3da6a62a5bf751332003 Mon Sep 17 00:00:00 2001 From: daeun084 <030804jk@naver.com> Date: Thu, 18 Jan 2024 00:51:06 +0900 Subject: [PATCH 15/36] add: model controller mapping --- .../model/controller/ModelController.java | 65 ++++++++++++++++++- 1 file changed, 64 insertions(+), 1 deletion(-) diff --git a/src/main/java/umc/meme/shop/domain/model/controller/ModelController.java b/src/main/java/umc/meme/shop/domain/model/controller/ModelController.java index 4ddd061..09458ae 100644 --- a/src/main/java/umc/meme/shop/domain/model/controller/ModelController.java +++ b/src/main/java/umc/meme/shop/domain/model/controller/ModelController.java @@ -1,11 +1,74 @@ package umc.meme.shop.domain.model.controller; import lombok.RequiredArgsConstructor; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; import umc.meme.shop.domain.model.service.ModelService; +import umc.meme.shop.global.SuccessStatus; +import umc.meme.shop.global.response.ApiResponse; @RestController @RequiredArgsConstructor +@RequestMapping("/api/v1") public class ModelController { private final ModelService modelService; + + // @Operation(summary = "상세 정보 수정") + @PatchMapping("/mypage/{userId}/type") + public ApiResponse type(){ + return ApiResponse.SuccessResponse(SuccessStatus.TEMP); + } + + /**favorite**/ + + // @Operation(summary = "관심 아티스트 조회") + @GetMapping("/mypage/{userId}/favorite/artist") + public ApiResponse favoriteArtist(){ + return ApiResponse.SuccessResponse(SuccessStatus.TEMP, ""); + } + + // @Operation(summary = "관심 메이크업 조회") + @GetMapping("/mypage/{userId}/favorite/portfolio") + public ApiResponse favoritePortfolio(){ + return ApiResponse.SuccessResponse(SuccessStatus.TEMP, ""); + } + + /**review**/ + + // @Operation(summary = "내가 쓴 리뷰 조회") + @GetMapping("/mypage/{userId}/review") + public ApiResponse getReview(){ + return ApiResponse.SuccessResponse(SuccessStatus.TEMP, ""); + } + + // @Operation(summary = "리뷰 작성") + @PostMapping("/model/review") + public ApiResponse postReview(){ + return ApiResponse.SuccessResponse(SuccessStatus.TEMP); + } + + /**search**/ + + // @Operation(summary = "메이크업 검색") + @GetMapping("/search") + public ApiResponse search(){ + return ApiResponse.SuccessResponse(SuccessStatus.TEMP, ""); + } + + // @Operation(summary = "메이크업 검색 - 관심 아티스트") + @GetMapping("/search/artist") + public ApiResponse searchArtist(){ + return ApiResponse.SuccessResponse(SuccessStatus.TEMP, ""); + } + + // @Operation(summary = "메이크업 검색 - 최근 검색어") + @GetMapping("/search/recent") + public ApiResponse searchRecent(){ + return ApiResponse.SuccessResponse(SuccessStatus.TEMP, ""); + } + + // @Operation(summary = "메이크업 검색 - 카테고리") + @GetMapping("/search/category") + public ApiResponse searchCategory(){ + return ApiResponse.SuccessResponse(SuccessStatus.TEMP, ""); + } } From 91fb54aaad918bde4164d2e88d6e09295be9cbb2 Mon Sep 17 00:00:00 2001 From: daeun084 <030804jk@naver.com> Date: Thu, 18 Jan 2024 01:10:57 +0900 Subject: [PATCH 16/36] =?UTF-8?q?add:=20success=20status=20data=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../artist/controller/ArtistController.java | 12 +++---- .../model/controller/ModelController.java | 18 +++++----- .../mypage/controller/MyPageController.java | 8 ++--- .../controller/ReservationController.java | 4 +-- .../umc/meme/shop/global/SuccessStatus.java | 36 ++++++++++++++++++- 5 files changed, 56 insertions(+), 22 deletions(-) diff --git a/src/main/java/umc/meme/shop/domain/artist/controller/ArtistController.java b/src/main/java/umc/meme/shop/domain/artist/controller/ArtistController.java index fe61aa2..8b5568a 100644 --- a/src/main/java/umc/meme/shop/domain/artist/controller/ArtistController.java +++ b/src/main/java/umc/meme/shop/domain/artist/controller/ArtistController.java @@ -34,37 +34,37 @@ public ApiResponse tempException(){ // @Operation(summary = "프로필 관리") @PatchMapping("/mypage/{userId}/profile") public ApiResponse profile(){ - return ApiResponse.SuccessResponse(SuccessStatus.TEMP); + return ApiResponse.SuccessResponse(SuccessStatus.PROFILE_UPDATE); } // @Operation(summary = "포트폴리오 조회") @GetMapping("/mypage/{userId}/portfolio") public ApiResponse getPortfolio(){ - return ApiResponse.SuccessResponse(SuccessStatus.TEMP, ""); + return ApiResponse.SuccessResponse(SuccessStatus.PORTFOLIO_GET, ""); } // @Operation(summary = "포트폴리오 생성") @PostMapping("/mypage/{userId}/portfolio") public ApiResponse postPortfolio(){ - return ApiResponse.SuccessResponse(SuccessStatus.TEMP); + return ApiResponse.SuccessResponse(SuccessStatus.PORTFOLIO_CREATE); } // @Operation(summary = "포트폴리오 수정") @PatchMapping("/mypage/{userId}/portfolio") public ApiResponse patchPortfolio(){ - return ApiResponse.SuccessResponse(SuccessStatus.TEMP); + return ApiResponse.SuccessResponse(SuccessStatus.PORTFOLIO_UPDATE); } // @Operation(summary = "예약 조회") @GetMapping("/mypage/{userId}/reservation") public ApiResponse reservation(){ - return ApiResponse.SuccessResponse(SuccessStatus.TEMP, ""); + return ApiResponse.SuccessResponse(SuccessStatus.RESERVATION_GET, ""); } // @Operation(summary = "리뷰 관리") @PatchMapping("/artist/review") public ApiResponse review(){ - return ApiResponse.SuccessResponse(SuccessStatus.TEMP); + return ApiResponse.SuccessResponse(SuccessStatus.REVIEW_UPDATE); } } diff --git a/src/main/java/umc/meme/shop/domain/model/controller/ModelController.java b/src/main/java/umc/meme/shop/domain/model/controller/ModelController.java index 09458ae..6ab8385 100644 --- a/src/main/java/umc/meme/shop/domain/model/controller/ModelController.java +++ b/src/main/java/umc/meme/shop/domain/model/controller/ModelController.java @@ -15,7 +15,7 @@ public class ModelController { // @Operation(summary = "상세 정보 수정") @PatchMapping("/mypage/{userId}/type") public ApiResponse type(){ - return ApiResponse.SuccessResponse(SuccessStatus.TEMP); + return ApiResponse.SuccessResponse(SuccessStatus.TYPE_UPDATE); } /**favorite**/ @@ -23,13 +23,13 @@ public ApiResponse type(){ // @Operation(summary = "관심 아티스트 조회") @GetMapping("/mypage/{userId}/favorite/artist") public ApiResponse favoriteArtist(){ - return ApiResponse.SuccessResponse(SuccessStatus.TEMP, ""); + return ApiResponse.SuccessResponse(SuccessStatus.FAVORITE_ARTIST_GET, ""); } // @Operation(summary = "관심 메이크업 조회") @GetMapping("/mypage/{userId}/favorite/portfolio") public ApiResponse favoritePortfolio(){ - return ApiResponse.SuccessResponse(SuccessStatus.TEMP, ""); + return ApiResponse.SuccessResponse(SuccessStatus.FAVORITE_PORTFOLIO_GET, ""); } /**review**/ @@ -37,13 +37,13 @@ public ApiResponse favoritePortfolio(){ // @Operation(summary = "내가 쓴 리뷰 조회") @GetMapping("/mypage/{userId}/review") public ApiResponse getReview(){ - return ApiResponse.SuccessResponse(SuccessStatus.TEMP, ""); + return ApiResponse.SuccessResponse(SuccessStatus.REVIEW_GET, ""); } // @Operation(summary = "리뷰 작성") @PostMapping("/model/review") public ApiResponse postReview(){ - return ApiResponse.SuccessResponse(SuccessStatus.TEMP); + return ApiResponse.SuccessResponse(SuccessStatus.REVIEW_CREATE); } /**search**/ @@ -51,24 +51,24 @@ public ApiResponse postReview(){ // @Operation(summary = "메이크업 검색") @GetMapping("/search") public ApiResponse search(){ - return ApiResponse.SuccessResponse(SuccessStatus.TEMP, ""); + return ApiResponse.SuccessResponse(SuccessStatus.SEARCH_GET, ""); } // @Operation(summary = "메이크업 검색 - 관심 아티스트") @GetMapping("/search/artist") public ApiResponse searchArtist(){ - return ApiResponse.SuccessResponse(SuccessStatus.TEMP, ""); + return ApiResponse.SuccessResponse(SuccessStatus.SEARCH_GET, ""); } // @Operation(summary = "메이크업 검색 - 최근 검색어") @GetMapping("/search/recent") public ApiResponse searchRecent(){ - return ApiResponse.SuccessResponse(SuccessStatus.TEMP, ""); + return ApiResponse.SuccessResponse(SuccessStatus.SEARCH_GET, ""); } // @Operation(summary = "메이크업 검색 - 카테고리") @GetMapping("/search/category") public ApiResponse searchCategory(){ - return ApiResponse.SuccessResponse(SuccessStatus.TEMP, ""); + return ApiResponse.SuccessResponse(SuccessStatus.SEARCH_GET, ""); } } diff --git a/src/main/java/umc/meme/shop/domain/mypage/controller/MyPageController.java b/src/main/java/umc/meme/shop/domain/mypage/controller/MyPageController.java index 1112ddd..505e89a 100644 --- a/src/main/java/umc/meme/shop/domain/mypage/controller/MyPageController.java +++ b/src/main/java/umc/meme/shop/domain/mypage/controller/MyPageController.java @@ -13,24 +13,24 @@ public class MyPageController { // @Operation(summary = "마이페이지") @GetMapping("/{userId}") public ApiResponse mypage(){ - return ApiResponse.SuccessResponse(SuccessStatus.TEMP, ""); + return ApiResponse.SuccessResponse(SuccessStatus.MYPAGE_GET, ""); } // @Operation(summary = "내 정보 수정") @PatchMapping("/{userId}/details") public ApiResponse details(){ - return ApiResponse.SuccessResponse(SuccessStatus.TEMP, ""); + return ApiResponse.SuccessResponse(SuccessStatus.DETAILS_UPDATE, ""); } // @Operation(summary = "약관 및 정책") @GetMapping("/tos") public ApiResponse tos(){ - return ApiResponse.SuccessResponse(SuccessStatus.TEMP, ""); + return ApiResponse.SuccessResponse(SuccessStatus.TOS_GET, ""); } // @Operation(summary = "문의하기") @PostMapping("/contact") public ApiResponse contact(){ - return ApiResponse.SuccessResponse(SuccessStatus.TEMP, ""); + return ApiResponse.SuccessResponse(SuccessStatus.CONTACT_CREATE, ""); } } diff --git a/src/main/java/umc/meme/shop/domain/reservation/controller/ReservationController.java b/src/main/java/umc/meme/shop/domain/reservation/controller/ReservationController.java index efc6e2e..7a42424 100644 --- a/src/main/java/umc/meme/shop/domain/reservation/controller/ReservationController.java +++ b/src/main/java/umc/meme/shop/domain/reservation/controller/ReservationController.java @@ -16,12 +16,12 @@ public class ReservationController { // @Operation(summary = "예약 상태 변경") @PatchMapping("/alteration") public ApiResponse alteration(){ - return ApiResponse.SuccessResponse(SuccessStatus.TEMP); + return ApiResponse.SuccessResponse(SuccessStatus.RESERVATION_UPDATE); } // @Operation(summary = "예약하기") @PostMapping("/") public ApiResponse reservation(){ - return ApiResponse.SuccessResponse(SuccessStatus.TEMP); + return ApiResponse.SuccessResponse(SuccessStatus.RESERVATION_CREATE); } } diff --git a/src/main/java/umc/meme/shop/global/SuccessStatus.java b/src/main/java/umc/meme/shop/global/SuccessStatus.java index 6ee7d95..eaef1a5 100644 --- a/src/main/java/umc/meme/shop/global/SuccessStatus.java +++ b/src/main/java/umc/meme/shop/global/SuccessStatus.java @@ -6,7 +6,41 @@ @Getter @AllArgsConstructor public enum SuccessStatus { - TEMP(200, "TEMP"); + + //TODO: code 수정 + TEMP(200, "TEMP"), + + /**artist**/ + PROFILE_UPDATE(200, "프로필 수정이 완료되었습니다"), + + PORTFOLIO_CREATE(200, "포트폴리오 생성이 완료되었습니다"), + PORTFOLIO_GET(200, "포트폴리오 조회가 완료되었습니다"), + PORTFOLIO_UPDATE(200, "포트폴리오 수정이 완료되었습니다"), + + /**model**/ + TYPE_UPDATE(200, "상세 정보 수정이 완료되었습니다"), + + FAVORITE_ARTIST_GET(200, "관심 아티스트 조회가 완료되었습니다"), + FAVORITE_PORTFOLIO_GET(200, "관심 메이크업 조회가 완료되었습니다"), + + SEARCH_GET(200, "조회가 완료되었습니다"), + + /**review**/ + REVIEW_CREATE(200, "리뷰 작성이 완료되었습니다"), + REVIEW_GET(200, "리뷰 조회가 완료되었습니다"), + REVIEW_UPDATE(200, "리뷰 관리가 완료되었습니다"), + + /**reservation**/ + RESERVATION_CREATE(200, "예약이 완료되었습니다"), + RESERVATION_GET(200, "예약 조회가 완료되었습니다"), + RESERVATION_UPDATE(200, "예약 상태 변경이 완료되었습니다"), + + /**mypage**/ + MYPAGE_GET(200, "마이페이지 조회가 완료되었습니다"), + DETAILS_UPDATE(200, "내 정보 수정이 완료되었습니다"), + TOS_GET(200, "약관 및 정책 조회가 완료되었습니다"), + CONTACT_CREATE(200, "문의 작성이 완료되었습니다"); + private final int code; private final String message; From 67b1ad07a302b0d6db1c5f75f96c43fcfd54605f Mon Sep 17 00:00:00 2001 From: daeun084 <030804jk@naver.com> Date: Thu, 18 Jan 2024 03:39:22 +0900 Subject: [PATCH 17/36] =?UTF-8?q?add:=20artist,=20mypage=20request=20dto?= =?UTF-8?q?=20=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../artist/controller/ArtistController.java | 20 +++++++++----- .../artist/dto/request/PortfolioDto.java | 17 ++++++++++++ .../domain/artist/dto/request/ProfileDto.java | 26 +++++++++++++++++++ .../domain/artist/dto/request/ReviewDto.java | 12 +++++++++ .../mypage/controller/MyPageController.java | 11 ++++---- .../mypage/dto/response/MypageDetailDto.java | 14 ++++++++++ .../umc/meme/shop/global/SuccessStatus.java | 2 +- 7 files changed, 89 insertions(+), 13 deletions(-) create mode 100644 src/main/java/umc/meme/shop/domain/artist/dto/request/PortfolioDto.java create mode 100644 src/main/java/umc/meme/shop/domain/artist/dto/request/ProfileDto.java create mode 100644 src/main/java/umc/meme/shop/domain/artist/dto/request/ReviewDto.java create mode 100644 src/main/java/umc/meme/shop/domain/mypage/dto/response/MypageDetailDto.java diff --git a/src/main/java/umc/meme/shop/domain/artist/controller/ArtistController.java b/src/main/java/umc/meme/shop/domain/artist/controller/ArtistController.java index 8b5568a..e2ef845 100644 --- a/src/main/java/umc/meme/shop/domain/artist/controller/ArtistController.java +++ b/src/main/java/umc/meme/shop/domain/artist/controller/ArtistController.java @@ -2,6 +2,9 @@ import lombok.RequiredArgsConstructor; import org.springframework.web.bind.annotation.*; +import umc.meme.shop.domain.artist.dto.request.PortfolioDto; +import umc.meme.shop.domain.artist.dto.request.ProfileDto; +import umc.meme.shop.domain.artist.dto.request.ReviewDto; import umc.meme.shop.domain.artist.service.ArtistService; import umc.meme.shop.global.ErrorStatus; import umc.meme.shop.global.SuccessStatus; @@ -33,37 +36,40 @@ public ApiResponse tempException(){ // @Operation(summary = "프로필 관리") @PatchMapping("/mypage/{userId}/profile") - public ApiResponse profile(){ + public ApiResponse updateProfile(@PathVariable Long userId, @RequestBody ProfileDto profileDto){ return ApiResponse.SuccessResponse(SuccessStatus.PROFILE_UPDATE); } // @Operation(summary = "포트폴리오 조회") @GetMapping("/mypage/{userId}/portfolio") - public ApiResponse getPortfolio(){ + public ApiResponse getPortfolio(@PathVariable Long userId){ return ApiResponse.SuccessResponse(SuccessStatus.PORTFOLIO_GET, ""); } // @Operation(summary = "포트폴리오 생성") @PostMapping("/mypage/{userId}/portfolio") - public ApiResponse postPortfolio(){ + public ApiResponse createPortfolio(@PathVariable Long userId, @RequestBody PortfolioDto portfolioDto){ + // TODO: PortfolioImg 추가 return ApiResponse.SuccessResponse(SuccessStatus.PORTFOLIO_CREATE); } - // @Operation(summary = "포트폴리오 수정") + // @Operation(summary = "포트폴리오 수정/삭제") @PatchMapping("/mypage/{userId}/portfolio") - public ApiResponse patchPortfolio(){ + public ApiResponse updatePortfolio(@PathVariable Long userId, @RequestBody PortfolioDto portfolioDto){ + // TODO: 수정용 portfolio dto 분리 + // TODO: PortfolioImg 추가 return ApiResponse.SuccessResponse(SuccessStatus.PORTFOLIO_UPDATE); } // @Operation(summary = "예약 조회") @GetMapping("/mypage/{userId}/reservation") - public ApiResponse reservation(){ + public ApiResponse getReservation(@PathVariable Long userId){ return ApiResponse.SuccessResponse(SuccessStatus.RESERVATION_GET, ""); } // @Operation(summary = "리뷰 관리") @PatchMapping("/artist/review") - public ApiResponse review(){ + public ApiResponse updateReview(@RequestBody ReviewDto reviewDto){ return ApiResponse.SuccessResponse(SuccessStatus.REVIEW_UPDATE); } diff --git a/src/main/java/umc/meme/shop/domain/artist/dto/request/PortfolioDto.java b/src/main/java/umc/meme/shop/domain/artist/dto/request/PortfolioDto.java new file mode 100644 index 0000000..91c741c --- /dev/null +++ b/src/main/java/umc/meme/shop/domain/artist/dto/request/PortfolioDto.java @@ -0,0 +1,17 @@ +package umc.meme.shop.domain.artist.dto.request; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import umc.meme.shop.domain.portfolio.entity.enums.Category; + +@Data +@NoArgsConstructor +@AllArgsConstructor +public class PortfolioDto { + private Category category; + private String makeupName; + private int price; + private String info; + private boolean isBlock; +} diff --git a/src/main/java/umc/meme/shop/domain/artist/dto/request/ProfileDto.java b/src/main/java/umc/meme/shop/domain/artist/dto/request/ProfileDto.java new file mode 100644 index 0000000..43e6ab8 --- /dev/null +++ b/src/main/java/umc/meme/shop/domain/artist/dto/request/ProfileDto.java @@ -0,0 +1,26 @@ +package umc.meme.shop.domain.artist.dto.request; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import umc.meme.shop.domain.artist.entity.enums.AvailableTime; +import umc.meme.shop.domain.artist.entity.enums.Gender; +import umc.meme.shop.domain.artist.entity.enums.MakeupLocation; +import umc.meme.shop.domain.artist.entity.enums.Region; +import umc.meme.shop.domain.portfolio.entity.enums.Category; + +import java.util.List; + +@Data +@NoArgsConstructor +@AllArgsConstructor +public class ProfileDto { + private String profileImg; + private String nickname; + private Gender gender; + private String introduction; + private List region; + private List specialization; + private MakeupLocation makeupLocation; + private AvailableTime availableTime; +} diff --git a/src/main/java/umc/meme/shop/domain/artist/dto/request/ReviewDto.java b/src/main/java/umc/meme/shop/domain/artist/dto/request/ReviewDto.java new file mode 100644 index 0000000..928ef97 --- /dev/null +++ b/src/main/java/umc/meme/shop/domain/artist/dto/request/ReviewDto.java @@ -0,0 +1,12 @@ +package umc.meme.shop.domain.artist.dto.request; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +@Data +@NoArgsConstructor +@AllArgsConstructor +public class ReviewDto { + private boolean isBlock; +} diff --git a/src/main/java/umc/meme/shop/domain/mypage/controller/MyPageController.java b/src/main/java/umc/meme/shop/domain/mypage/controller/MyPageController.java index 505e89a..e4b964a 100644 --- a/src/main/java/umc/meme/shop/domain/mypage/controller/MyPageController.java +++ b/src/main/java/umc/meme/shop/domain/mypage/controller/MyPageController.java @@ -12,14 +12,15 @@ public class MyPageController { // @Operation(summary = "마이페이지") @GetMapping("/{userId}") - public ApiResponse mypage(){ + public ApiResponse mypage(@PathVariable Long userId){ return ApiResponse.SuccessResponse(SuccessStatus.MYPAGE_GET, ""); } -// @Operation(summary = "내 정보 수정") - @PatchMapping("/{userId}/details") - public ApiResponse details(){ - return ApiResponse.SuccessResponse(SuccessStatus.DETAILS_UPDATE, ""); +// @Operation(summary = "내 정보 조회") + @GetMapping("/{userId}/details") + public ApiResponse details(@PathVariable Long userId){ + //MypageDetailDto + return ApiResponse.SuccessResponse(SuccessStatus.DETAILS_GET, ""); } // @Operation(summary = "약관 및 정책") diff --git a/src/main/java/umc/meme/shop/domain/mypage/dto/response/MypageDetailDto.java b/src/main/java/umc/meme/shop/domain/mypage/dto/response/MypageDetailDto.java new file mode 100644 index 0000000..fa5f87d --- /dev/null +++ b/src/main/java/umc/meme/shop/domain/mypage/dto/response/MypageDetailDto.java @@ -0,0 +1,14 @@ +package umc.meme.shop.domain.mypage.dto.response; + + +import lombok.Data; +import umc.meme.shop.domain.artist.entity.enums.Gender; + +@Data +public class MypageDetailDto { + private String profileImg; + private String nickname; + private String name; + private Gender gender; + private String email; +} diff --git a/src/main/java/umc/meme/shop/global/SuccessStatus.java b/src/main/java/umc/meme/shop/global/SuccessStatus.java index eaef1a5..6092369 100644 --- a/src/main/java/umc/meme/shop/global/SuccessStatus.java +++ b/src/main/java/umc/meme/shop/global/SuccessStatus.java @@ -37,7 +37,7 @@ public enum SuccessStatus { /**mypage**/ MYPAGE_GET(200, "마이페이지 조회가 완료되었습니다"), - DETAILS_UPDATE(200, "내 정보 수정이 완료되었습니다"), + DETAILS_GET(200, "내 정보 조회가 완료되었습니다"), TOS_GET(200, "약관 및 정책 조회가 완료되었습니다"), CONTACT_CREATE(200, "문의 작성이 완료되었습니다"); From 3b1103ffb40b37ee40e797548f66e1d52557e133 Mon Sep 17 00:00:00 2001 From: daeun084 <030804jk@naver.com> Date: Thu, 18 Jan 2024 03:59:20 +0900 Subject: [PATCH 18/36] =?UTF-8?q?add:=20model,=20reservation=20request=20d?= =?UTF-8?q?to=20=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/model/controller/ModelController.java | 13 ++++++++----- .../domain/model/dto/request/ModelTypeDto.java | 15 +++++++++++++++ .../controller/ReservationController.java | 11 +++++------ .../dto/request/AlterReservationDto.java | 9 +++++++++ .../reservation/dto/request/ReservationDto.java | 14 ++++++++++++++ .../shop/domain/review/dto/request/ReviewDto.java | 9 +++++++++ 6 files changed, 60 insertions(+), 11 deletions(-) create mode 100644 src/main/java/umc/meme/shop/domain/model/dto/request/ModelTypeDto.java create mode 100644 src/main/java/umc/meme/shop/domain/reservation/dto/request/AlterReservationDto.java create mode 100644 src/main/java/umc/meme/shop/domain/reservation/dto/request/ReservationDto.java create mode 100644 src/main/java/umc/meme/shop/domain/review/dto/request/ReviewDto.java diff --git a/src/main/java/umc/meme/shop/domain/model/controller/ModelController.java b/src/main/java/umc/meme/shop/domain/model/controller/ModelController.java index 6ab8385..5974931 100644 --- a/src/main/java/umc/meme/shop/domain/model/controller/ModelController.java +++ b/src/main/java/umc/meme/shop/domain/model/controller/ModelController.java @@ -2,7 +2,9 @@ import lombok.RequiredArgsConstructor; import org.springframework.web.bind.annotation.*; +import umc.meme.shop.domain.model.dto.request.ModelTypeDto; import umc.meme.shop.domain.model.service.ModelService; +import umc.meme.shop.domain.review.dto.request.ReviewDto; import umc.meme.shop.global.SuccessStatus; import umc.meme.shop.global.response.ApiResponse; @@ -14,7 +16,7 @@ public class ModelController { // @Operation(summary = "상세 정보 수정") @PatchMapping("/mypage/{userId}/type") - public ApiResponse type(){ + public ApiResponse type(@PathVariable Long userId, @RequestBody ModelTypeDto modelTypeDto){ return ApiResponse.SuccessResponse(SuccessStatus.TYPE_UPDATE); } @@ -22,13 +24,13 @@ public ApiResponse type(){ // @Operation(summary = "관심 아티스트 조회") @GetMapping("/mypage/{userId}/favorite/artist") - public ApiResponse favoriteArtist(){ + public ApiResponse favoriteArtist(@PathVariable Long userId){ return ApiResponse.SuccessResponse(SuccessStatus.FAVORITE_ARTIST_GET, ""); } // @Operation(summary = "관심 메이크업 조회") @GetMapping("/mypage/{userId}/favorite/portfolio") - public ApiResponse favoritePortfolio(){ + public ApiResponse favoritePortfolio(@PathVariable Long userId){ return ApiResponse.SuccessResponse(SuccessStatus.FAVORITE_PORTFOLIO_GET, ""); } @@ -36,13 +38,14 @@ public ApiResponse favoritePortfolio(){ // @Operation(summary = "내가 쓴 리뷰 조회") @GetMapping("/mypage/{userId}/review") - public ApiResponse getReview(){ + public ApiResponse getReview(@PathVariable Long userId){ return ApiResponse.SuccessResponse(SuccessStatus.REVIEW_GET, ""); } // @Operation(summary = "리뷰 작성") @PostMapping("/model/review") - public ApiResponse postReview(){ + public ApiResponse postReview(@RequestBody ReviewDto reviewDto){ + //TODO: ReviewImg 추가 return ApiResponse.SuccessResponse(SuccessStatus.REVIEW_CREATE); } diff --git a/src/main/java/umc/meme/shop/domain/model/dto/request/ModelTypeDto.java b/src/main/java/umc/meme/shop/domain/model/dto/request/ModelTypeDto.java new file mode 100644 index 0000000..64710e6 --- /dev/null +++ b/src/main/java/umc/meme/shop/domain/model/dto/request/ModelTypeDto.java @@ -0,0 +1,15 @@ +package umc.meme.shop.domain.model.dto.request; + +import lombok.Data; +import umc.meme.shop.domain.artist.entity.enums.Gender; +import umc.meme.shop.domain.model.entity.enums.PersonalColor; +import umc.meme.shop.domain.model.entity.enums.SkinType; + +@Data +public class ModelTypeDto { + private String profileImg; + private String nickname; + private Gender gender; + private SkinType skinType; + private PersonalColor personalColor; +} diff --git a/src/main/java/umc/meme/shop/domain/reservation/controller/ReservationController.java b/src/main/java/umc/meme/shop/domain/reservation/controller/ReservationController.java index 7a42424..36b3feb 100644 --- a/src/main/java/umc/meme/shop/domain/reservation/controller/ReservationController.java +++ b/src/main/java/umc/meme/shop/domain/reservation/controller/ReservationController.java @@ -1,10 +1,9 @@ package umc.meme.shop.domain.reservation.controller; import lombok.RequiredArgsConstructor; -import org.springframework.web.bind.annotation.PatchMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; +import umc.meme.shop.domain.reservation.dto.request.AlterReservationDto; +import umc.meme.shop.domain.reservation.dto.request.ReservationDto; import umc.meme.shop.global.SuccessStatus; import umc.meme.shop.global.response.ApiResponse; @@ -15,13 +14,13 @@ public class ReservationController { // @Operation(summary = "예약 상태 변경") @PatchMapping("/alteration") - public ApiResponse alteration(){ + public ApiResponse alteration(@RequestBody AlterReservationDto alterReservationDto){ return ApiResponse.SuccessResponse(SuccessStatus.RESERVATION_UPDATE); } // @Operation(summary = "예약하기") @PostMapping("/") - public ApiResponse reservation(){ + public ApiResponse reservation(@RequestBody ReservationDto reservationDto){ return ApiResponse.SuccessResponse(SuccessStatus.RESERVATION_CREATE); } } diff --git a/src/main/java/umc/meme/shop/domain/reservation/dto/request/AlterReservationDto.java b/src/main/java/umc/meme/shop/domain/reservation/dto/request/AlterReservationDto.java new file mode 100644 index 0000000..20b9783 --- /dev/null +++ b/src/main/java/umc/meme/shop/domain/reservation/dto/request/AlterReservationDto.java @@ -0,0 +1,9 @@ +package umc.meme.shop.domain.reservation.dto.request; + +import lombok.Data; +import umc.meme.shop.domain.reservation.entity.enums.Status; + +@Data +public class AlterReservationDto { + private Status status; +} diff --git a/src/main/java/umc/meme/shop/domain/reservation/dto/request/ReservationDto.java b/src/main/java/umc/meme/shop/domain/reservation/dto/request/ReservationDto.java new file mode 100644 index 0000000..05b50bd --- /dev/null +++ b/src/main/java/umc/meme/shop/domain/reservation/dto/request/ReservationDto.java @@ -0,0 +1,14 @@ +package umc.meme.shop.domain.reservation.dto.request; + +import lombok.Data; +import umc.meme.shop.domain.reservation.entity.enums.ReservationTime; + +import java.util.Date; + +@Data +public class ReservationDto { + private Long modelId; + private Long portfolioId; + private Date reservationDate; + private ReservationTime reservationTime; +} diff --git a/src/main/java/umc/meme/shop/domain/review/dto/request/ReviewDto.java b/src/main/java/umc/meme/shop/domain/review/dto/request/ReviewDto.java new file mode 100644 index 0000000..863bc47 --- /dev/null +++ b/src/main/java/umc/meme/shop/domain/review/dto/request/ReviewDto.java @@ -0,0 +1,9 @@ +package umc.meme.shop.domain.review.dto.request; + +import lombok.Data; + +@Data +public class ReviewDto { + private int star; + private String comment; +} From a37c6291d8320e434414b1fae087d8deac91e7b2 Mon Sep 17 00:00:00 2001 From: daeun084 <030804jk@naver.com> Date: Thu, 18 Jan 2024 04:19:30 +0900 Subject: [PATCH 19/36] chore: request dto rename --- .../artist/controller/ArtistController.java | 17 +++++++-------- ...{ProfileDto.java => ArtistProfileDto.java} | 2 +- .../dto/request/CreatePortfolioDto.java | 21 +++++++++++++++++++ .../dto/request/UpdatePortfolioDto.java} | 4 ++-- .../dto/request/ReservationDto.java | 5 +++++ .../domain/review/dto/request/ReviewDto.java | 4 ++++ .../dto/request/UpdateReviewDto.java} | 4 ++-- 7 files changed, 43 insertions(+), 14 deletions(-) rename src/main/java/umc/meme/shop/domain/artist/dto/request/{ProfileDto.java => ArtistProfileDto.java} (96%) create mode 100644 src/main/java/umc/meme/shop/domain/portfolio/dto/request/CreatePortfolioDto.java rename src/main/java/umc/meme/shop/domain/{artist/dto/request/PortfolioDto.java => portfolio/dto/request/UpdatePortfolioDto.java} (79%) rename src/main/java/umc/meme/shop/domain/{artist/dto/request/ReviewDto.java => review/dto/request/UpdateReviewDto.java} (67%) diff --git a/src/main/java/umc/meme/shop/domain/artist/controller/ArtistController.java b/src/main/java/umc/meme/shop/domain/artist/controller/ArtistController.java index e2ef845..902a9e3 100644 --- a/src/main/java/umc/meme/shop/domain/artist/controller/ArtistController.java +++ b/src/main/java/umc/meme/shop/domain/artist/controller/ArtistController.java @@ -2,14 +2,14 @@ import lombok.RequiredArgsConstructor; import org.springframework.web.bind.annotation.*; -import umc.meme.shop.domain.artist.dto.request.PortfolioDto; -import umc.meme.shop.domain.artist.dto.request.ProfileDto; -import umc.meme.shop.domain.artist.dto.request.ReviewDto; +import umc.meme.shop.domain.portfolio.dto.request.CreatePortfolioDto; +import umc.meme.shop.domain.artist.dto.request.ArtistProfileDto; +import umc.meme.shop.domain.portfolio.dto.request.UpdatePortfolioDto; +import umc.meme.shop.domain.review.dto.request.UpdateReviewDto; import umc.meme.shop.domain.artist.service.ArtistService; import umc.meme.shop.global.ErrorStatus; import umc.meme.shop.global.SuccessStatus; import umc.meme.shop.global.exception.GlobalException; -import umc.meme.shop.global.exception.GlobalExceptionHandler; import umc.meme.shop.global.response.ApiResponse; @RestController @@ -36,7 +36,7 @@ public ApiResponse tempException(){ // @Operation(summary = "프로필 관리") @PatchMapping("/mypage/{userId}/profile") - public ApiResponse updateProfile(@PathVariable Long userId, @RequestBody ProfileDto profileDto){ + public ApiResponse updateProfile(@PathVariable Long userId, @RequestBody ArtistProfileDto profileDto){ return ApiResponse.SuccessResponse(SuccessStatus.PROFILE_UPDATE); } @@ -48,15 +48,14 @@ public ApiResponse getPortfolio(@PathVariable Long userId){ // @Operation(summary = "포트폴리오 생성") @PostMapping("/mypage/{userId}/portfolio") - public ApiResponse createPortfolio(@PathVariable Long userId, @RequestBody PortfolioDto portfolioDto){ + public ApiResponse createPortfolio(@PathVariable Long userId, @RequestBody CreatePortfolioDto portfolioDto){ // TODO: PortfolioImg 추가 return ApiResponse.SuccessResponse(SuccessStatus.PORTFOLIO_CREATE); } // @Operation(summary = "포트폴리오 수정/삭제") @PatchMapping("/mypage/{userId}/portfolio") - public ApiResponse updatePortfolio(@PathVariable Long userId, @RequestBody PortfolioDto portfolioDto){ - // TODO: 수정용 portfolio dto 분리 + public ApiResponse updatePortfolio(@PathVariable Long userId, @RequestBody UpdatePortfolioDto portfolioDto){ // TODO: PortfolioImg 추가 return ApiResponse.SuccessResponse(SuccessStatus.PORTFOLIO_UPDATE); } @@ -69,7 +68,7 @@ public ApiResponse getReservation(@PathVariable Long userId){ // @Operation(summary = "리뷰 관리") @PatchMapping("/artist/review") - public ApiResponse updateReview(@RequestBody ReviewDto reviewDto){ + public ApiResponse updateReview(@RequestBody UpdateReviewDto reviewDto){ return ApiResponse.SuccessResponse(SuccessStatus.REVIEW_UPDATE); } diff --git a/src/main/java/umc/meme/shop/domain/artist/dto/request/ProfileDto.java b/src/main/java/umc/meme/shop/domain/artist/dto/request/ArtistProfileDto.java similarity index 96% rename from src/main/java/umc/meme/shop/domain/artist/dto/request/ProfileDto.java rename to src/main/java/umc/meme/shop/domain/artist/dto/request/ArtistProfileDto.java index 43e6ab8..f928456 100644 --- a/src/main/java/umc/meme/shop/domain/artist/dto/request/ProfileDto.java +++ b/src/main/java/umc/meme/shop/domain/artist/dto/request/ArtistProfileDto.java @@ -14,7 +14,7 @@ @Data @NoArgsConstructor @AllArgsConstructor -public class ProfileDto { +public class ArtistProfileDto { private String profileImg; private String nickname; private Gender gender; diff --git a/src/main/java/umc/meme/shop/domain/portfolio/dto/request/CreatePortfolioDto.java b/src/main/java/umc/meme/shop/domain/portfolio/dto/request/CreatePortfolioDto.java new file mode 100644 index 0000000..33f3fa0 --- /dev/null +++ b/src/main/java/umc/meme/shop/domain/portfolio/dto/request/CreatePortfolioDto.java @@ -0,0 +1,21 @@ +package umc.meme.shop.domain.portfolio.dto.request; + +import jakarta.validation.constraints.NotBlank; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import umc.meme.shop.domain.portfolio.entity.enums.Category; + +@Data +@NoArgsConstructor +@AllArgsConstructor +public class CreatePortfolioDto { + @NotBlank(message = "카테고리를 입력해주세요") + private Category category; + @NotBlank(message = "메이크업 명을 입력해주세요") + private String makeupName; + @NotBlank(message = "가격을 입력해주세요") + private int price; + @NotBlank(message = "메이크업 정보를 입력해주세요") + private String info; +} diff --git a/src/main/java/umc/meme/shop/domain/artist/dto/request/PortfolioDto.java b/src/main/java/umc/meme/shop/domain/portfolio/dto/request/UpdatePortfolioDto.java similarity index 79% rename from src/main/java/umc/meme/shop/domain/artist/dto/request/PortfolioDto.java rename to src/main/java/umc/meme/shop/domain/portfolio/dto/request/UpdatePortfolioDto.java index 91c741c..94d01eb 100644 --- a/src/main/java/umc/meme/shop/domain/artist/dto/request/PortfolioDto.java +++ b/src/main/java/umc/meme/shop/domain/portfolio/dto/request/UpdatePortfolioDto.java @@ -1,4 +1,4 @@ -package umc.meme.shop.domain.artist.dto.request; +package umc.meme.shop.domain.portfolio.dto.request; import lombok.AllArgsConstructor; import lombok.Data; @@ -8,7 +8,7 @@ @Data @NoArgsConstructor @AllArgsConstructor -public class PortfolioDto { +public class UpdatePortfolioDto { private Category category; private String makeupName; private int price; diff --git a/src/main/java/umc/meme/shop/domain/reservation/dto/request/ReservationDto.java b/src/main/java/umc/meme/shop/domain/reservation/dto/request/ReservationDto.java index 05b50bd..a0f0a40 100644 --- a/src/main/java/umc/meme/shop/domain/reservation/dto/request/ReservationDto.java +++ b/src/main/java/umc/meme/shop/domain/reservation/dto/request/ReservationDto.java @@ -1,5 +1,6 @@ package umc.meme.shop.domain.reservation.dto.request; +import jakarta.validation.constraints.NotBlank; import lombok.Data; import umc.meme.shop.domain.reservation.entity.enums.ReservationTime; @@ -7,8 +8,12 @@ @Data public class ReservationDto { + @NotBlank(message = "modelId를 입력해주세요") private Long modelId; + @NotBlank(message = "portfolioId를 입력해주세요") private Long portfolioId; + @NotBlank(message = "예약날짜를 입력해주세요") private Date reservationDate; + @NotBlank(message = "예약시간을 입력해주세요") private ReservationTime reservationTime; } diff --git a/src/main/java/umc/meme/shop/domain/review/dto/request/ReviewDto.java b/src/main/java/umc/meme/shop/domain/review/dto/request/ReviewDto.java index 863bc47..b3b309a 100644 --- a/src/main/java/umc/meme/shop/domain/review/dto/request/ReviewDto.java +++ b/src/main/java/umc/meme/shop/domain/review/dto/request/ReviewDto.java @@ -1,9 +1,13 @@ package umc.meme.shop.domain.review.dto.request; +import jakarta.validation.constraints.NotBlank; import lombok.Data; @Data public class ReviewDto { + @NotBlank(message = "portfolioId를 입력해주세요") + private Long portfolioId; + @NotBlank(message = "별점을 입력해주세요") private int star; private String comment; } diff --git a/src/main/java/umc/meme/shop/domain/artist/dto/request/ReviewDto.java b/src/main/java/umc/meme/shop/domain/review/dto/request/UpdateReviewDto.java similarity index 67% rename from src/main/java/umc/meme/shop/domain/artist/dto/request/ReviewDto.java rename to src/main/java/umc/meme/shop/domain/review/dto/request/UpdateReviewDto.java index 928ef97..a62a25f 100644 --- a/src/main/java/umc/meme/shop/domain/artist/dto/request/ReviewDto.java +++ b/src/main/java/umc/meme/shop/domain/review/dto/request/UpdateReviewDto.java @@ -1,4 +1,4 @@ -package umc.meme.shop.domain.artist.dto.request; +package umc.meme.shop.domain.review.dto.request; import lombok.AllArgsConstructor; import lombok.Data; @@ -7,6 +7,6 @@ @Data @NoArgsConstructor @AllArgsConstructor -public class ReviewDto { +public class UpdateReviewDto { private boolean isBlock; } From abe29b017b6fc5aef6b78899a77904bcbebcf967 Mon Sep 17 00:00:00 2001 From: yeopyeop-82 Date: Tue, 23 Jan 2024 00:27:42 +0900 Subject: [PATCH 20/36] add: Swagger setting with springdoc 2.0.2 --- build.gradle | 1 + 1 file changed, 1 insertion(+) diff --git a/build.gradle b/build.gradle index b02b947..2822e36 100644 --- a/build.gradle +++ b/build.gradle @@ -25,6 +25,7 @@ dependencies { implementation 'org.springframework.boot:spring-boot-starter-data-jpa' implementation 'org.springframework.boot:spring-boot-starter-validation' implementation 'org.springframework.boot:spring-boot-starter-web' + implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.0.2' compileOnly 'org.projectlombok:lombok' runtimeOnly 'com.mysql:mysql-connector-j' annotationProcessor 'org.projectlombok:lombok' From cd2bc4a5a751f50765191817349bf6ea8c3563a2 Mon Sep 17 00:00:00 2001 From: yeopyeop-82 Date: Tue, 23 Jan 2024 00:37:10 +0900 Subject: [PATCH 21/36] chore: add summary - Thanks to angel daeun --- .../artist/controller/ArtistController.java | 13 +++++++------ .../model/controller/ModelController.java | 19 ++++++++++--------- .../mypage/controller/MyPageController.java | 9 +++++---- .../controller/ReservationController.java | 5 +++-- 4 files changed, 25 insertions(+), 21 deletions(-) diff --git a/src/main/java/umc/meme/shop/domain/artist/controller/ArtistController.java b/src/main/java/umc/meme/shop/domain/artist/controller/ArtistController.java index 902a9e3..97f0635 100644 --- a/src/main/java/umc/meme/shop/domain/artist/controller/ArtistController.java +++ b/src/main/java/umc/meme/shop/domain/artist/controller/ArtistController.java @@ -1,5 +1,6 @@ package umc.meme.shop.domain.artist.controller; +import io.swagger.v3.oas.annotations.Operation; import lombok.RequiredArgsConstructor; import org.springframework.web.bind.annotation.*; import umc.meme.shop.domain.portfolio.dto.request.CreatePortfolioDto; @@ -34,39 +35,39 @@ public ApiResponse tempException(){ // return ApiResponse.SuccessResponse(SuccessStatus.TEMP); } - // @Operation(summary = "프로필 관리") + @Operation(summary = "프로필 관리") @PatchMapping("/mypage/{userId}/profile") public ApiResponse updateProfile(@PathVariable Long userId, @RequestBody ArtistProfileDto profileDto){ return ApiResponse.SuccessResponse(SuccessStatus.PROFILE_UPDATE); } - // @Operation(summary = "포트폴리오 조회") + @Operation(summary = "포트폴리오 조회") @GetMapping("/mypage/{userId}/portfolio") public ApiResponse getPortfolio(@PathVariable Long userId){ return ApiResponse.SuccessResponse(SuccessStatus.PORTFOLIO_GET, ""); } - // @Operation(summary = "포트폴리오 생성") + @Operation(summary = "포트폴리오 생성") @PostMapping("/mypage/{userId}/portfolio") public ApiResponse createPortfolio(@PathVariable Long userId, @RequestBody CreatePortfolioDto portfolioDto){ // TODO: PortfolioImg 추가 return ApiResponse.SuccessResponse(SuccessStatus.PORTFOLIO_CREATE); } - // @Operation(summary = "포트폴리오 수정/삭제") + @Operation(summary = "포트폴리오 수정/삭제") @PatchMapping("/mypage/{userId}/portfolio") public ApiResponse updatePortfolio(@PathVariable Long userId, @RequestBody UpdatePortfolioDto portfolioDto){ // TODO: PortfolioImg 추가 return ApiResponse.SuccessResponse(SuccessStatus.PORTFOLIO_UPDATE); } - // @Operation(summary = "예약 조회") + @Operation(summary = "예약 조회") @GetMapping("/mypage/{userId}/reservation") public ApiResponse getReservation(@PathVariable Long userId){ return ApiResponse.SuccessResponse(SuccessStatus.RESERVATION_GET, ""); } - // @Operation(summary = "리뷰 관리") + @Operation(summary = "리뷰 관리") @PatchMapping("/artist/review") public ApiResponse updateReview(@RequestBody UpdateReviewDto reviewDto){ return ApiResponse.SuccessResponse(SuccessStatus.REVIEW_UPDATE); diff --git a/src/main/java/umc/meme/shop/domain/model/controller/ModelController.java b/src/main/java/umc/meme/shop/domain/model/controller/ModelController.java index 5974931..a18d5d7 100644 --- a/src/main/java/umc/meme/shop/domain/model/controller/ModelController.java +++ b/src/main/java/umc/meme/shop/domain/model/controller/ModelController.java @@ -1,5 +1,6 @@ package umc.meme.shop.domain.model.controller; +import io.swagger.v3.oas.annotations.Operation; import lombok.RequiredArgsConstructor; import org.springframework.web.bind.annotation.*; import umc.meme.shop.domain.model.dto.request.ModelTypeDto; @@ -14,7 +15,7 @@ public class ModelController { private final ModelService modelService; - // @Operation(summary = "상세 정보 수정") + @Operation(summary = "상세 정보 수정") @PatchMapping("/mypage/{userId}/type") public ApiResponse type(@PathVariable Long userId, @RequestBody ModelTypeDto modelTypeDto){ return ApiResponse.SuccessResponse(SuccessStatus.TYPE_UPDATE); @@ -22,13 +23,13 @@ public ApiResponse type(@PathVariable Long userId, @RequestBody ModelTypeDto mod /**favorite**/ - // @Operation(summary = "관심 아티스트 조회") + @Operation(summary = "관심 아티스트 조회") @GetMapping("/mypage/{userId}/favorite/artist") public ApiResponse favoriteArtist(@PathVariable Long userId){ return ApiResponse.SuccessResponse(SuccessStatus.FAVORITE_ARTIST_GET, ""); } - // @Operation(summary = "관심 메이크업 조회") + @Operation(summary = "관심 메이크업 조회") @GetMapping("/mypage/{userId}/favorite/portfolio") public ApiResponse favoritePortfolio(@PathVariable Long userId){ return ApiResponse.SuccessResponse(SuccessStatus.FAVORITE_PORTFOLIO_GET, ""); @@ -36,13 +37,13 @@ public ApiResponse favoritePortfolio(@PathVariable Long userId){ /**review**/ - // @Operation(summary = "내가 쓴 리뷰 조회") + @Operation(summary = "내가 쓴 리뷰 조회") @GetMapping("/mypage/{userId}/review") public ApiResponse getReview(@PathVariable Long userId){ return ApiResponse.SuccessResponse(SuccessStatus.REVIEW_GET, ""); } - // @Operation(summary = "리뷰 작성") + @Operation(summary = "리뷰 작성") @PostMapping("/model/review") public ApiResponse postReview(@RequestBody ReviewDto reviewDto){ //TODO: ReviewImg 추가 @@ -51,25 +52,25 @@ public ApiResponse postReview(@RequestBody ReviewDto reviewDto){ /**search**/ - // @Operation(summary = "메이크업 검색") + @Operation(summary = "메이크업 검색") @GetMapping("/search") public ApiResponse search(){ return ApiResponse.SuccessResponse(SuccessStatus.SEARCH_GET, ""); } - // @Operation(summary = "메이크업 검색 - 관심 아티스트") + @Operation(summary = "메이크업 검색 - 관심 아티스트") @GetMapping("/search/artist") public ApiResponse searchArtist(){ return ApiResponse.SuccessResponse(SuccessStatus.SEARCH_GET, ""); } - // @Operation(summary = "메이크업 검색 - 최근 검색어") + @Operation(summary = "메이크업 검색 - 최근 검색어") @GetMapping("/search/recent") public ApiResponse searchRecent(){ return ApiResponse.SuccessResponse(SuccessStatus.SEARCH_GET, ""); } - // @Operation(summary = "메이크업 검색 - 카테고리") + @Operation(summary = "메이크업 검색 - 카테고리") @GetMapping("/search/category") public ApiResponse searchCategory(){ return ApiResponse.SuccessResponse(SuccessStatus.SEARCH_GET, ""); diff --git a/src/main/java/umc/meme/shop/domain/mypage/controller/MyPageController.java b/src/main/java/umc/meme/shop/domain/mypage/controller/MyPageController.java index e4b964a..069075c 100644 --- a/src/main/java/umc/meme/shop/domain/mypage/controller/MyPageController.java +++ b/src/main/java/umc/meme/shop/domain/mypage/controller/MyPageController.java @@ -1,5 +1,6 @@ package umc.meme.shop.domain.mypage.controller; +import io.swagger.v3.oas.annotations.Operation; import lombok.RequiredArgsConstructor; import org.springframework.web.bind.annotation.*; import umc.meme.shop.global.SuccessStatus; @@ -10,26 +11,26 @@ @RequestMapping("/api/v1/mypage") public class MyPageController { -// @Operation(summary = "마이페이지") + @Operation(summary = "마이페이지") @GetMapping("/{userId}") public ApiResponse mypage(@PathVariable Long userId){ return ApiResponse.SuccessResponse(SuccessStatus.MYPAGE_GET, ""); } -// @Operation(summary = "내 정보 조회") + @Operation(summary = "내 정보 조회") @GetMapping("/{userId}/details") public ApiResponse details(@PathVariable Long userId){ //MypageDetailDto return ApiResponse.SuccessResponse(SuccessStatus.DETAILS_GET, ""); } -// @Operation(summary = "약관 및 정책") + @Operation(summary = "약관 및 정책") @GetMapping("/tos") public ApiResponse tos(){ return ApiResponse.SuccessResponse(SuccessStatus.TOS_GET, ""); } -// @Operation(summary = "문의하기") + @Operation(summary = "문의하기") @PostMapping("/contact") public ApiResponse contact(){ return ApiResponse.SuccessResponse(SuccessStatus.CONTACT_CREATE, ""); diff --git a/src/main/java/umc/meme/shop/domain/reservation/controller/ReservationController.java b/src/main/java/umc/meme/shop/domain/reservation/controller/ReservationController.java index 36b3feb..497e1dc 100644 --- a/src/main/java/umc/meme/shop/domain/reservation/controller/ReservationController.java +++ b/src/main/java/umc/meme/shop/domain/reservation/controller/ReservationController.java @@ -1,5 +1,6 @@ package umc.meme.shop.domain.reservation.controller; +import io.swagger.v3.oas.annotations.Operation; import lombok.RequiredArgsConstructor; import org.springframework.web.bind.annotation.*; import umc.meme.shop.domain.reservation.dto.request.AlterReservationDto; @@ -12,13 +13,13 @@ @RequestMapping("/api/v1/reservation") public class ReservationController { - // @Operation(summary = "예약 상태 변경") + @Operation(summary = "예약 상태 변경") @PatchMapping("/alteration") public ApiResponse alteration(@RequestBody AlterReservationDto alterReservationDto){ return ApiResponse.SuccessResponse(SuccessStatus.RESERVATION_UPDATE); } - // @Operation(summary = "예약하기") + @Operation(summary = "예약하기") @PostMapping("/") public ApiResponse reservation(@RequestBody ReservationDto reservationDto){ return ApiResponse.SuccessResponse(SuccessStatus.RESERVATION_CREATE); From 61407ba35dcacbdbfd9b23aca36029a29e1577db Mon Sep 17 00:00:00 2001 From: daeun084 <030804jk@naver.com> Date: Tue, 23 Jan 2024 01:18:52 +0900 Subject: [PATCH 22/36] feat: model profile patch --- .../artist/controller/ArtistController.java | 4 ++-- .../model/controller/ModelController.java | 11 ++++++---- ...ModelTypeDto.java => ModelProfileDto.java} | 2 +- .../meme/shop/domain/model/entity/Model.java | 20 ++++++++++++++++++- .../domain/model/service/ModelService.java | 13 ++++++++++++ .../umc/meme/shop/global/ErrorStatus.java | 5 ++++- 6 files changed, 46 insertions(+), 9 deletions(-) rename src/main/java/umc/meme/shop/domain/model/dto/request/{ModelTypeDto.java => ModelProfileDto.java} (93%) diff --git a/src/main/java/umc/meme/shop/domain/artist/controller/ArtistController.java b/src/main/java/umc/meme/shop/domain/artist/controller/ArtistController.java index 902a9e3..aed1a70 100644 --- a/src/main/java/umc/meme/shop/domain/artist/controller/ArtistController.java +++ b/src/main/java/umc/meme/shop/domain/artist/controller/ArtistController.java @@ -34,8 +34,8 @@ public ApiResponse tempException(){ // return ApiResponse.SuccessResponse(SuccessStatus.TEMP); } - // @Operation(summary = "프로필 관리") - @PatchMapping("/mypage/{userId}/profile") + // @Operation(summary = "아티스트 프로필 관리") + @PatchMapping("/mypage/{userId}/profile/artist") public ApiResponse updateProfile(@PathVariable Long userId, @RequestBody ArtistProfileDto profileDto){ return ApiResponse.SuccessResponse(SuccessStatus.PROFILE_UPDATE); } diff --git a/src/main/java/umc/meme/shop/domain/model/controller/ModelController.java b/src/main/java/umc/meme/shop/domain/model/controller/ModelController.java index 5974931..045f8fd 100644 --- a/src/main/java/umc/meme/shop/domain/model/controller/ModelController.java +++ b/src/main/java/umc/meme/shop/domain/model/controller/ModelController.java @@ -2,7 +2,8 @@ import lombok.RequiredArgsConstructor; import org.springframework.web.bind.annotation.*; -import umc.meme.shop.domain.model.dto.request.ModelTypeDto; +import org.springframework.web.multipart.MultipartFile; +import umc.meme.shop.domain.model.dto.request.ModelProfileDto; import umc.meme.shop.domain.model.service.ModelService; import umc.meme.shop.domain.review.dto.request.ReviewDto; import umc.meme.shop.global.SuccessStatus; @@ -14,9 +15,11 @@ public class ModelController { private final ModelService modelService; - // @Operation(summary = "상세 정보 수정") - @PatchMapping("/mypage/{userId}/type") - public ApiResponse type(@PathVariable Long userId, @RequestBody ModelTypeDto modelTypeDto){ + // @Operation(summary = "모델 프로필 관리") + @PatchMapping("/mypage/{userId}/profile/model") + public ApiResponse profile (@PathVariable Long userId, + @RequestBody ModelProfileDto modelProfileDto){ + modelService.updateModel(userId, modelProfileDto); return ApiResponse.SuccessResponse(SuccessStatus.TYPE_UPDATE); } diff --git a/src/main/java/umc/meme/shop/domain/model/dto/request/ModelTypeDto.java b/src/main/java/umc/meme/shop/domain/model/dto/request/ModelProfileDto.java similarity index 93% rename from src/main/java/umc/meme/shop/domain/model/dto/request/ModelTypeDto.java rename to src/main/java/umc/meme/shop/domain/model/dto/request/ModelProfileDto.java index 64710e6..037a5bb 100644 --- a/src/main/java/umc/meme/shop/domain/model/dto/request/ModelTypeDto.java +++ b/src/main/java/umc/meme/shop/domain/model/dto/request/ModelProfileDto.java @@ -6,7 +6,7 @@ import umc.meme.shop.domain.model.entity.enums.SkinType; @Data -public class ModelTypeDto { +public class ModelProfileDto { private String profileImg; private String nickname; private Gender gender; diff --git a/src/main/java/umc/meme/shop/domain/model/entity/Model.java b/src/main/java/umc/meme/shop/domain/model/entity/Model.java index 89643a4..ae2f874 100644 --- a/src/main/java/umc/meme/shop/domain/model/entity/Model.java +++ b/src/main/java/umc/meme/shop/domain/model/entity/Model.java @@ -7,9 +7,9 @@ import umc.meme.shop.domain.artist.entity.enums.Gender; import umc.meme.shop.domain.favorite.entity.FavoriteArtist; import umc.meme.shop.domain.favorite.entity.FavoritePortfolio; +import umc.meme.shop.domain.model.dto.request.ModelProfileDto; import umc.meme.shop.domain.model.entity.enums.PersonalColor; import umc.meme.shop.domain.model.entity.enums.SkinType; -import umc.meme.shop.domain.portfolio.entity.Portfolio; import umc.meme.shop.domain.reservation.entity.Reservation; import java.util.Date; @@ -62,4 +62,22 @@ public class Model { @OneToMany(cascade = CascadeType.ALL, mappedBy = "model") private List reservationList; + + public void updateModel(ModelProfileDto request) { + if(request.getProfileImg() != null){ + this.profileImg = request.getProfileImg(); + } + if(request.getNickname() != null){ + this.nickname = request.getNickname(); + } + if(request.getGender() != null){ + this.gender = request.getGender(); + } + if(request.getSkinType() != null){ + this.skinType = request.getSkinType(); + } + if(request.getPersonalColor() != null){ + this.personalColor = request.getPersonalColor(); + } + } } diff --git a/src/main/java/umc/meme/shop/domain/model/service/ModelService.java b/src/main/java/umc/meme/shop/domain/model/service/ModelService.java index 39d50a9..2ef4f08 100644 --- a/src/main/java/umc/meme/shop/domain/model/service/ModelService.java +++ b/src/main/java/umc/meme/shop/domain/model/service/ModelService.java @@ -1,11 +1,24 @@ package umc.meme.shop.domain.model.service; +import jakarta.transaction.Transactional; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; +import umc.meme.shop.domain.model.dto.request.ModelProfileDto; +import umc.meme.shop.domain.model.entity.Model; import umc.meme.shop.domain.model.repository.ModelRepository; +import umc.meme.shop.global.ErrorStatus; +import umc.meme.shop.global.exception.GlobalException; @Service @RequiredArgsConstructor public class ModelService { private final ModelRepository modelRepository; + + //모델 프로필 관리 + @Transactional + public void updateModel(Long userId, ModelProfileDto request){ + Model model = modelRepository.findById(userId) + .orElseThrow(() -> new GlobalException(ErrorStatus.MODEL_NOT_FOUND)); + model.updateModel(request); + } } diff --git a/src/main/java/umc/meme/shop/global/ErrorStatus.java b/src/main/java/umc/meme/shop/global/ErrorStatus.java index 66804b4..2b6726b 100644 --- a/src/main/java/umc/meme/shop/global/ErrorStatus.java +++ b/src/main/java/umc/meme/shop/global/ErrorStatus.java @@ -6,7 +6,10 @@ @Getter @AllArgsConstructor public enum ErrorStatus { - TEMP(500, "TEMP"); + TEMP(500, "TEMP"), + + /**model**/ + MODEL_NOT_FOUND(500, "모델을 찾을 수 없습니다"); private final int code; private final String message; From 9dc32273903e340a60c1665068b619496cd98519 Mon Sep 17 00:00:00 2001 From: yeopyeop-82 Date: Tue, 23 Jan 2024 01:54:24 +0900 Subject: [PATCH 23/36] =?UTF-8?q?add=20:=20ErrorStatus=20=EC=9E=91?= =?UTF-8?q?=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/ReservationController.java | 15 ++++++++++- .../umc/meme/shop/global/ErrorStatus.java | 27 ++++++++++++++++++- 2 files changed, 40 insertions(+), 2 deletions(-) diff --git a/src/main/java/umc/meme/shop/domain/reservation/controller/ReservationController.java b/src/main/java/umc/meme/shop/domain/reservation/controller/ReservationController.java index 497e1dc..6e2913b 100644 --- a/src/main/java/umc/meme/shop/domain/reservation/controller/ReservationController.java +++ b/src/main/java/umc/meme/shop/domain/reservation/controller/ReservationController.java @@ -1,6 +1,11 @@ package umc.meme.shop.domain.reservation.controller; import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.Parameters; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponses; import lombok.RequiredArgsConstructor; import org.springframework.web.bind.annotation.*; import umc.meme.shop.domain.reservation.dto.request.AlterReservationDto; @@ -13,7 +18,15 @@ @RequestMapping("/api/v1/reservation") public class ReservationController { - @Operation(summary = "예약 상태 변경") + + @Operation(summary = "예약 상태 변경", description = "예약 상태를 변경하는 API입니다.") + @ApiResponses({ + @io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "200", description = "예약 상태 변경 성공"), + @io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "400", description = "access 토큰을 주세요!",content = @Content(schema = @Schema(implementation = ApiResponse.class))), + }) + @Parameters({ + @Parameter(name = "status", description = "Status enum 에 있는 값") + }) @PatchMapping("/alteration") public ApiResponse alteration(@RequestBody AlterReservationDto alterReservationDto){ return ApiResponse.SuccessResponse(SuccessStatus.RESERVATION_UPDATE); diff --git a/src/main/java/umc/meme/shop/global/ErrorStatus.java b/src/main/java/umc/meme/shop/global/ErrorStatus.java index 66804b4..c61b4d4 100644 --- a/src/main/java/umc/meme/shop/global/ErrorStatus.java +++ b/src/main/java/umc/meme/shop/global/ErrorStatus.java @@ -6,7 +6,32 @@ @Getter @AllArgsConstructor public enum ErrorStatus { - TEMP(500, "TEMP"); + + /** + * Error Code + * 400 : 잘못된 요청 + * 401 : JWT에 대한 오류 + * 403 : 요청한 정보에 대한 권한 없음. + * 404 : 존재하지 않는 정보에 대한 요청. + */ + + /** + * TEMP + */ + TEMP(400, "TEMP"), + + /** + * Code : 400 + * Bad Request + */ + INVALID_REQUEST(400, "유효하지 않은 요청입니다."), + + /** + * Code : 404 + * Not Found + */ + NOT_EXIST_USER(404, "존재하지 않는 유저입니다."), + PAGE_NOT_FOUND(404,"페이지를 찾을 수 없습니다"); private final int code; private final String message; From 6c304721f17acaab6417f822ea7ba9862246f807 Mon Sep 17 00:00:00 2001 From: yeopyeop-82 Date: Tue, 23 Jan 2024 12:39:33 +0900 Subject: [PATCH 24/36] add : SwaggerConfig, Swagger description --- .../umc/meme/shop/config/SwaggerConfig.java | 40 +++++++++++++++++++ .../artist/controller/ArtistController.java | 12 +++--- .../model/controller/ModelController.java | 18 ++++----- .../mypage/controller/MyPageController.java | 8 ++-- .../controller/ReservationController.java | 8 +--- 5 files changed, 61 insertions(+), 25 deletions(-) create mode 100644 src/main/java/umc/meme/shop/config/SwaggerConfig.java diff --git a/src/main/java/umc/meme/shop/config/SwaggerConfig.java b/src/main/java/umc/meme/shop/config/SwaggerConfig.java new file mode 100644 index 0000000..d95cbf1 --- /dev/null +++ b/src/main/java/umc/meme/shop/config/SwaggerConfig.java @@ -0,0 +1,40 @@ +package umc.meme.shop.config; + +import io.swagger.v3.oas.models.Components; +import io.swagger.v3.oas.models.OpenAPI; +import io.swagger.v3.oas.models.info.Info; +import io.swagger.v3.oas.models.security.SecurityRequirement; +import io.swagger.v3.oas.models.security.SecurityScheme; +import io.swagger.v3.oas.models.servers.Server; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +@Configuration +public class SwaggerConfig { + // http://localhost:8080/swagger-ui/index.html#/ + @Bean + public OpenAPI MemeAPI() { + Info info = new Info() + .title("MEME_SERVICE API Docs") + .description("MEME_SERVICE API 명세서입니다.") + .version("1.0.0"); + + String jwtSchemeName = "accessToken"; + // API 요청헤더에 인증정보 포함 + SecurityRequirement securityRequirement = new SecurityRequirement().addList(jwtSchemeName); + + // SecuritySchemes 등록 + Components components = new Components() + .addSecuritySchemes(jwtSchemeName, new SecurityScheme() + .name(jwtSchemeName) + .type(SecurityScheme.Type.HTTP) // HTTP 방식 + .scheme("bearer") + .bearerFormat("JWT")); + + return new OpenAPI() + .addServersItem(new Server().url("/")) + .info(info) + .addSecurityItem(securityRequirement) + .components(components); + } +} \ No newline at end of file diff --git a/src/main/java/umc/meme/shop/domain/artist/controller/ArtistController.java b/src/main/java/umc/meme/shop/domain/artist/controller/ArtistController.java index 97f0635..83f488d 100644 --- a/src/main/java/umc/meme/shop/domain/artist/controller/ArtistController.java +++ b/src/main/java/umc/meme/shop/domain/artist/controller/ArtistController.java @@ -35,39 +35,39 @@ public ApiResponse tempException(){ // return ApiResponse.SuccessResponse(SuccessStatus.TEMP); } - @Operation(summary = "프로필 관리") + @Operation(summary = "프로필 관리", description = "프로필 정보를 업데이트하는 API입니다.") @PatchMapping("/mypage/{userId}/profile") public ApiResponse updateProfile(@PathVariable Long userId, @RequestBody ArtistProfileDto profileDto){ return ApiResponse.SuccessResponse(SuccessStatus.PROFILE_UPDATE); } - @Operation(summary = "포트폴리오 조회") + @Operation(summary = "포트폴리오 조회", description = "포트폴리오를 조회하는 API입니다.") @GetMapping("/mypage/{userId}/portfolio") public ApiResponse getPortfolio(@PathVariable Long userId){ return ApiResponse.SuccessResponse(SuccessStatus.PORTFOLIO_GET, ""); } - @Operation(summary = "포트폴리오 생성") + @Operation(summary = "포트폴리오 생성", description = "포트폴리오를 생성하는 API입니다.") @PostMapping("/mypage/{userId}/portfolio") public ApiResponse createPortfolio(@PathVariable Long userId, @RequestBody CreatePortfolioDto portfolioDto){ // TODO: PortfolioImg 추가 return ApiResponse.SuccessResponse(SuccessStatus.PORTFOLIO_CREATE); } - @Operation(summary = "포트폴리오 수정/삭제") + @Operation(summary = "포트폴리오 수정/삭제", description = "포트폴리오를 조회하는 API입니다.") @PatchMapping("/mypage/{userId}/portfolio") public ApiResponse updatePortfolio(@PathVariable Long userId, @RequestBody UpdatePortfolioDto portfolioDto){ // TODO: PortfolioImg 추가 return ApiResponse.SuccessResponse(SuccessStatus.PORTFOLIO_UPDATE); } - @Operation(summary = "예약 조회") + @Operation(summary = "예약 조회", description = "예약 정보를 조회하는 API입니다.") @GetMapping("/mypage/{userId}/reservation") public ApiResponse getReservation(@PathVariable Long userId){ return ApiResponse.SuccessResponse(SuccessStatus.RESERVATION_GET, ""); } - @Operation(summary = "리뷰 관리") + @Operation(summary = "리뷰 관리", description = "block 상태를 통해 리뷰 공개 유무를 결정할 수 있는 API입니다.") @PatchMapping("/artist/review") public ApiResponse updateReview(@RequestBody UpdateReviewDto reviewDto){ return ApiResponse.SuccessResponse(SuccessStatus.REVIEW_UPDATE); diff --git a/src/main/java/umc/meme/shop/domain/model/controller/ModelController.java b/src/main/java/umc/meme/shop/domain/model/controller/ModelController.java index a18d5d7..1ee7e78 100644 --- a/src/main/java/umc/meme/shop/domain/model/controller/ModelController.java +++ b/src/main/java/umc/meme/shop/domain/model/controller/ModelController.java @@ -15,7 +15,7 @@ public class ModelController { private final ModelService modelService; - @Operation(summary = "상세 정보 수정") + @Operation(summary = "상세 정보 수정", description = "모델의 피부 type을 수정하는 API입니다.") @PatchMapping("/mypage/{userId}/type") public ApiResponse type(@PathVariable Long userId, @RequestBody ModelTypeDto modelTypeDto){ return ApiResponse.SuccessResponse(SuccessStatus.TYPE_UPDATE); @@ -23,13 +23,13 @@ public ApiResponse type(@PathVariable Long userId, @RequestBody ModelTypeDto mod /**favorite**/ - @Operation(summary = "관심 아티스트 조회") + @Operation(summary = "관심 아티스트 조회", description = "관심 아티스트를 조회하는 API입니다.") @GetMapping("/mypage/{userId}/favorite/artist") public ApiResponse favoriteArtist(@PathVariable Long userId){ return ApiResponse.SuccessResponse(SuccessStatus.FAVORITE_ARTIST_GET, ""); } - @Operation(summary = "관심 메이크업 조회") + @Operation(summary = "관심 메이크업 조회", description = "관심 메이크업을 조회하는 API입니다.") @GetMapping("/mypage/{userId}/favorite/portfolio") public ApiResponse favoritePortfolio(@PathVariable Long userId){ return ApiResponse.SuccessResponse(SuccessStatus.FAVORITE_PORTFOLIO_GET, ""); @@ -37,13 +37,13 @@ public ApiResponse favoritePortfolio(@PathVariable Long userId){ /**review**/ - @Operation(summary = "내가 쓴 리뷰 조회") + @Operation(summary = "내가 쓴 리뷰 조회", description = "본인이 쓴 리뷰를 조회하는 API입니다.") @GetMapping("/mypage/{userId}/review") public ApiResponse getReview(@PathVariable Long userId){ return ApiResponse.SuccessResponse(SuccessStatus.REVIEW_GET, ""); } - @Operation(summary = "리뷰 작성") + @Operation(summary = "리뷰 작성", description = "리뷰를 작성하는 API입니다.") @PostMapping("/model/review") public ApiResponse postReview(@RequestBody ReviewDto reviewDto){ //TODO: ReviewImg 추가 @@ -52,25 +52,25 @@ public ApiResponse postReview(@RequestBody ReviewDto reviewDto){ /**search**/ - @Operation(summary = "메이크업 검색") + @Operation(summary = "메이크업 검색", description = "메이크업을 검색하는 API입니다.") @GetMapping("/search") public ApiResponse search(){ return ApiResponse.SuccessResponse(SuccessStatus.SEARCH_GET, ""); } - @Operation(summary = "메이크업 검색 - 관심 아티스트") + @Operation(summary = "메이크업 검색 - 관심 아티스트", description = "관심 아티스트로 검색하는 API입니다.") @GetMapping("/search/artist") public ApiResponse searchArtist(){ return ApiResponse.SuccessResponse(SuccessStatus.SEARCH_GET, ""); } - @Operation(summary = "메이크업 검색 - 최근 검색어") + @Operation(summary = "메이크업 검색 - 최근 검색어", description = "최근 검색어 안에서 검색하는 API입니다.") @GetMapping("/search/recent") public ApiResponse searchRecent(){ return ApiResponse.SuccessResponse(SuccessStatus.SEARCH_GET, ""); } - @Operation(summary = "메이크업 검색 - 카테고리") + @Operation(summary = "메이크업 검색 - 카테고리", description = "메이크업 카테고리로 검색하는 API입니다.") @GetMapping("/search/category") public ApiResponse searchCategory(){ return ApiResponse.SuccessResponse(SuccessStatus.SEARCH_GET, ""); diff --git a/src/main/java/umc/meme/shop/domain/mypage/controller/MyPageController.java b/src/main/java/umc/meme/shop/domain/mypage/controller/MyPageController.java index 069075c..b1756b4 100644 --- a/src/main/java/umc/meme/shop/domain/mypage/controller/MyPageController.java +++ b/src/main/java/umc/meme/shop/domain/mypage/controller/MyPageController.java @@ -11,26 +11,26 @@ @RequestMapping("/api/v1/mypage") public class MyPageController { - @Operation(summary = "마이페이지") + @Operation(summary = "마이페이지", description = "마이페이지를 조회하는 API입니다.") @GetMapping("/{userId}") public ApiResponse mypage(@PathVariable Long userId){ return ApiResponse.SuccessResponse(SuccessStatus.MYPAGE_GET, ""); } - @Operation(summary = "내 정보 조회") + @Operation(summary = "내 정보 조회", description = "본인 정보를 조회하는 API입니다.") @GetMapping("/{userId}/details") public ApiResponse details(@PathVariable Long userId){ //MypageDetailDto return ApiResponse.SuccessResponse(SuccessStatus.DETAILS_GET, ""); } - @Operation(summary = "약관 및 정책") + @Operation(summary = "약관 및 정책", description = "약관 및 정책을 조회하는 API입니다.") @GetMapping("/tos") public ApiResponse tos(){ return ApiResponse.SuccessResponse(SuccessStatus.TOS_GET, ""); } - @Operation(summary = "문의하기") + @Operation(summary = "문의하기", description = "문의하기 API입니다.") @PostMapping("/contact") public ApiResponse contact(){ return ApiResponse.SuccessResponse(SuccessStatus.CONTACT_CREATE, ""); diff --git a/src/main/java/umc/meme/shop/domain/reservation/controller/ReservationController.java b/src/main/java/umc/meme/shop/domain/reservation/controller/ReservationController.java index 6e2913b..2a50e8e 100644 --- a/src/main/java/umc/meme/shop/domain/reservation/controller/ReservationController.java +++ b/src/main/java/umc/meme/shop/domain/reservation/controller/ReservationController.java @@ -20,19 +20,15 @@ public class ReservationController { @Operation(summary = "예약 상태 변경", description = "예약 상태를 변경하는 API입니다.") - @ApiResponses({ - @io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "200", description = "예약 상태 변경 성공"), - @io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "400", description = "access 토큰을 주세요!",content = @Content(schema = @Schema(implementation = ApiResponse.class))), - }) @Parameters({ - @Parameter(name = "status", description = "Status enum 에 있는 값") + @Parameter(name = "status", description = "Status enum 에 있는 값 (EXPECTED, COMPLETE, CANCEL)") }) @PatchMapping("/alteration") public ApiResponse alteration(@RequestBody AlterReservationDto alterReservationDto){ return ApiResponse.SuccessResponse(SuccessStatus.RESERVATION_UPDATE); } - @Operation(summary = "예약하기") + @Operation(summary = "예약하기", description = "예약하기 기능을 수행하는 API입니다.") @PostMapping("/") public ApiResponse reservation(@RequestBody ReservationDto reservationDto){ return ApiResponse.SuccessResponse(SuccessStatus.RESERVATION_CREATE); From 1dcbf16eb27a5d11229f72f7a83b27dccb8bc33d Mon Sep 17 00:00:00 2001 From: daeun084 <030804jk@naver.com> Date: Tue, 23 Jan 2024 12:58:49 +0900 Subject: [PATCH 25/36] add: artist, portfolio responseDto --- .../domain/artist/dto/response/ArtistDto.java | 61 +++++++++++++++++++ .../portfolio/dto/response/PortfolioDto.java | 34 +++++++++++ 2 files changed, 95 insertions(+) create mode 100644 src/main/java/umc/meme/shop/domain/artist/dto/response/ArtistDto.java create mode 100644 src/main/java/umc/meme/shop/domain/portfolio/dto/response/PortfolioDto.java diff --git a/src/main/java/umc/meme/shop/domain/artist/dto/response/ArtistDto.java b/src/main/java/umc/meme/shop/domain/artist/dto/response/ArtistDto.java new file mode 100644 index 0000000..901be4e --- /dev/null +++ b/src/main/java/umc/meme/shop/domain/artist/dto/response/ArtistDto.java @@ -0,0 +1,61 @@ +package umc.meme.shop.domain.artist.dto.response; + +import jakarta.persistence.*; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Getter; +import lombok.NoArgsConstructor; +import umc.meme.shop.domain.artist.entity.Artist; +import umc.meme.shop.domain.artist.entity.enums.*; +import umc.meme.shop.domain.portfolio.dto.response.PortfolioDto; +import umc.meme.shop.domain.portfolio.entity.enums.Category; + +import java.util.List; +import java.util.stream.Collectors; + +@Getter +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class ArtistDto { + private Long artistId; + + private Gender gender; + + private String nickname; + + private String profileImg; + + private String introduction; + + private WorkExperience workExperience; + + private List region; + + private List specialization; + + private MakeupLocation makeupLocation; + + private List portfolioDtoList; + + public static ArtistDto from(Artist artist){ + List portfolioDtoList = artist.getPortfolioList() + .stream() + .map(PortfolioDto::from) + .toList(); + + return ArtistDto.builder() + .gender(artist.getGender()) + .nickname(artist.getNickname()) + .profileImg(artist.getProfileImg()) + .introduction(artist.getIntroduction()) + .workExperience(artist.getWorkExperience()) + .region(artist.getRegion()) + .specialization(artist.getSpecialization()) + .makeupLocation(artist.getMakeupLocation()) + .portfolioDtoList(portfolioDtoList) + .build(); + } +} + + diff --git a/src/main/java/umc/meme/shop/domain/portfolio/dto/response/PortfolioDto.java b/src/main/java/umc/meme/shop/domain/portfolio/dto/response/PortfolioDto.java new file mode 100644 index 0000000..e22a06e --- /dev/null +++ b/src/main/java/umc/meme/shop/domain/portfolio/dto/response/PortfolioDto.java @@ -0,0 +1,34 @@ +package umc.meme.shop.domain.portfolio.dto.response; + +import jakarta.persistence.*; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Getter; +import lombok.NoArgsConstructor; +import umc.meme.shop.domain.portfolio.entity.Portfolio; +import umc.meme.shop.domain.portfolio.entity.enums.Category; + +@Getter +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class PortfolioDto { + private Long portfolioId; + + private Category category; + + private String makeupName; + + private int price; + + private String info; + + public static PortfolioDto from(Portfolio portfolio){ + return PortfolioDto.builder() + .category(portfolio.getCategory()) + .makeupName(portfolio.getMakeupName()) + .price(portfolio.getPrice()) + .info(portfolio.getInfo()) + .build(); + } +} From a92e2c78bde19f313e0681da99f68994e72cfd8c Mon Sep 17 00:00:00 2001 From: daeun084 <030804jk@naver.com> Date: Tue, 23 Jan 2024 13:05:19 +0900 Subject: [PATCH 26/36] =?UTF-8?q?feat:=20=EA=B4=80=EC=8B=AC=20=EC=95=84?= =?UTF-8?q?=ED=8B=B0=EC=8A=A4=ED=8A=B8=20=EC=A1=B0=ED=9A=8C=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 --- .../domain/artist/dto/response/ArtistDto.java | 23 +++++++++++++++++++ .../repository/FavoriteArtistRepository.java | 4 ++++ .../model/controller/ModelController.java | 2 +- .../domain/model/service/ModelService.java | 19 +++++++++++++++ 4 files changed, 47 insertions(+), 1 deletion(-) diff --git a/src/main/java/umc/meme/shop/domain/artist/dto/response/ArtistDto.java b/src/main/java/umc/meme/shop/domain/artist/dto/response/ArtistDto.java index 901be4e..70789d4 100644 --- a/src/main/java/umc/meme/shop/domain/artist/dto/response/ArtistDto.java +++ b/src/main/java/umc/meme/shop/domain/artist/dto/response/ArtistDto.java @@ -7,6 +7,7 @@ import lombok.NoArgsConstructor; import umc.meme.shop.domain.artist.entity.Artist; import umc.meme.shop.domain.artist.entity.enums.*; +import umc.meme.shop.domain.favorite.entity.FavoriteArtist; import umc.meme.shop.domain.portfolio.dto.response.PortfolioDto; import umc.meme.shop.domain.portfolio.entity.enums.Category; @@ -56,6 +57,28 @@ public static ArtistDto from(Artist artist){ .portfolioDtoList(portfolioDtoList) .build(); } + + //관심 아티스트 + public static ArtistDto from(FavoriteArtist favoriteArtist){ + Artist artist = favoriteArtist.getArtist(); + List portfolioDtoList = artist.getPortfolioList() + .stream() + .map(PortfolioDto::from) + .toList(); + + return ArtistDto.builder() + .gender(artist.getGender()) + .nickname(artist.getNickname()) + .profileImg(artist.getProfileImg()) + .introduction(artist.getIntroduction()) + .workExperience(artist.getWorkExperience()) + .region(artist.getRegion()) + .specialization(artist.getSpecialization()) + .makeupLocation(artist.getMakeupLocation()) + .portfolioDtoList(portfolioDtoList) + .build(); + } + } diff --git a/src/main/java/umc/meme/shop/domain/favorite/repository/FavoriteArtistRepository.java b/src/main/java/umc/meme/shop/domain/favorite/repository/FavoriteArtistRepository.java index 0ae6511..9a451e4 100644 --- a/src/main/java/umc/meme/shop/domain/favorite/repository/FavoriteArtistRepository.java +++ b/src/main/java/umc/meme/shop/domain/favorite/repository/FavoriteArtistRepository.java @@ -2,6 +2,10 @@ import org.springframework.data.jpa.repository.JpaRepository; import umc.meme.shop.domain.favorite.entity.FavoriteArtist; +import umc.meme.shop.domain.model.entity.Model; + +import java.util.List; public interface FavoriteArtistRepository extends JpaRepository { + List findByModel(Model model); } diff --git a/src/main/java/umc/meme/shop/domain/model/controller/ModelController.java b/src/main/java/umc/meme/shop/domain/model/controller/ModelController.java index 045f8fd..d4efda9 100644 --- a/src/main/java/umc/meme/shop/domain/model/controller/ModelController.java +++ b/src/main/java/umc/meme/shop/domain/model/controller/ModelController.java @@ -28,7 +28,7 @@ public ApiResponse profile (@PathVariable Long userId, // @Operation(summary = "관심 아티스트 조회") @GetMapping("/mypage/{userId}/favorite/artist") public ApiResponse favoriteArtist(@PathVariable Long userId){ - return ApiResponse.SuccessResponse(SuccessStatus.FAVORITE_ARTIST_GET, ""); + return ApiResponse.SuccessResponse(SuccessStatus.FAVORITE_ARTIST_GET, modelService.getFavoriteArtist(userId)); } // @Operation(summary = "관심 메이크업 조회") diff --git a/src/main/java/umc/meme/shop/domain/model/service/ModelService.java b/src/main/java/umc/meme/shop/domain/model/service/ModelService.java index 2ef4f08..6f3667d 100644 --- a/src/main/java/umc/meme/shop/domain/model/service/ModelService.java +++ b/src/main/java/umc/meme/shop/domain/model/service/ModelService.java @@ -3,16 +3,23 @@ import jakarta.transaction.Transactional; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; +import umc.meme.shop.domain.artist.dto.response.ArtistDto; +import umc.meme.shop.domain.favorite.entity.FavoriteArtist; +import umc.meme.shop.domain.favorite.repository.FavoriteArtistRepository; import umc.meme.shop.domain.model.dto.request.ModelProfileDto; import umc.meme.shop.domain.model.entity.Model; import umc.meme.shop.domain.model.repository.ModelRepository; import umc.meme.shop.global.ErrorStatus; import umc.meme.shop.global.exception.GlobalException; +import java.util.List; +import java.util.stream.Collectors; + @Service @RequiredArgsConstructor public class ModelService { private final ModelRepository modelRepository; + private final FavoriteArtistRepository favoriteArtistRepository; //모델 프로필 관리 @Transactional @@ -21,4 +28,16 @@ public void updateModel(Long userId, ModelProfileDto request){ .orElseThrow(() -> new GlobalException(ErrorStatus.MODEL_NOT_FOUND)); model.updateModel(request); } + + //관심 아티스트 조회 + @Transactional + public List getFavoriteArtist(Long userId){ + Model model = modelRepository.findById(userId) + .orElseThrow(() -> new GlobalException(ErrorStatus.MODEL_NOT_FOUND)); + List favoriteArtistList = favoriteArtistRepository.findByModel(model); + return favoriteArtistList.stream() + .map(ArtistDto::from) + .collect(Collectors.toList()); + } + } From 4b925c02691ea886ef6f310cf6e1d02f7abcf648 Mon Sep 17 00:00:00 2001 From: daeun084 <030804jk@naver.com> Date: Tue, 23 Jan 2024 13:11:51 +0900 Subject: [PATCH 27/36] =?UTF-8?q?feat:=20=EA=B4=80=EC=8B=AC=20=ED=8F=AC?= =?UTF-8?q?=ED=8A=B8=ED=8F=B4=EB=A6=AC=EC=98=A4=20=EC=A1=B0=ED=9A=8C=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 --- .../repository/FavoritePortfolioRepository.java | 4 ++++ .../domain/model/controller/ModelController.java | 2 +- .../shop/domain/model/service/ModelService.java | 16 ++++++++++++++++ .../portfolio/dto/response/PortfolioDto.java | 12 ++++++++++++ 4 files changed, 33 insertions(+), 1 deletion(-) diff --git a/src/main/java/umc/meme/shop/domain/favorite/repository/FavoritePortfolioRepository.java b/src/main/java/umc/meme/shop/domain/favorite/repository/FavoritePortfolioRepository.java index 8533af3..80ea99d 100644 --- a/src/main/java/umc/meme/shop/domain/favorite/repository/FavoritePortfolioRepository.java +++ b/src/main/java/umc/meme/shop/domain/favorite/repository/FavoritePortfolioRepository.java @@ -2,6 +2,10 @@ import org.springframework.data.jpa.repository.JpaRepository; import umc.meme.shop.domain.favorite.entity.FavoritePortfolio; +import umc.meme.shop.domain.model.entity.Model; + +import java.util.List; public interface FavoritePortfolioRepository extends JpaRepository { + List findByModel(Model model); } diff --git a/src/main/java/umc/meme/shop/domain/model/controller/ModelController.java b/src/main/java/umc/meme/shop/domain/model/controller/ModelController.java index d4efda9..197c93f 100644 --- a/src/main/java/umc/meme/shop/domain/model/controller/ModelController.java +++ b/src/main/java/umc/meme/shop/domain/model/controller/ModelController.java @@ -34,7 +34,7 @@ public ApiResponse favoriteArtist(@PathVariable Long userId){ // @Operation(summary = "관심 메이크업 조회") @GetMapping("/mypage/{userId}/favorite/portfolio") public ApiResponse favoritePortfolio(@PathVariable Long userId){ - return ApiResponse.SuccessResponse(SuccessStatus.FAVORITE_PORTFOLIO_GET, ""); + return ApiResponse.SuccessResponse(SuccessStatus.FAVORITE_PORTFOLIO_GET, modelService.getFavoritePortfolio(userId)); } /**review**/ diff --git a/src/main/java/umc/meme/shop/domain/model/service/ModelService.java b/src/main/java/umc/meme/shop/domain/model/service/ModelService.java index 6f3667d..012289d 100644 --- a/src/main/java/umc/meme/shop/domain/model/service/ModelService.java +++ b/src/main/java/umc/meme/shop/domain/model/service/ModelService.java @@ -5,10 +5,14 @@ import org.springframework.stereotype.Service; import umc.meme.shop.domain.artist.dto.response.ArtistDto; import umc.meme.shop.domain.favorite.entity.FavoriteArtist; +import umc.meme.shop.domain.favorite.entity.FavoritePortfolio; import umc.meme.shop.domain.favorite.repository.FavoriteArtistRepository; +import umc.meme.shop.domain.favorite.repository.FavoritePortfolioRepository; import umc.meme.shop.domain.model.dto.request.ModelProfileDto; import umc.meme.shop.domain.model.entity.Model; import umc.meme.shop.domain.model.repository.ModelRepository; +import umc.meme.shop.domain.portfolio.dto.response.PortfolioDto; +import umc.meme.shop.domain.portfolio.entity.Portfolio; import umc.meme.shop.global.ErrorStatus; import umc.meme.shop.global.exception.GlobalException; @@ -20,6 +24,7 @@ public class ModelService { private final ModelRepository modelRepository; private final FavoriteArtistRepository favoriteArtistRepository; + private final FavoritePortfolioRepository favoritePortfolioRepository; //모델 프로필 관리 @Transactional @@ -40,4 +45,15 @@ public List getFavoriteArtist(Long userId){ .collect(Collectors.toList()); } + //관심 메이크업 조회 + @Transactional + public List getFavoritePortfolio(Long userId){ + Model model = modelRepository.findById(userId) + .orElseThrow(() -> new GlobalException(ErrorStatus.MODEL_NOT_FOUND)); + List favoritePortfolioList = favoritePortfolioRepository.findByModel(model); + return favoritePortfolioList.stream() + .map(PortfolioDto::from) + .collect(Collectors.toList()); + } + } diff --git a/src/main/java/umc/meme/shop/domain/portfolio/dto/response/PortfolioDto.java b/src/main/java/umc/meme/shop/domain/portfolio/dto/response/PortfolioDto.java index e22a06e..a773ca8 100644 --- a/src/main/java/umc/meme/shop/domain/portfolio/dto/response/PortfolioDto.java +++ b/src/main/java/umc/meme/shop/domain/portfolio/dto/response/PortfolioDto.java @@ -5,6 +5,7 @@ import lombok.Builder; import lombok.Getter; import lombok.NoArgsConstructor; +import umc.meme.shop.domain.favorite.entity.FavoritePortfolio; import umc.meme.shop.domain.portfolio.entity.Portfolio; import umc.meme.shop.domain.portfolio.entity.enums.Category; @@ -31,4 +32,15 @@ public static PortfolioDto from(Portfolio portfolio){ .info(portfolio.getInfo()) .build(); } + + //관심 메이크업 + public static PortfolioDto from(FavoritePortfolio favoritePortfolio){ + Portfolio portfolio = favoritePortfolio.getPortfolio(); + return PortfolioDto.builder() + .category(portfolio.getCategory()) + .makeupName(portfolio.getMakeupName()) + .price(portfolio.getPrice()) + .info(portfolio.getInfo()) + .build(); + } } From ae5e0a3e972bd675070e532d43f1c842ac17e181 Mon Sep 17 00:00:00 2001 From: daeun084 <030804jk@naver.com> Date: Tue, 23 Jan 2024 14:14:53 +0900 Subject: [PATCH 28/36] =?UTF-8?q?feat:=20=EC=98=88=EC=95=BD=ED=95=98?= =?UTF-8?q?=EA=B8=B0=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 --- .../model/controller/ModelController.java | 2 +- .../domain/model/service/ModelService.java | 6 +-- .../controller/ReservationController.java | 10 ++-- ...ionDto.java => ReservationRequestDto.java} | 2 +- .../reservation/entity/Reservation.java | 2 + .../service/ReservationService.java | 46 +++++++++++++++++++ .../umc/meme/shop/global/ErrorStatus.java | 1 + 7 files changed, 59 insertions(+), 10 deletions(-) rename src/main/java/umc/meme/shop/domain/reservation/dto/request/{ReservationDto.java => ReservationRequestDto.java} (94%) create mode 100644 src/main/java/umc/meme/shop/domain/reservation/service/ReservationService.java diff --git a/src/main/java/umc/meme/shop/domain/model/controller/ModelController.java b/src/main/java/umc/meme/shop/domain/model/controller/ModelController.java index 6b8dc85..dd47f6e 100644 --- a/src/main/java/umc/meme/shop/domain/model/controller/ModelController.java +++ b/src/main/java/umc/meme/shop/domain/model/controller/ModelController.java @@ -16,7 +16,7 @@ public class ModelController { private final ModelService modelService; - // @Operation(summary = "모델 프로필 관리") + @Operation(summary = "모델 프로필 관리") @PatchMapping("/mypage/{userId}/profile/model") public ApiResponse profile (@PathVariable Long userId, @RequestBody ModelProfileDto modelProfileDto){ diff --git a/src/main/java/umc/meme/shop/domain/model/service/ModelService.java b/src/main/java/umc/meme/shop/domain/model/service/ModelService.java index 012289d..77c7ec2 100644 --- a/src/main/java/umc/meme/shop/domain/model/service/ModelService.java +++ b/src/main/java/umc/meme/shop/domain/model/service/ModelService.java @@ -30,7 +30,7 @@ public class ModelService { @Transactional public void updateModel(Long userId, ModelProfileDto request){ Model model = modelRepository.findById(userId) - .orElseThrow(() -> new GlobalException(ErrorStatus.MODEL_NOT_FOUND)); + .orElseThrow(() -> new GlobalException(ErrorStatus.NOT_EXIST_USER)); model.updateModel(request); } @@ -38,7 +38,7 @@ public void updateModel(Long userId, ModelProfileDto request){ @Transactional public List getFavoriteArtist(Long userId){ Model model = modelRepository.findById(userId) - .orElseThrow(() -> new GlobalException(ErrorStatus.MODEL_NOT_FOUND)); + .orElseThrow(() -> new GlobalException(ErrorStatus.NOT_EXIST_USER)); List favoriteArtistList = favoriteArtistRepository.findByModel(model); return favoriteArtistList.stream() .map(ArtistDto::from) @@ -49,7 +49,7 @@ public List getFavoriteArtist(Long userId){ @Transactional public List getFavoritePortfolio(Long userId){ Model model = modelRepository.findById(userId) - .orElseThrow(() -> new GlobalException(ErrorStatus.MODEL_NOT_FOUND)); + .orElseThrow(() -> new GlobalException(ErrorStatus.NOT_EXIST_USER)); List favoritePortfolioList = favoritePortfolioRepository.findByModel(model); return favoritePortfolioList.stream() .map(PortfolioDto::from) diff --git a/src/main/java/umc/meme/shop/domain/reservation/controller/ReservationController.java b/src/main/java/umc/meme/shop/domain/reservation/controller/ReservationController.java index 2a50e8e..ce51e49 100644 --- a/src/main/java/umc/meme/shop/domain/reservation/controller/ReservationController.java +++ b/src/main/java/umc/meme/shop/domain/reservation/controller/ReservationController.java @@ -3,13 +3,11 @@ import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.Parameters; -import io.swagger.v3.oas.annotations.media.Content; -import io.swagger.v3.oas.annotations.media.Schema; -import io.swagger.v3.oas.annotations.responses.ApiResponses; import lombok.RequiredArgsConstructor; import org.springframework.web.bind.annotation.*; import umc.meme.shop.domain.reservation.dto.request.AlterReservationDto; -import umc.meme.shop.domain.reservation.dto.request.ReservationDto; +import umc.meme.shop.domain.reservation.dto.request.ReservationRequestDto; +import umc.meme.shop.domain.reservation.service.ReservationService; import umc.meme.shop.global.SuccessStatus; import umc.meme.shop.global.response.ApiResponse; @@ -17,6 +15,7 @@ @RequiredArgsConstructor @RequestMapping("/api/v1/reservation") public class ReservationController { + private final ReservationService reservationService; @Operation(summary = "예약 상태 변경", description = "예약 상태를 변경하는 API입니다.") @@ -30,7 +29,8 @@ public ApiResponse alteration(@RequestBody AlterReservationDto alterReservationD @Operation(summary = "예약하기", description = "예약하기 기능을 수행하는 API입니다.") @PostMapping("/") - public ApiResponse reservation(@RequestBody ReservationDto reservationDto){ + public ApiResponse reservation(@RequestBody ReservationRequestDto reservationDto){ + reservationService.setReservation(reservationDto); return ApiResponse.SuccessResponse(SuccessStatus.RESERVATION_CREATE); } } diff --git a/src/main/java/umc/meme/shop/domain/reservation/dto/request/ReservationDto.java b/src/main/java/umc/meme/shop/domain/reservation/dto/request/ReservationRequestDto.java similarity index 94% rename from src/main/java/umc/meme/shop/domain/reservation/dto/request/ReservationDto.java rename to src/main/java/umc/meme/shop/domain/reservation/dto/request/ReservationRequestDto.java index a0f0a40..6fc1337 100644 --- a/src/main/java/umc/meme/shop/domain/reservation/dto/request/ReservationDto.java +++ b/src/main/java/umc/meme/shop/domain/reservation/dto/request/ReservationRequestDto.java @@ -7,7 +7,7 @@ import java.util.Date; @Data -public class ReservationDto { +public class ReservationRequestDto { @NotBlank(message = "modelId를 입력해주세요") private Long modelId; @NotBlank(message = "portfolioId를 입력해주세요") diff --git a/src/main/java/umc/meme/shop/domain/reservation/entity/Reservation.java b/src/main/java/umc/meme/shop/domain/reservation/entity/Reservation.java index 9142d11..af56af7 100644 --- a/src/main/java/umc/meme/shop/domain/reservation/entity/Reservation.java +++ b/src/main/java/umc/meme/shop/domain/reservation/entity/Reservation.java @@ -2,6 +2,7 @@ import jakarta.persistence.*; import lombok.AllArgsConstructor; +import lombok.Builder; import lombok.Getter; import lombok.NoArgsConstructor; import umc.meme.shop.domain.model.entity.Model; @@ -11,6 +12,7 @@ import java.util.Date; +@Builder @Getter @AllArgsConstructor @NoArgsConstructor diff --git a/src/main/java/umc/meme/shop/domain/reservation/service/ReservationService.java b/src/main/java/umc/meme/shop/domain/reservation/service/ReservationService.java new file mode 100644 index 0000000..f159b0f --- /dev/null +++ b/src/main/java/umc/meme/shop/domain/reservation/service/ReservationService.java @@ -0,0 +1,46 @@ +package umc.meme.shop.domain.reservation.service; + +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; +import umc.meme.shop.domain.model.entity.Model; +import umc.meme.shop.domain.model.repository.ModelRepository; +import umc.meme.shop.domain.portfolio.entity.Portfolio; +import umc.meme.shop.domain.portfolio.repository.PortfolioRepository; +import umc.meme.shop.domain.reservation.dto.request.ReservationRequestDto; +import umc.meme.shop.domain.reservation.entity.Reservation; +import umc.meme.shop.domain.reservation.entity.enums.Status; +import umc.meme.shop.domain.reservation.repository.ReservationRepository; +import umc.meme.shop.global.ErrorStatus; +import umc.meme.shop.global.exception.GlobalException; + +import java.util.Optional; + +@Service +@RequiredArgsConstructor +public class ReservationService { + private final ModelRepository modelRepository; + private final PortfolioRepository portfolioRepository; + private final ReservationRepository reservationRepository; + + //예약하기 + public void setReservation(ReservationRequestDto reservationDto){ + Optional model = modelRepository.findById(reservationDto.getModelId()); + if(model.isEmpty()){ + throw new GlobalException(ErrorStatus.NOT_EXIST_USER); + } + + Optional portfolio = portfolioRepository.findById(reservationDto.getPortfolioId()); + if(portfolio.isEmpty()){ + throw new GlobalException(ErrorStatus.NOT_EXIST_PORTFOLIO); + } + Reservation reservation = Reservation.builder() + .model(model.get()) + .portfolio(portfolio.get()) + .status(Status.EXPECTED) + .reservationTime(reservationDto.getReservationTime()) + .reservationDate(reservationDto.getReservationDate()) + .build(); + + reservationRepository.save(reservation); + } +} diff --git a/src/main/java/umc/meme/shop/global/ErrorStatus.java b/src/main/java/umc/meme/shop/global/ErrorStatus.java index c61b4d4..3c605d9 100644 --- a/src/main/java/umc/meme/shop/global/ErrorStatus.java +++ b/src/main/java/umc/meme/shop/global/ErrorStatus.java @@ -31,6 +31,7 @@ public enum ErrorStatus { * Not Found */ NOT_EXIST_USER(404, "존재하지 않는 유저입니다."), + NOT_EXIST_PORTFOLIO(404, "존재하지 않는 포트폴리오입니다."), PAGE_NOT_FOUND(404,"페이지를 찾을 수 없습니다"); private final int code; From 7528070e0329347d95ec626011a7d918ac53fbc8 Mon Sep 17 00:00:00 2001 From: daeun084 <030804jk@naver.com> Date: Tue, 23 Jan 2024 14:24:48 +0900 Subject: [PATCH 29/36] =?UTF-8?q?feat:=20=EC=98=88=EC=95=BD=ED=95=98?= =?UTF-8?q?=EA=B8=B0=20=EC=83=81=ED=83=9C=20=EB=B3=80=EA=B2=BD=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 --- .../reservation/controller/ReservationController.java | 5 +++-- .../reservation/dto/response/ReservationResponseDto.java | 4 ++++ .../meme/shop/domain/reservation/entity/Reservation.java | 5 +++++ .../domain/reservation/service/ReservationService.java | 9 +++++++++ src/main/java/umc/meme/shop/global/ErrorStatus.java | 1 + 5 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 src/main/java/umc/meme/shop/domain/reservation/dto/response/ReservationResponseDto.java diff --git a/src/main/java/umc/meme/shop/domain/reservation/controller/ReservationController.java b/src/main/java/umc/meme/shop/domain/reservation/controller/ReservationController.java index ce51e49..9eefa4b 100644 --- a/src/main/java/umc/meme/shop/domain/reservation/controller/ReservationController.java +++ b/src/main/java/umc/meme/shop/domain/reservation/controller/ReservationController.java @@ -22,8 +22,9 @@ public class ReservationController { @Parameters({ @Parameter(name = "status", description = "Status enum 에 있는 값 (EXPECTED, COMPLETE, CANCEL)") }) - @PatchMapping("/alteration") - public ApiResponse alteration(@RequestBody AlterReservationDto alterReservationDto){ + @PatchMapping("/{reservationId}/alteration") + public ApiResponse alteration(@PathVariable Long reservationId, @RequestBody AlterReservationDto alterReservationDto){ + reservationService.updateReservationStatus(reservationId, alterReservationDto); return ApiResponse.SuccessResponse(SuccessStatus.RESERVATION_UPDATE); } diff --git a/src/main/java/umc/meme/shop/domain/reservation/dto/response/ReservationResponseDto.java b/src/main/java/umc/meme/shop/domain/reservation/dto/response/ReservationResponseDto.java new file mode 100644 index 0000000..a4afc3a --- /dev/null +++ b/src/main/java/umc/meme/shop/domain/reservation/dto/response/ReservationResponseDto.java @@ -0,0 +1,4 @@ +package umc.meme.shop.domain.reservation.dto.response; + +public class ReservationResponseDto { +} diff --git a/src/main/java/umc/meme/shop/domain/reservation/entity/Reservation.java b/src/main/java/umc/meme/shop/domain/reservation/entity/Reservation.java index af56af7..3fafd38 100644 --- a/src/main/java/umc/meme/shop/domain/reservation/entity/Reservation.java +++ b/src/main/java/umc/meme/shop/domain/reservation/entity/Reservation.java @@ -44,4 +44,9 @@ public class Reservation { @Column(nullable = false) private Date reservationDate; + + public void updateReservation(Status status){ + if(status != null) + this.status = status; + } } diff --git a/src/main/java/umc/meme/shop/domain/reservation/service/ReservationService.java b/src/main/java/umc/meme/shop/domain/reservation/service/ReservationService.java index f159b0f..ae9e88c 100644 --- a/src/main/java/umc/meme/shop/domain/reservation/service/ReservationService.java +++ b/src/main/java/umc/meme/shop/domain/reservation/service/ReservationService.java @@ -6,6 +6,7 @@ import umc.meme.shop.domain.model.repository.ModelRepository; import umc.meme.shop.domain.portfolio.entity.Portfolio; import umc.meme.shop.domain.portfolio.repository.PortfolioRepository; +import umc.meme.shop.domain.reservation.dto.request.AlterReservationDto; import umc.meme.shop.domain.reservation.dto.request.ReservationRequestDto; import umc.meme.shop.domain.reservation.entity.Reservation; import umc.meme.shop.domain.reservation.entity.enums.Status; @@ -43,4 +44,12 @@ public void setReservation(ReservationRequestDto reservationDto){ reservationRepository.save(reservation); } + + //예약하기 상태 변경 + public void updateReservationStatus(Long reservationId, AlterReservationDto reservationDto){ + Reservation reservation = reservationRepository.findById(reservationId) + .orElseThrow(() -> new GlobalException(ErrorStatus.NOT_EXIST_RESERVATION)); + Status status = reservationDto.getStatus(); + reservation.updateReservation(status); + } } diff --git a/src/main/java/umc/meme/shop/global/ErrorStatus.java b/src/main/java/umc/meme/shop/global/ErrorStatus.java index 3c605d9..d50e397 100644 --- a/src/main/java/umc/meme/shop/global/ErrorStatus.java +++ b/src/main/java/umc/meme/shop/global/ErrorStatus.java @@ -32,6 +32,7 @@ public enum ErrorStatus { */ NOT_EXIST_USER(404, "존재하지 않는 유저입니다."), NOT_EXIST_PORTFOLIO(404, "존재하지 않는 포트폴리오입니다."), + NOT_EXIST_RESERVATION(404, "존재하지 않는 예약입니다."), PAGE_NOT_FOUND(404,"페이지를 찾을 수 없습니다"); private final int code; From 71ec30867b7bb65e8d1641ac51899677f8afde8e Mon Sep 17 00:00:00 2001 From: daeun084 <030804jk@naver.com> Date: Tue, 23 Jan 2024 15:29:15 +0900 Subject: [PATCH 30/36] =?UTF-8?q?feat:=20=ED=8F=AC=ED=8A=B8=ED=8F=B4?= =?UTF-8?q?=EB=A6=AC=EC=98=A4=20=EC=83=9D=EC=84=B1=20=EA=B8=B0=EB=8A=A5=20?= =?UTF-8?q?=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../artist/controller/ArtistController.java | 31 ++++++++++++++++++- .../domain/artist/service/ArtistService.java | 25 +++++++++++++++ .../domain/portfolio/entity/Portfolio.java | 2 ++ 3 files changed, 57 insertions(+), 1 deletion(-) diff --git a/src/main/java/umc/meme/shop/domain/artist/controller/ArtistController.java b/src/main/java/umc/meme/shop/domain/artist/controller/ArtistController.java index 7fbb0a9..2cdc0b7 100644 --- a/src/main/java/umc/meme/shop/domain/artist/controller/ArtistController.java +++ b/src/main/java/umc/meme/shop/domain/artist/controller/ArtistController.java @@ -3,6 +3,9 @@ import io.swagger.v3.oas.annotations.Operation; import lombok.RequiredArgsConstructor; import org.springframework.web.bind.annotation.*; +import umc.meme.shop.domain.artist.entity.Artist; +import umc.meme.shop.domain.artist.entity.enums.WorkExperience; +import umc.meme.shop.domain.artist.repository.ArtistRepository; import umc.meme.shop.domain.portfolio.dto.request.CreatePortfolioDto; import umc.meme.shop.domain.artist.dto.request.ArtistProfileDto; import umc.meme.shop.domain.portfolio.dto.request.UpdatePortfolioDto; @@ -34,7 +37,7 @@ public ApiResponse tempException(){ throw new GlobalException(ErrorStatus.TEMP); // return ApiResponse.SuccessResponse(SuccessStatus.TEMP); } - // @Operation(summary = "아티스트 프로필 관리") + @Operation(summary = "아티스트 프로필 관리") @PatchMapping("/mypage/{userId}/profile/artist") public ApiResponse updateProfile(@PathVariable Long userId, @RequestBody ArtistProfileDto profileDto){ return ApiResponse.SuccessResponse(SuccessStatus.PROFILE_UPDATE); @@ -50,9 +53,35 @@ public ApiResponse getPortfolio(@PathVariable Long userId){ @PostMapping("/mypage/{userId}/portfolio") public ApiResponse createPortfolio(@PathVariable Long userId, @RequestBody CreatePortfolioDto portfolioDto){ // TODO: PortfolioImg 추가 + artistService.createPortfolio(userId, portfolioDto); return ApiResponse.SuccessResponse(SuccessStatus.PORTFOLIO_CREATE); } + final ArtistRepository artistRepository; + @PostMapping("/artist/make") + public ApiResponse createArtist(@RequestBody ArtistProfileDto profileDto){ + Artist artist = Artist.builder() + .region(profileDto.getRegion()) + .email("") + .name("ArtistTestName") + .gender(profileDto.getGender()) + .nickname(profileDto.getNickname()) + .introduction(profileDto.getIntroduction()) + .profileImg(profileDto.getProfileImg()) + .workExperience(WorkExperience.EIGHT) + .specialization(profileDto.getSpecialization()) + .makeupLocation(profileDto.getMakeupLocation()) + .availableTime(profileDto.getAvailableTime()) + + .build(); + artistRepository.save(artist); + return ApiResponse.SuccessResponse(SuccessStatus.RESERVATION_UPDATE); + + } + + + + @Operation(summary = "포트폴리오 수정/삭제", description = "포트폴리오를 조회하는 API입니다.") @PatchMapping("/mypage/{userId}/portfolio") public ApiResponse updatePortfolio(@PathVariable Long userId, @RequestBody UpdatePortfolioDto portfolioDto){ diff --git a/src/main/java/umc/meme/shop/domain/artist/service/ArtistService.java b/src/main/java/umc/meme/shop/domain/artist/service/ArtistService.java index 548de5e..05769fa 100644 --- a/src/main/java/umc/meme/shop/domain/artist/service/ArtistService.java +++ b/src/main/java/umc/meme/shop/domain/artist/service/ArtistService.java @@ -2,10 +2,35 @@ import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; +import umc.meme.shop.domain.artist.entity.Artist; import umc.meme.shop.domain.artist.repository.ArtistRepository; +import umc.meme.shop.domain.portfolio.dto.request.CreatePortfolioDto; +import umc.meme.shop.domain.portfolio.entity.Portfolio; +import umc.meme.shop.domain.portfolio.repository.PortfolioRepository; +import umc.meme.shop.global.ErrorStatus; +import umc.meme.shop.global.exception.GlobalException; + +import java.util.Optional; @Service @RequiredArgsConstructor public class ArtistService { private final ArtistRepository artistRepository; + private final PortfolioRepository portfolioRepository; + + //포트폴리오 생성 + public void createPortfolio(Long artistId, CreatePortfolioDto portfolioDto){ + Optional artist = artistRepository.findById(artistId); + if(artist.isEmpty()) + throw new GlobalException(ErrorStatus.NOT_EXIST_USER); + + Portfolio portfolio = Portfolio.builder() + .artist(artist.get()) + .category(portfolioDto.getCategory()) + .makeupName(portfolioDto.getMakeupName()) + .info(portfolioDto.getInfo()) + .price(portfolioDto.getPrice()) + .build(); + portfolioRepository.save(portfolio); + } } diff --git a/src/main/java/umc/meme/shop/domain/portfolio/entity/Portfolio.java b/src/main/java/umc/meme/shop/domain/portfolio/entity/Portfolio.java index 4a2b9d4..3bec51c 100644 --- a/src/main/java/umc/meme/shop/domain/portfolio/entity/Portfolio.java +++ b/src/main/java/umc/meme/shop/domain/portfolio/entity/Portfolio.java @@ -2,12 +2,14 @@ import jakarta.persistence.*; import lombok.AllArgsConstructor; +import lombok.Builder; import lombok.Getter; import lombok.NoArgsConstructor; import umc.meme.shop.domain.artist.entity.Artist; import umc.meme.shop.domain.portfolio.entity.enums.Category; +@Builder @Getter @AllArgsConstructor @NoArgsConstructor From 0453fec528ed7aca1dea0273a49379e91bf495f2 Mon Sep 17 00:00:00 2001 From: daeun084 <030804jk@naver.com> Date: Tue, 23 Jan 2024 15:29:55 +0900 Subject: [PATCH 31/36] chore: annoation --- .../java/umc/meme/shop/domain/artist/entity/Artist.java | 6 ++++-- .../umc/meme/shop/domain/artist/service/ArtistService.java | 2 ++ .../reservation/controller/ReservationController.java | 3 ++- .../shop/domain/reservation/service/ReservationService.java | 5 ++++- 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/main/java/umc/meme/shop/domain/artist/entity/Artist.java b/src/main/java/umc/meme/shop/domain/artist/entity/Artist.java index 5c95080..f569e38 100644 --- a/src/main/java/umc/meme/shop/domain/artist/entity/Artist.java +++ b/src/main/java/umc/meme/shop/domain/artist/entity/Artist.java @@ -2,6 +2,7 @@ import jakarta.persistence.*; import lombok.AllArgsConstructor; +import lombok.Builder; import lombok.Getter; import lombok.NoArgsConstructor; import umc.meme.shop.domain.artist.entity.enums.*; @@ -11,6 +12,7 @@ import java.util.Date; import java.util.List; +@Builder @Getter @AllArgsConstructor @NoArgsConstructor @@ -44,11 +46,11 @@ public class Artist { @Column(nullable = false) private WorkExperience workExperience; -// @Enumerated(EnumType.STRING) + @Enumerated(EnumType.STRING) // @Column(nullable = false) private List region; -// @Enumerated(EnumType.STRING) + @Enumerated(EnumType.STRING) // @Column(nullable = false) private List specialization; diff --git a/src/main/java/umc/meme/shop/domain/artist/service/ArtistService.java b/src/main/java/umc/meme/shop/domain/artist/service/ArtistService.java index 05769fa..8b622e5 100644 --- a/src/main/java/umc/meme/shop/domain/artist/service/ArtistService.java +++ b/src/main/java/umc/meme/shop/domain/artist/service/ArtistService.java @@ -1,5 +1,6 @@ package umc.meme.shop.domain.artist.service; +import jakarta.transaction.Transactional; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; import umc.meme.shop.domain.artist.entity.Artist; @@ -19,6 +20,7 @@ public class ArtistService { private final PortfolioRepository portfolioRepository; //포트폴리오 생성 + @Transactional public void createPortfolio(Long artistId, CreatePortfolioDto portfolioDto){ Optional artist = artistRepository.findById(artistId); if(artist.isEmpty()) diff --git a/src/main/java/umc/meme/shop/domain/reservation/controller/ReservationController.java b/src/main/java/umc/meme/shop/domain/reservation/controller/ReservationController.java index 9eefa4b..2b1adbc 100644 --- a/src/main/java/umc/meme/shop/domain/reservation/controller/ReservationController.java +++ b/src/main/java/umc/meme/shop/domain/reservation/controller/ReservationController.java @@ -5,6 +5,7 @@ import io.swagger.v3.oas.annotations.Parameters; import lombok.RequiredArgsConstructor; import org.springframework.web.bind.annotation.*; +import umc.meme.shop.domain.portfolio.dto.response.PortfolioDto; import umc.meme.shop.domain.reservation.dto.request.AlterReservationDto; import umc.meme.shop.domain.reservation.dto.request.ReservationRequestDto; import umc.meme.shop.domain.reservation.service.ReservationService; @@ -31,7 +32,7 @@ public ApiResponse alteration(@PathVariable Long reservationId, @RequestBody Alt @Operation(summary = "예약하기", description = "예약하기 기능을 수행하는 API입니다.") @PostMapping("/") public ApiResponse reservation(@RequestBody ReservationRequestDto reservationDto){ - reservationService.setReservation(reservationDto); + reservationService.createReservation(reservationDto); return ApiResponse.SuccessResponse(SuccessStatus.RESERVATION_CREATE); } } diff --git a/src/main/java/umc/meme/shop/domain/reservation/service/ReservationService.java b/src/main/java/umc/meme/shop/domain/reservation/service/ReservationService.java index ae9e88c..9041e81 100644 --- a/src/main/java/umc/meme/shop/domain/reservation/service/ReservationService.java +++ b/src/main/java/umc/meme/shop/domain/reservation/service/ReservationService.java @@ -1,5 +1,6 @@ package umc.meme.shop.domain.reservation.service; +import jakarta.transaction.Transactional; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; import umc.meme.shop.domain.model.entity.Model; @@ -24,7 +25,8 @@ public class ReservationService { private final ReservationRepository reservationRepository; //예약하기 - public void setReservation(ReservationRequestDto reservationDto){ + @Transactional + public void createReservation(ReservationRequestDto reservationDto){ Optional model = modelRepository.findById(reservationDto.getModelId()); if(model.isEmpty()){ throw new GlobalException(ErrorStatus.NOT_EXIST_USER); @@ -46,6 +48,7 @@ public void setReservation(ReservationRequestDto reservationDto){ } //예약하기 상태 변경 + @Transactional public void updateReservationStatus(Long reservationId, AlterReservationDto reservationDto){ Reservation reservation = reservationRepository.findById(reservationId) .orElseThrow(() -> new GlobalException(ErrorStatus.NOT_EXIST_RESERVATION)); From 855cf1b5bebbb05e5b2086403926beef4f7f045b Mon Sep 17 00:00:00 2001 From: daeun084 <030804jk@naver.com> Date: Tue, 23 Jan 2024 15:46:56 +0900 Subject: [PATCH 32/36] =?UTF-8?q?chore:=20import=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../artist/controller/ArtistController.java | 45 ------------------- .../domain/model/service/ModelService.java | 1 - 2 files changed, 46 deletions(-) diff --git a/src/main/java/umc/meme/shop/domain/artist/controller/ArtistController.java b/src/main/java/umc/meme/shop/domain/artist/controller/ArtistController.java index 2cdc0b7..868198a 100644 --- a/src/main/java/umc/meme/shop/domain/artist/controller/ArtistController.java +++ b/src/main/java/umc/meme/shop/domain/artist/controller/ArtistController.java @@ -3,17 +3,12 @@ import io.swagger.v3.oas.annotations.Operation; import lombok.RequiredArgsConstructor; import org.springframework.web.bind.annotation.*; -import umc.meme.shop.domain.artist.entity.Artist; -import umc.meme.shop.domain.artist.entity.enums.WorkExperience; -import umc.meme.shop.domain.artist.repository.ArtistRepository; import umc.meme.shop.domain.portfolio.dto.request.CreatePortfolioDto; import umc.meme.shop.domain.artist.dto.request.ArtistProfileDto; import umc.meme.shop.domain.portfolio.dto.request.UpdatePortfolioDto; import umc.meme.shop.domain.review.dto.request.UpdateReviewDto; import umc.meme.shop.domain.artist.service.ArtistService; -import umc.meme.shop.global.ErrorStatus; import umc.meme.shop.global.SuccessStatus; -import umc.meme.shop.global.exception.GlobalException; import umc.meme.shop.global.response.ApiResponse; @RestController @@ -22,21 +17,6 @@ public class ArtistController { private final ArtistService artistService; - //ApiResponse TEST - @GetMapping("/temp/success") - public ApiResponse tempSuccess(){ - return ApiResponse.SuccessResponse(SuccessStatus.TEMP); - } - @GetMapping("/temp/failure") - public ApiResponse tempFailure(){ - return ApiResponse.FailureResponse(ErrorStatus.TEMP); - } - - @GetMapping("/temp/exception") - public ApiResponse tempException(){ - throw new GlobalException(ErrorStatus.TEMP); -// return ApiResponse.SuccessResponse(SuccessStatus.TEMP); - } @Operation(summary = "아티스트 프로필 관리") @PatchMapping("/mypage/{userId}/profile/artist") public ApiResponse updateProfile(@PathVariable Long userId, @RequestBody ArtistProfileDto profileDto){ @@ -57,31 +37,6 @@ public ApiResponse createPortfolio(@PathVariable Long userId, @RequestBody Creat return ApiResponse.SuccessResponse(SuccessStatus.PORTFOLIO_CREATE); } - final ArtistRepository artistRepository; - @PostMapping("/artist/make") - public ApiResponse createArtist(@RequestBody ArtistProfileDto profileDto){ - Artist artist = Artist.builder() - .region(profileDto.getRegion()) - .email("") - .name("ArtistTestName") - .gender(profileDto.getGender()) - .nickname(profileDto.getNickname()) - .introduction(profileDto.getIntroduction()) - .profileImg(profileDto.getProfileImg()) - .workExperience(WorkExperience.EIGHT) - .specialization(profileDto.getSpecialization()) - .makeupLocation(profileDto.getMakeupLocation()) - .availableTime(profileDto.getAvailableTime()) - - .build(); - artistRepository.save(artist); - return ApiResponse.SuccessResponse(SuccessStatus.RESERVATION_UPDATE); - - } - - - - @Operation(summary = "포트폴리오 수정/삭제", description = "포트폴리오를 조회하는 API입니다.") @PatchMapping("/mypage/{userId}/portfolio") public ApiResponse updatePortfolio(@PathVariable Long userId, @RequestBody UpdatePortfolioDto portfolioDto){ diff --git a/src/main/java/umc/meme/shop/domain/model/service/ModelService.java b/src/main/java/umc/meme/shop/domain/model/service/ModelService.java index 77c7ec2..7c35667 100644 --- a/src/main/java/umc/meme/shop/domain/model/service/ModelService.java +++ b/src/main/java/umc/meme/shop/domain/model/service/ModelService.java @@ -12,7 +12,6 @@ import umc.meme.shop.domain.model.entity.Model; import umc.meme.shop.domain.model.repository.ModelRepository; import umc.meme.shop.domain.portfolio.dto.response.PortfolioDto; -import umc.meme.shop.domain.portfolio.entity.Portfolio; import umc.meme.shop.global.ErrorStatus; import umc.meme.shop.global.exception.GlobalException; From 8835a2accd43965317a19ca4b241a8a4048c914b Mon Sep 17 00:00:00 2001 From: daeun084 <030804jk@naver.com> Date: Tue, 23 Jan 2024 19:32:25 +0900 Subject: [PATCH 33/36] =?UTF-8?q?feat:=20=EC=98=88=EC=95=BD=20=EC=A1=B0?= =?UTF-8?q?=ED=9A=8C=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 --- .../artist/controller/ArtistController.java | 2 +- .../shop/domain/artist/entity/Artist.java | 2 + .../domain/artist/service/ArtistService.java | 24 +++++++++-- .../dto/response/ReservationResponseDto.java | 42 +++++++++++++++++++ .../repository/ReservationRepository.java | 8 +++- 5 files changed, 72 insertions(+), 6 deletions(-) diff --git a/src/main/java/umc/meme/shop/domain/artist/controller/ArtistController.java b/src/main/java/umc/meme/shop/domain/artist/controller/ArtistController.java index 868198a..8ff9d83 100644 --- a/src/main/java/umc/meme/shop/domain/artist/controller/ArtistController.java +++ b/src/main/java/umc/meme/shop/domain/artist/controller/ArtistController.java @@ -47,7 +47,7 @@ public ApiResponse updatePortfolio(@PathVariable Long userId, @RequestBody Updat @Operation(summary = "예약 조회", description = "예약 정보를 조회하는 API입니다.") @GetMapping("/mypage/{userId}/reservation") public ApiResponse getReservation(@PathVariable Long userId){ - return ApiResponse.SuccessResponse(SuccessStatus.RESERVATION_GET, ""); + return ApiResponse.SuccessResponse(SuccessStatus.RESERVATION_GET, artistService.getReservation(userId)); } @Operation(summary = "리뷰 관리", description = "block 상태를 통해 리뷰 공개 유무를 결정할 수 있는 API입니다.") diff --git a/src/main/java/umc/meme/shop/domain/artist/entity/Artist.java b/src/main/java/umc/meme/shop/domain/artist/entity/Artist.java index f569e38..02e5969 100644 --- a/src/main/java/umc/meme/shop/domain/artist/entity/Artist.java +++ b/src/main/java/umc/meme/shop/domain/artist/entity/Artist.java @@ -58,6 +58,8 @@ public class Artist { @Column(nullable = false) private MakeupLocation makeupLocation; + private String shopLocation; //샵의 위치 + @Column(nullable = true) private Date inactiveDate; diff --git a/src/main/java/umc/meme/shop/domain/artist/service/ArtistService.java b/src/main/java/umc/meme/shop/domain/artist/service/ArtistService.java index 8b622e5..bdd97f6 100644 --- a/src/main/java/umc/meme/shop/domain/artist/service/ArtistService.java +++ b/src/main/java/umc/meme/shop/domain/artist/service/ArtistService.java @@ -8,26 +8,31 @@ import umc.meme.shop.domain.portfolio.dto.request.CreatePortfolioDto; import umc.meme.shop.domain.portfolio.entity.Portfolio; import umc.meme.shop.domain.portfolio.repository.PortfolioRepository; +import umc.meme.shop.domain.reservation.dto.response.ReservationResponseDto; +import umc.meme.shop.domain.reservation.entity.Reservation; +import umc.meme.shop.domain.reservation.repository.ReservationRepository; import umc.meme.shop.global.ErrorStatus; import umc.meme.shop.global.exception.GlobalException; +import java.util.List; import java.util.Optional; +import java.util.stream.Collectors; @Service @RequiredArgsConstructor public class ArtistService { private final ArtistRepository artistRepository; private final PortfolioRepository portfolioRepository; + private final ReservationRepository reservationRepository; //포트폴리오 생성 @Transactional public void createPortfolio(Long artistId, CreatePortfolioDto portfolioDto){ - Optional artist = artistRepository.findById(artistId); - if(artist.isEmpty()) - throw new GlobalException(ErrorStatus.NOT_EXIST_USER); + Artist artist = artistRepository.findById(artistId) + .orElseThrow(() -> new GlobalException(ErrorStatus.NOT_EXIST_USER)); Portfolio portfolio = Portfolio.builder() - .artist(artist.get()) + .artist(artist) .category(portfolioDto.getCategory()) .makeupName(portfolioDto.getMakeupName()) .info(portfolioDto.getInfo()) @@ -35,4 +40,15 @@ public void createPortfolio(Long artistId, CreatePortfolioDto portfolioDto){ .build(); portfolioRepository.save(portfolio); } + + //예약 조회 + public List getReservation(Long artistId){ + Artist artist = artistRepository.findById(artistId) + .orElseThrow(() -> new GlobalException(ErrorStatus.NOT_EXIST_USER)); + + List reservationList = reservationRepository.findByArtist(artist); + return reservationList.stream() + .map(ReservationResponseDto::from) + .collect(Collectors.toList()); + } } diff --git a/src/main/java/umc/meme/shop/domain/reservation/dto/response/ReservationResponseDto.java b/src/main/java/umc/meme/shop/domain/reservation/dto/response/ReservationResponseDto.java index a4afc3a..197fd41 100644 --- a/src/main/java/umc/meme/shop/domain/reservation/dto/response/ReservationResponseDto.java +++ b/src/main/java/umc/meme/shop/domain/reservation/dto/response/ReservationResponseDto.java @@ -1,4 +1,46 @@ package umc.meme.shop.domain.reservation.dto.response; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Getter; +import lombok.NoArgsConstructor; +import umc.meme.shop.domain.artist.entity.Artist; +import umc.meme.shop.domain.portfolio.entity.Portfolio; +import umc.meme.shop.domain.reservation.entity.Reservation; +import umc.meme.shop.domain.reservation.entity.enums.ReservationTime; +import umc.meme.shop.global.ErrorStatus; +import umc.meme.shop.global.exception.GlobalException; + +import java.util.Date; + +@Getter +@Builder +@NoArgsConstructor +@AllArgsConstructor public class ReservationResponseDto { + private String modelName; + private String makeupName; + private int price; + + private Date reservationDate; + private ReservationTime reservationTime; + private String shopLocation; //샵 위치 + + public static ReservationResponseDto from(Reservation reservation){ + Portfolio portfolio = reservation.getPortfolio(); + if(portfolio == null) + throw new GlobalException(ErrorStatus.NOT_EXIST_PORTFOLIO); + + Artist artist = reservation.getPortfolio().getArtist(); + + return ReservationResponseDto.builder() + .modelName(reservation.getModel().getName()) + .makeupName(portfolio.getMakeupName()) + .price(portfolio.getPrice()) + .reservationTime(reservation.getReservationTime()) + .reservationDate(reservation.getReservationDate()) + .shopLocation(artist.getShopLocation()) + .build(); + } + } diff --git a/src/main/java/umc/meme/shop/domain/reservation/repository/ReservationRepository.java b/src/main/java/umc/meme/shop/domain/reservation/repository/ReservationRepository.java index a61e87e..0e3a4a2 100644 --- a/src/main/java/umc/meme/shop/domain/reservation/repository/ReservationRepository.java +++ b/src/main/java/umc/meme/shop/domain/reservation/repository/ReservationRepository.java @@ -1,7 +1,13 @@ package umc.meme.shop.domain.reservation.repository; import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.query.Param; +import umc.meme.shop.domain.artist.entity.Artist; import umc.meme.shop.domain.reservation.entity.Reservation; +import java.util.List; + public interface ReservationRepository extends JpaRepository { -} + @Query("SELECT r FROM Reservation r WHERE r.portfolio.artist = :artist") + List findByArtist(@Param("artist") Artist artist);} From 3a7e65f1417e914bf5d7ff105f3f2f62dbf96d8e Mon Sep 17 00:00:00 2001 From: daeun084 <030804jk@naver.com> Date: Tue, 23 Jan 2024 19:42:07 +0900 Subject: [PATCH 34/36] mov: Portfolio controller, service foldering --- .../artist/controller/ArtistController.java | 21 ---------- .../domain/artist/service/ArtistService.java | 17 --------- .../controller/PortfolioController.java | 38 +++++++++++++++++++ .../portfolio/service/PortfolioService.java | 35 +++++++++++++++++ 4 files changed, 73 insertions(+), 38 deletions(-) create mode 100644 src/main/java/umc/meme/shop/domain/portfolio/controller/PortfolioController.java create mode 100644 src/main/java/umc/meme/shop/domain/portfolio/service/PortfolioService.java diff --git a/src/main/java/umc/meme/shop/domain/artist/controller/ArtistController.java b/src/main/java/umc/meme/shop/domain/artist/controller/ArtistController.java index 8ff9d83..d6adb70 100644 --- a/src/main/java/umc/meme/shop/domain/artist/controller/ArtistController.java +++ b/src/main/java/umc/meme/shop/domain/artist/controller/ArtistController.java @@ -23,27 +23,6 @@ public ApiResponse updateProfile(@PathVariable Long userId, @RequestBody ArtistP return ApiResponse.SuccessResponse(SuccessStatus.PROFILE_UPDATE); } - @Operation(summary = "포트폴리오 조회", description = "포트폴리오를 조회하는 API입니다.") - @GetMapping("/mypage/{userId}/portfolio") - public ApiResponse getPortfolio(@PathVariable Long userId){ - return ApiResponse.SuccessResponse(SuccessStatus.PORTFOLIO_GET, ""); - } - - @Operation(summary = "포트폴리오 생성", description = "포트폴리오를 생성하는 API입니다.") - @PostMapping("/mypage/{userId}/portfolio") - public ApiResponse createPortfolio(@PathVariable Long userId, @RequestBody CreatePortfolioDto portfolioDto){ - // TODO: PortfolioImg 추가 - artistService.createPortfolio(userId, portfolioDto); - return ApiResponse.SuccessResponse(SuccessStatus.PORTFOLIO_CREATE); - } - - @Operation(summary = "포트폴리오 수정/삭제", description = "포트폴리오를 조회하는 API입니다.") - @PatchMapping("/mypage/{userId}/portfolio") - public ApiResponse updatePortfolio(@PathVariable Long userId, @RequestBody UpdatePortfolioDto portfolioDto){ - // TODO: PortfolioImg 추가 - return ApiResponse.SuccessResponse(SuccessStatus.PORTFOLIO_UPDATE); - } - @Operation(summary = "예약 조회", description = "예약 정보를 조회하는 API입니다.") @GetMapping("/mypage/{userId}/reservation") public ApiResponse getReservation(@PathVariable Long userId){ diff --git a/src/main/java/umc/meme/shop/domain/artist/service/ArtistService.java b/src/main/java/umc/meme/shop/domain/artist/service/ArtistService.java index bdd97f6..c34f59e 100644 --- a/src/main/java/umc/meme/shop/domain/artist/service/ArtistService.java +++ b/src/main/java/umc/meme/shop/domain/artist/service/ArtistService.java @@ -22,25 +22,8 @@ @RequiredArgsConstructor public class ArtistService { private final ArtistRepository artistRepository; - private final PortfolioRepository portfolioRepository; private final ReservationRepository reservationRepository; - //포트폴리오 생성 - @Transactional - public void createPortfolio(Long artistId, CreatePortfolioDto portfolioDto){ - Artist artist = artistRepository.findById(artistId) - .orElseThrow(() -> new GlobalException(ErrorStatus.NOT_EXIST_USER)); - - Portfolio portfolio = Portfolio.builder() - .artist(artist) - .category(portfolioDto.getCategory()) - .makeupName(portfolioDto.getMakeupName()) - .info(portfolioDto.getInfo()) - .price(portfolioDto.getPrice()) - .build(); - portfolioRepository.save(portfolio); - } - //예약 조회 public List getReservation(Long artistId){ Artist artist = artistRepository.findById(artistId) diff --git a/src/main/java/umc/meme/shop/domain/portfolio/controller/PortfolioController.java b/src/main/java/umc/meme/shop/domain/portfolio/controller/PortfolioController.java new file mode 100644 index 0000000..18ea8e9 --- /dev/null +++ b/src/main/java/umc/meme/shop/domain/portfolio/controller/PortfolioController.java @@ -0,0 +1,38 @@ +package umc.meme.shop.domain.portfolio.controller; + +import io.swagger.v3.oas.annotations.Operation; +import lombok.RequiredArgsConstructor; +import org.springframework.web.bind.annotation.*; +import umc.meme.shop.domain.portfolio.dto.request.CreatePortfolioDto; +import umc.meme.shop.domain.portfolio.dto.request.UpdatePortfolioDto; +import umc.meme.shop.domain.portfolio.service.PortfolioService; +import umc.meme.shop.global.SuccessStatus; +import umc.meme.shop.global.response.ApiResponse; + +@RestController +@RequiredArgsConstructor +@RequestMapping("/api/v1/portfolio") +public class PortfolioController { + private final PortfolioService portfolioService; + + @Operation(summary = "포트폴리오 생성", description = "포트폴리오를 생성하는 API입니다.") + @PostMapping("/{userId}") + public ApiResponse createPortfolio(@PathVariable Long userId, @RequestBody CreatePortfolioDto portfolioDto){ + // TODO: PortfolioImg 추가 + portfolioService.createPortfolio(userId, portfolioDto); + return ApiResponse.SuccessResponse(SuccessStatus.PORTFOLIO_CREATE); + } + + @Operation(summary = "포트폴리오 조회", description = "포트폴리오를 조회하는 API입니다.") + @GetMapping("/{userId}") + public ApiResponse getPortfolio(@PathVariable Long userId){ + return ApiResponse.SuccessResponse(SuccessStatus.PORTFOLIO_GET, ""); + } + + @Operation(summary = "포트폴리오 수정/삭제", description = "포트폴리오를 조회하는 API입니다.") + @PatchMapping("/{userId}") + public ApiResponse updatePortfolio(@PathVariable Long userId, @RequestBody UpdatePortfolioDto portfolioDto){ + // TODO: PortfolioImg 추가 + return ApiResponse.SuccessResponse(SuccessStatus.PORTFOLIO_UPDATE); + } +} diff --git a/src/main/java/umc/meme/shop/domain/portfolio/service/PortfolioService.java b/src/main/java/umc/meme/shop/domain/portfolio/service/PortfolioService.java new file mode 100644 index 0000000..0868b48 --- /dev/null +++ b/src/main/java/umc/meme/shop/domain/portfolio/service/PortfolioService.java @@ -0,0 +1,35 @@ +package umc.meme.shop.domain.portfolio.service; + +import jakarta.transaction.Transactional; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; +import umc.meme.shop.domain.artist.entity.Artist; +import umc.meme.shop.domain.artist.repository.ArtistRepository; +import umc.meme.shop.domain.portfolio.dto.request.CreatePortfolioDto; +import umc.meme.shop.domain.portfolio.entity.Portfolio; +import umc.meme.shop.domain.portfolio.repository.PortfolioRepository; +import umc.meme.shop.global.ErrorStatus; +import umc.meme.shop.global.exception.GlobalException; + +@Service +@RequiredArgsConstructor +public class PortfolioService { + private final ArtistRepository artistRepository; + private final PortfolioRepository portfolioRepository; + + //포트폴리오 생성 + @Transactional + public void createPortfolio(Long artistId, CreatePortfolioDto portfolioDto){ + Artist artist = artistRepository.findById(artistId) + .orElseThrow(() -> new GlobalException(ErrorStatus.NOT_EXIST_USER)); + + Portfolio portfolio = Portfolio.builder() + .artist(artist) + .category(portfolioDto.getCategory()) + .makeupName(portfolioDto.getMakeupName()) + .info(portfolioDto.getInfo()) + .price(portfolioDto.getPrice()) + .build(); + portfolioRepository.save(portfolio); + } +} From 82e8b08e0e707697eb6452675560ff79e8068f16 Mon Sep 17 00:00:00 2001 From: daeun084 <030804jk@naver.com> Date: Tue, 23 Jan 2024 19:47:24 +0900 Subject: [PATCH 35/36] mov: Reservation controller, service foldering --- .../artist/controller/ArtistController.java | 8 ------- .../domain/artist/service/ArtistService.java | 22 ------------------- .../controller/ReservationController.java | 10 ++++++++- .../service/ReservationService.java | 17 ++++++++++++++ 4 files changed, 26 insertions(+), 31 deletions(-) diff --git a/src/main/java/umc/meme/shop/domain/artist/controller/ArtistController.java b/src/main/java/umc/meme/shop/domain/artist/controller/ArtistController.java index d6adb70..4bb4c85 100644 --- a/src/main/java/umc/meme/shop/domain/artist/controller/ArtistController.java +++ b/src/main/java/umc/meme/shop/domain/artist/controller/ArtistController.java @@ -3,9 +3,7 @@ import io.swagger.v3.oas.annotations.Operation; import lombok.RequiredArgsConstructor; import org.springframework.web.bind.annotation.*; -import umc.meme.shop.domain.portfolio.dto.request.CreatePortfolioDto; import umc.meme.shop.domain.artist.dto.request.ArtistProfileDto; -import umc.meme.shop.domain.portfolio.dto.request.UpdatePortfolioDto; import umc.meme.shop.domain.review.dto.request.UpdateReviewDto; import umc.meme.shop.domain.artist.service.ArtistService; import umc.meme.shop.global.SuccessStatus; @@ -23,12 +21,6 @@ public ApiResponse updateProfile(@PathVariable Long userId, @RequestBody ArtistP return ApiResponse.SuccessResponse(SuccessStatus.PROFILE_UPDATE); } - @Operation(summary = "예약 조회", description = "예약 정보를 조회하는 API입니다.") - @GetMapping("/mypage/{userId}/reservation") - public ApiResponse getReservation(@PathVariable Long userId){ - return ApiResponse.SuccessResponse(SuccessStatus.RESERVATION_GET, artistService.getReservation(userId)); - } - @Operation(summary = "리뷰 관리", description = "block 상태를 통해 리뷰 공개 유무를 결정할 수 있는 API입니다.") @PatchMapping("/artist/review") public ApiResponse updateReview(@RequestBody UpdateReviewDto reviewDto){ diff --git a/src/main/java/umc/meme/shop/domain/artist/service/ArtistService.java b/src/main/java/umc/meme/shop/domain/artist/service/ArtistService.java index c34f59e..9f1332a 100644 --- a/src/main/java/umc/meme/shop/domain/artist/service/ArtistService.java +++ b/src/main/java/umc/meme/shop/domain/artist/service/ArtistService.java @@ -1,22 +1,10 @@ package umc.meme.shop.domain.artist.service; -import jakarta.transaction.Transactional; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; -import umc.meme.shop.domain.artist.entity.Artist; import umc.meme.shop.domain.artist.repository.ArtistRepository; -import umc.meme.shop.domain.portfolio.dto.request.CreatePortfolioDto; -import umc.meme.shop.domain.portfolio.entity.Portfolio; -import umc.meme.shop.domain.portfolio.repository.PortfolioRepository; -import umc.meme.shop.domain.reservation.dto.response.ReservationResponseDto; -import umc.meme.shop.domain.reservation.entity.Reservation; import umc.meme.shop.domain.reservation.repository.ReservationRepository; -import umc.meme.shop.global.ErrorStatus; -import umc.meme.shop.global.exception.GlobalException; -import java.util.List; -import java.util.Optional; -import java.util.stream.Collectors; @Service @RequiredArgsConstructor @@ -24,14 +12,4 @@ public class ArtistService { private final ArtistRepository artistRepository; private final ReservationRepository reservationRepository; - //예약 조회 - public List getReservation(Long artistId){ - Artist artist = artistRepository.findById(artistId) - .orElseThrow(() -> new GlobalException(ErrorStatus.NOT_EXIST_USER)); - - List reservationList = reservationRepository.findByArtist(artist); - return reservationList.stream() - .map(ReservationResponseDto::from) - .collect(Collectors.toList()); - } } diff --git a/src/main/java/umc/meme/shop/domain/reservation/controller/ReservationController.java b/src/main/java/umc/meme/shop/domain/reservation/controller/ReservationController.java index 2b1adbc..bcd88b6 100644 --- a/src/main/java/umc/meme/shop/domain/reservation/controller/ReservationController.java +++ b/src/main/java/umc/meme/shop/domain/reservation/controller/ReservationController.java @@ -5,7 +5,6 @@ import io.swagger.v3.oas.annotations.Parameters; import lombok.RequiredArgsConstructor; import org.springframework.web.bind.annotation.*; -import umc.meme.shop.domain.portfolio.dto.response.PortfolioDto; import umc.meme.shop.domain.reservation.dto.request.AlterReservationDto; import umc.meme.shop.domain.reservation.dto.request.ReservationRequestDto; import umc.meme.shop.domain.reservation.service.ReservationService; @@ -35,4 +34,13 @@ public ApiResponse reservation(@RequestBody ReservationRequestDto reservationDto reservationService.createReservation(reservationDto); return ApiResponse.SuccessResponse(SuccessStatus.RESERVATION_CREATE); } + + //아티스트 얘약 조회 + @Operation(summary = "예약 조회", description = "예약 정보를 조회하는 API입니다.") + @GetMapping("/{userId}/artist") + public ApiResponse getReservation(@PathVariable Long userId){ + return ApiResponse.SuccessResponse(SuccessStatus.RESERVATION_GET, reservationService.getReservation(userId)); + } + + //모델 예약 조회 } diff --git a/src/main/java/umc/meme/shop/domain/reservation/service/ReservationService.java b/src/main/java/umc/meme/shop/domain/reservation/service/ReservationService.java index 9041e81..ab350b5 100644 --- a/src/main/java/umc/meme/shop/domain/reservation/service/ReservationService.java +++ b/src/main/java/umc/meme/shop/domain/reservation/service/ReservationService.java @@ -3,23 +3,29 @@ import jakarta.transaction.Transactional; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; +import umc.meme.shop.domain.artist.entity.Artist; +import umc.meme.shop.domain.artist.repository.ArtistRepository; import umc.meme.shop.domain.model.entity.Model; import umc.meme.shop.domain.model.repository.ModelRepository; import umc.meme.shop.domain.portfolio.entity.Portfolio; import umc.meme.shop.domain.portfolio.repository.PortfolioRepository; import umc.meme.shop.domain.reservation.dto.request.AlterReservationDto; import umc.meme.shop.domain.reservation.dto.request.ReservationRequestDto; +import umc.meme.shop.domain.reservation.dto.response.ReservationResponseDto; import umc.meme.shop.domain.reservation.entity.Reservation; import umc.meme.shop.domain.reservation.entity.enums.Status; import umc.meme.shop.domain.reservation.repository.ReservationRepository; import umc.meme.shop.global.ErrorStatus; import umc.meme.shop.global.exception.GlobalException; +import java.util.List; import java.util.Optional; +import java.util.stream.Collectors; @Service @RequiredArgsConstructor public class ReservationService { + private final ArtistRepository artistRepository; private final ModelRepository modelRepository; private final PortfolioRepository portfolioRepository; private final ReservationRepository reservationRepository; @@ -55,4 +61,15 @@ public void updateReservationStatus(Long reservationId, AlterReservationDto rese Status status = reservationDto.getStatus(); reservation.updateReservation(status); } + + //아티스트 예약 조회 + public List getReservation(Long artistId){ + Artist artist = artistRepository.findById(artistId) + .orElseThrow(() -> new GlobalException(ErrorStatus.NOT_EXIST_USER)); + + List reservationList = reservationRepository.findByArtist(artist); + return reservationList.stream() + .map(ReservationResponseDto::from) + .collect(Collectors.toList()); + } } From 952eec9c681c6128fdb71a104465fd270d59494f Mon Sep 17 00:00:00 2001 From: yeopyeop-82 Date: Tue, 23 Jan 2024 22:23:21 +0900 Subject: [PATCH 36/36] =?UTF-8?q?add:=20=EA=B4=80=EC=8B=AC=20=EC=95=84?= =?UTF-8?q?=ED=8B=B0=EC=8A=A4=ED=8A=B8/=EB=A9=94=EC=9D=B4=ED=81=AC?= =?UTF-8?q?=EC=97=85=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../shop/domain/artist/entity/Artist.java | 1 + .../favorite/entity/FavoriteArtist.java | 2 + .../favorite/entity/FavoritePortfolio.java | 2 + .../repository/FavoriteArtistRepository.java | 2 + .../FavoritePortfolioRepository.java | 3 ++ .../model/controller/ModelController.java | 21 ++++++-- .../domain/model/service/ModelService.java | 53 +++++++++++++++++++ .../controller/ReservationController.java | 9 +++- .../umc/meme/shop/global/ErrorStatus.java | 3 ++ .../umc/meme/shop/global/SuccessStatus.java | 2 + 10 files changed, 93 insertions(+), 5 deletions(-) diff --git a/src/main/java/umc/meme/shop/domain/artist/entity/Artist.java b/src/main/java/umc/meme/shop/domain/artist/entity/Artist.java index 02e5969..323873e 100644 --- a/src/main/java/umc/meme/shop/domain/artist/entity/Artist.java +++ b/src/main/java/umc/meme/shop/domain/artist/entity/Artist.java @@ -58,6 +58,7 @@ public class Artist { @Column(nullable = false) private MakeupLocation makeupLocation; + @Column(nullable = true) private String shopLocation; //샵의 위치 @Column(nullable = true) diff --git a/src/main/java/umc/meme/shop/domain/favorite/entity/FavoriteArtist.java b/src/main/java/umc/meme/shop/domain/favorite/entity/FavoriteArtist.java index 0003bf5..b66473d 100644 --- a/src/main/java/umc/meme/shop/domain/favorite/entity/FavoriteArtist.java +++ b/src/main/java/umc/meme/shop/domain/favorite/entity/FavoriteArtist.java @@ -2,11 +2,13 @@ import jakarta.persistence.*; import lombok.AllArgsConstructor; +import lombok.Builder; import lombok.Getter; import lombok.NoArgsConstructor; import umc.meme.shop.domain.artist.entity.Artist; import umc.meme.shop.domain.model.entity.Model; +@Builder @Getter @AllArgsConstructor @NoArgsConstructor diff --git a/src/main/java/umc/meme/shop/domain/favorite/entity/FavoritePortfolio.java b/src/main/java/umc/meme/shop/domain/favorite/entity/FavoritePortfolio.java index bc96ea3..d73f152 100644 --- a/src/main/java/umc/meme/shop/domain/favorite/entity/FavoritePortfolio.java +++ b/src/main/java/umc/meme/shop/domain/favorite/entity/FavoritePortfolio.java @@ -2,11 +2,13 @@ import jakarta.persistence.*; import lombok.AllArgsConstructor; +import lombok.Builder; import lombok.Getter; import lombok.NoArgsConstructor; import umc.meme.shop.domain.model.entity.Model; import umc.meme.shop.domain.portfolio.entity.Portfolio; +@Builder @Getter @AllArgsConstructor @NoArgsConstructor diff --git a/src/main/java/umc/meme/shop/domain/favorite/repository/FavoriteArtistRepository.java b/src/main/java/umc/meme/shop/domain/favorite/repository/FavoriteArtistRepository.java index 9a451e4..46ba96b 100644 --- a/src/main/java/umc/meme/shop/domain/favorite/repository/FavoriteArtistRepository.java +++ b/src/main/java/umc/meme/shop/domain/favorite/repository/FavoriteArtistRepository.java @@ -1,6 +1,7 @@ package umc.meme.shop.domain.favorite.repository; import org.springframework.data.jpa.repository.JpaRepository; +import umc.meme.shop.domain.artist.entity.Artist; import umc.meme.shop.domain.favorite.entity.FavoriteArtist; import umc.meme.shop.domain.model.entity.Model; @@ -8,4 +9,5 @@ public interface FavoriteArtistRepository extends JpaRepository { List findByModel(Model model); + boolean existsByModelAndArtist(Model model, Artist artist); } diff --git a/src/main/java/umc/meme/shop/domain/favorite/repository/FavoritePortfolioRepository.java b/src/main/java/umc/meme/shop/domain/favorite/repository/FavoritePortfolioRepository.java index 80ea99d..cb884fd 100644 --- a/src/main/java/umc/meme/shop/domain/favorite/repository/FavoritePortfolioRepository.java +++ b/src/main/java/umc/meme/shop/domain/favorite/repository/FavoritePortfolioRepository.java @@ -1,11 +1,14 @@ package umc.meme.shop.domain.favorite.repository; import org.springframework.data.jpa.repository.JpaRepository; +import umc.meme.shop.domain.artist.entity.Artist; import umc.meme.shop.domain.favorite.entity.FavoritePortfolio; import umc.meme.shop.domain.model.entity.Model; +import umc.meme.shop.domain.portfolio.entity.Portfolio; import java.util.List; public interface FavoritePortfolioRepository extends JpaRepository { List findByModel(Model model); + boolean existsByModelAndPortfolio(Model model, Portfolio portfolio); } diff --git a/src/main/java/umc/meme/shop/domain/model/controller/ModelController.java b/src/main/java/umc/meme/shop/domain/model/controller/ModelController.java index dd47f6e..f66755f 100644 --- a/src/main/java/umc/meme/shop/domain/model/controller/ModelController.java +++ b/src/main/java/umc/meme/shop/domain/model/controller/ModelController.java @@ -3,7 +3,6 @@ import io.swagger.v3.oas.annotations.Operation; import lombok.RequiredArgsConstructor; import org.springframework.web.bind.annotation.*; -import org.springframework.web.multipart.MultipartFile; import umc.meme.shop.domain.model.dto.request.ModelProfileDto; import umc.meme.shop.domain.model.service.ModelService; import umc.meme.shop.domain.review.dto.request.ReviewDto; @@ -28,16 +27,32 @@ public ApiResponse profile (@PathVariable Long userId, @Operation(summary = "관심 아티스트 조회", description = "관심 아티스트를 조회하는 API입니다.") @GetMapping("/mypage/{userId}/favorite/artist") - public ApiResponse favoriteArtist(@PathVariable Long userId){ + public ApiResponse getFavoriteArtist(@PathVariable Long userId){ return ApiResponse.SuccessResponse(SuccessStatus.FAVORITE_ARTIST_GET, modelService.getFavoriteArtist(userId)); } @Operation(summary = "관심 메이크업 조회", description = "관심 메이크업을 조회하는 API입니다.") @GetMapping("/mypage/{userId}/favorite/portfolio") - public ApiResponse favoritePortfolio(@PathVariable Long userId){ + public ApiResponse getFavoritePortfolio(@PathVariable Long userId){ return ApiResponse.SuccessResponse(SuccessStatus.FAVORITE_PORTFOLIO_GET, modelService.getFavoritePortfolio(userId)); } + @Operation(summary = "관심 아티스트 추가", description = "관심 아티스트를 추가하는 API입니다.") + @PostMapping("/mypage/{userId}/favorite/artist") + public ApiResponse postFavoriteArtist(@PathVariable Long userId, @RequestParam Long artistId) { + modelService.addFavoriteArtist(userId, artistId); + return ApiResponse.SuccessResponse(SuccessStatus.FAVORITE_ARTIST_POST); + } + + @Operation(summary = "관심 메이크업 추가", description = "관심 메이크업을 추가하는 API입니다.") + @PostMapping("/mypage/{userId}/favorite/portfolio") + public ApiResponse postFavoritePortfolio(@PathVariable Long userId, @RequestParam Long portfolioId) { + modelService.addFavoritePortfolio(userId, portfolioId); + return ApiResponse.SuccessResponse(SuccessStatus.FAVORITE_PORTFOLIO_POST); + } + + + /**review**/ @Operation(summary = "내가 쓴 리뷰 조회", description = "본인이 쓴 리뷰를 조회하는 API입니다.") diff --git a/src/main/java/umc/meme/shop/domain/model/service/ModelService.java b/src/main/java/umc/meme/shop/domain/model/service/ModelService.java index 7c35667..07bf126 100644 --- a/src/main/java/umc/meme/shop/domain/model/service/ModelService.java +++ b/src/main/java/umc/meme/shop/domain/model/service/ModelService.java @@ -4,6 +4,9 @@ import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; import umc.meme.shop.domain.artist.dto.response.ArtistDto; +import umc.meme.shop.domain.artist.entity.Artist; +import umc.meme.shop.domain.artist.repository.ArtistRepository; +import umc.meme.shop.domain.favorite.dto.request.FavoriteArtistDto; import umc.meme.shop.domain.favorite.entity.FavoriteArtist; import umc.meme.shop.domain.favorite.entity.FavoritePortfolio; import umc.meme.shop.domain.favorite.repository.FavoriteArtistRepository; @@ -12,6 +15,8 @@ import umc.meme.shop.domain.model.entity.Model; import umc.meme.shop.domain.model.repository.ModelRepository; import umc.meme.shop.domain.portfolio.dto.response.PortfolioDto; +import umc.meme.shop.domain.portfolio.entity.Portfolio; +import umc.meme.shop.domain.portfolio.repository.PortfolioRepository; import umc.meme.shop.global.ErrorStatus; import umc.meme.shop.global.exception.GlobalException; @@ -22,8 +27,11 @@ @RequiredArgsConstructor public class ModelService { private final ModelRepository modelRepository; + private final ArtistRepository artistRepository; private final FavoriteArtistRepository favoriteArtistRepository; private final FavoritePortfolioRepository favoritePortfolioRepository; + private final PortfolioRepository portfolioRepository; + //모델 프로필 관리 @Transactional @@ -55,4 +63,49 @@ public List getFavoritePortfolio(Long userId){ .collect(Collectors.toList()); } + //관심 아티스트 추가 + @Transactional + public void addFavoriteArtist(Long modelId, Long artistId) { + Model model = modelRepository.findById(modelId) + .orElseThrow(() -> new GlobalException(ErrorStatus.NOT_EXIST_USER)); + + Artist artist = artistRepository.findById(artistId) + .orElseThrow(() -> new GlobalException(ErrorStatus.NOT_EXIST_USER)); + + //이미 관심 아티스트가 존재하는 경우 + if (favoriteArtistRepository.existsByModelAndArtist(model, artist)) { + throw new GlobalException(ErrorStatus.ALREADY_EXIST_FAVORITE_ARTIST); + } + + FavoriteArtist favoriteArtist = FavoriteArtist.builder() + .artist(artist) + .model(model) + .favoriteArtistId(artistId) + .build(); + + favoriteArtistRepository.save(favoriteArtist); + } + + //관심 메이크업 추가 + public void addFavoritePortfolio(Long modelId, Long portfolioId) { + Model model = modelRepository.findById(modelId) + .orElseThrow(() -> new GlobalException(ErrorStatus.NOT_EXIST_USER)); + + Portfolio portfolio = portfolioRepository.findById(portfolioId) + .orElseThrow(() -> new GlobalException(ErrorStatus.NOT_EXIST_PORTFOLIO)); + + if (favoritePortfolioRepository.existsByModelAndPortfolio(model,portfolio)) { + throw new GlobalException(ErrorStatus.ALREADY_EXIST_FAVORITE_PORTFOLIO); + } + + FavoritePortfolio favoritePortfolio = FavoritePortfolio.builder() + .model(model) + .portfolio(portfolio) + .build(); + + favoritePortfolioRepository.save(favoritePortfolio); + } + + + } diff --git a/src/main/java/umc/meme/shop/domain/reservation/controller/ReservationController.java b/src/main/java/umc/meme/shop/domain/reservation/controller/ReservationController.java index bcd88b6..adde09b 100644 --- a/src/main/java/umc/meme/shop/domain/reservation/controller/ReservationController.java +++ b/src/main/java/umc/meme/shop/domain/reservation/controller/ReservationController.java @@ -35,12 +35,17 @@ public ApiResponse reservation(@RequestBody ReservationRequestDto reservationDto return ApiResponse.SuccessResponse(SuccessStatus.RESERVATION_CREATE); } - //아티스트 얘약 조회 + //아티스트 예약 조회 @Operation(summary = "예약 조회", description = "예약 정보를 조회하는 API입니다.") @GetMapping("/{userId}/artist") - public ApiResponse getReservation(@PathVariable Long userId){ + public ApiResponse getArtistReservation(@PathVariable Long userId){ return ApiResponse.SuccessResponse(SuccessStatus.RESERVATION_GET, reservationService.getReservation(userId)); } //모델 예약 조회 + @Operation(summary = "예약 조회", description = "예약 정보를 조회하는 API입니다.") + @GetMapping("/{userId}/model") + public ApiResponse getModelReservation(@PathVariable Long userId){ + return ApiResponse.SuccessResponse(SuccessStatus.RESERVATION_GET, reservationService.getReservation(userId)); + } } diff --git a/src/main/java/umc/meme/shop/global/ErrorStatus.java b/src/main/java/umc/meme/shop/global/ErrorStatus.java index d50e397..a068b33 100644 --- a/src/main/java/umc/meme/shop/global/ErrorStatus.java +++ b/src/main/java/umc/meme/shop/global/ErrorStatus.java @@ -25,6 +25,8 @@ public enum ErrorStatus { * Bad Request */ INVALID_REQUEST(400, "유효하지 않은 요청입니다."), + ALREADY_EXIST_FAVORITE_ARTIST(400, "이미 관심 아티스트로 등록하셨습니다."), + ALREADY_EXIST_FAVORITE_PORTFOLIO(400, "이미 관심 포트폴리오로 등록하셨습니다."), /** * Code : 404 @@ -35,6 +37,7 @@ public enum ErrorStatus { NOT_EXIST_RESERVATION(404, "존재하지 않는 예약입니다."), PAGE_NOT_FOUND(404,"페이지를 찾을 수 없습니다"); + private final int code; private final String message; } diff --git a/src/main/java/umc/meme/shop/global/SuccessStatus.java b/src/main/java/umc/meme/shop/global/SuccessStatus.java index 6092369..4315bd1 100644 --- a/src/main/java/umc/meme/shop/global/SuccessStatus.java +++ b/src/main/java/umc/meme/shop/global/SuccessStatus.java @@ -22,6 +22,8 @@ public enum SuccessStatus { FAVORITE_ARTIST_GET(200, "관심 아티스트 조회가 완료되었습니다"), FAVORITE_PORTFOLIO_GET(200, "관심 메이크업 조회가 완료되었습니다"), + FAVORITE_ARTIST_POST(200, "관심 아티스트 추가가 완료되었습니다."), + FAVORITE_PORTFOLIO_POST(200, "관심 메이크업 추가가 완료되었습니다."), SEARCH_GET(200, "조회가 완료되었습니다"),