From 7179f0678634377d1cfa177117440317ef188c94 Mon Sep 17 00:00:00 2001 From: JunsuPark Date: Sat, 22 Jun 2024 01:36:07 +0900 Subject: [PATCH] =?UTF-8?q?feat=20:=20=EC=97=94=ED=8B=B0=ED=8B=B0=20?= =?UTF-8?q?=EC=84=B8=ED=8C=85=20(#22)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/org/example/filter/JWTFilter.java | 2 - .../dto/request/LoginApiRequest.java | 12 +++--- .../dto/request/LoginServiceRequest.java | 6 +-- app/domain/show-domain/build.gradle | 9 ++++ .../org/example/entity/artist/Artist.java | 26 ++++++++++++ .../example/entity/artist/ArtistSearch.java | 26 ++++++++++++ .../java/org/example/entity/genre/Genre.java | 20 +++++++++ .../java/org/example/entity/show/Show.java | 41 +++++++++++++++++++ .../org/example/entity/show/ShowArtist.java | 23 +++++++++++ .../org/example/entity/show/ShowGenre.java | 24 +++++++++++ .../org/example/entity/show/ShowSearch.java | 27 ++++++++++++ .../example/entity/show/info/SeatPrice.java | 20 +++++++++ .../example/entity/show/info/Ticketing.java | 23 +++++++++++ .../java/org/example/entity/InterestShow.java | 23 +++++++++++ .../org/example/entity/SubscribeArtist.java | 24 +++++++++++ .../org/example/entity/SubscribeGenre.java | 22 ++++++++++ .../org/example/entity/TicketingAlert.java | 29 +++++++++++++ .../main/java/org/example/entity/User.java | 8 ++-- ...ntials.java => SocialLoginCredential.java} | 8 ++-- settings.gradle | 1 + 20 files changed, 355 insertions(+), 19 deletions(-) create mode 100644 app/domain/show-domain/build.gradle create mode 100644 app/domain/show-domain/src/main/java/org/example/entity/artist/Artist.java create mode 100644 app/domain/show-domain/src/main/java/org/example/entity/artist/ArtistSearch.java create mode 100644 app/domain/show-domain/src/main/java/org/example/entity/genre/Genre.java create mode 100644 app/domain/show-domain/src/main/java/org/example/entity/show/Show.java create mode 100644 app/domain/show-domain/src/main/java/org/example/entity/show/ShowArtist.java create mode 100644 app/domain/show-domain/src/main/java/org/example/entity/show/ShowGenre.java create mode 100644 app/domain/show-domain/src/main/java/org/example/entity/show/ShowSearch.java create mode 100644 app/domain/show-domain/src/main/java/org/example/entity/show/info/SeatPrice.java create mode 100644 app/domain/show-domain/src/main/java/org/example/entity/show/info/Ticketing.java create mode 100644 app/domain/user-domain/src/main/java/org/example/entity/InterestShow.java create mode 100644 app/domain/user-domain/src/main/java/org/example/entity/SubscribeArtist.java create mode 100644 app/domain/user-domain/src/main/java/org/example/entity/SubscribeGenre.java create mode 100644 app/domain/user-domain/src/main/java/org/example/entity/TicketingAlert.java rename app/domain/user-domain/src/main/java/org/example/entity/credential/{SocialCredentials.java => SocialLoginCredential.java} (68%) diff --git a/app/api/common-api/src/main/java/org/example/filter/JWTFilter.java b/app/api/common-api/src/main/java/org/example/filter/JWTFilter.java index a6a65152..4fdf865e 100644 --- a/app/api/common-api/src/main/java/org/example/filter/JWTFilter.java +++ b/app/api/common-api/src/main/java/org/example/filter/JWTFilter.java @@ -13,7 +13,6 @@ import org.example.security.dto.AuthenticatedUser; import org.example.security.dto.TokenParam; import org.example.security.dto.UserParam; -import org.example.security.token.JWTGenerator; import org.example.security.token.JWTHandler; import org.example.security.token.RefreshTokenProcessor; import org.example.security.vo.TokenError; @@ -28,7 +27,6 @@ public class JWTFilter extends OncePerRequestFilter { private final JWTHandler jwtHandler; - private final JWTGenerator jwtGenerator; private final RefreshTokenProcessor refreshTokenProcessor; private final TokenRepository tokenRepository; diff --git a/app/api/user-api/src/main/java/org/example/controller/dto/request/LoginApiRequest.java b/app/api/user-api/src/main/java/org/example/controller/dto/request/LoginApiRequest.java index 5397e520..c60612ea 100644 --- a/app/api/user-api/src/main/java/org/example/controller/dto/request/LoginApiRequest.java +++ b/app/api/user-api/src/main/java/org/example/controller/dto/request/LoginApiRequest.java @@ -5,7 +5,7 @@ import org.example.entity.credential.GoogleSocialCredential; import org.example.entity.credential.KakaoSocialCredential; import org.example.entity.credential.SocialCredential; -import org.example.entity.credential.SocialCredentials; +import org.example.entity.credential.SocialLoginCredential; import org.example.service.dto.request.LoginServiceRequest; import org.example.vo.SocialLoginType; @@ -19,14 +19,14 @@ public record LoginApiRequest( public LoginServiceRequest toLoginServiceRequest() { return LoginServiceRequest.builder() - .socialCredentials(socialCredentials()) + .socialLoginCredential(socialLoginCredential()) .build(); } - private SocialCredentials socialCredentials() { - SocialCredentials socialCredentials = new SocialCredentials(); - socialCredentials.saveCredentials(socialLoginType, socialCredential()); - return socialCredentials; + private SocialLoginCredential socialLoginCredential() { + SocialLoginCredential socialLoginCredential = new SocialLoginCredential(); + socialLoginCredential.saveCredentials(socialLoginType, socialCredential()); + return socialLoginCredential; } private SocialCredential socialCredential() { diff --git a/app/api/user-api/src/main/java/org/example/service/dto/request/LoginServiceRequest.java b/app/api/user-api/src/main/java/org/example/service/dto/request/LoginServiceRequest.java index c6731401..2dd9e7cf 100644 --- a/app/api/user-api/src/main/java/org/example/service/dto/request/LoginServiceRequest.java +++ b/app/api/user-api/src/main/java/org/example/service/dto/request/LoginServiceRequest.java @@ -2,16 +2,16 @@ import lombok.Builder; import org.example.entity.User; -import org.example.entity.credential.SocialCredentials; +import org.example.entity.credential.SocialLoginCredential; @Builder public record LoginServiceRequest( - SocialCredentials socialCredentials + SocialLoginCredential socialLoginCredential ) { public User toUser() { return User.builder() - .socialCredentials(socialCredentials) + .socialLoginCredential(socialLoginCredential) .build(); } } diff --git a/app/domain/show-domain/build.gradle b/app/domain/show-domain/build.gradle new file mode 100644 index 00000000..113bb5b1 --- /dev/null +++ b/app/domain/show-domain/build.gradle @@ -0,0 +1,9 @@ +bootJar.enabled = false +jar.enabled = true + +dependencies { + implementation project(":app:domain:common-domain") + + // hypersistence utils + implementation 'io.hypersistence:hypersistence-utils-hibernate-63:3.7.6' +} diff --git a/app/domain/show-domain/src/main/java/org/example/entity/artist/Artist.java b/app/domain/show-domain/src/main/java/org/example/entity/artist/Artist.java new file mode 100644 index 00000000..8341edf4 --- /dev/null +++ b/app/domain/show-domain/src/main/java/org/example/entity/artist/Artist.java @@ -0,0 +1,26 @@ +package org.example.entity.artist; + +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.Table; +import lombok.AccessLevel; +import lombok.Getter; +import lombok.NoArgsConstructor; +import org.example.entity.BaseEntity; + +@Entity +@Getter +@NoArgsConstructor(access = AccessLevel.PROTECTED) +@Table(name = "app_artist") +public class Artist extends BaseEntity { + + @Column(name = "english_name", nullable = false) + private String englishName; + + @Column(name = "korean_name", nullable = false) + private String koreanName; + + @Column(name = "country", nullable = false) + private String country; + +} diff --git a/app/domain/show-domain/src/main/java/org/example/entity/artist/ArtistSearch.java b/app/domain/show-domain/src/main/java/org/example/entity/artist/ArtistSearch.java new file mode 100644 index 00000000..08f46671 --- /dev/null +++ b/app/domain/show-domain/src/main/java/org/example/entity/artist/ArtistSearch.java @@ -0,0 +1,26 @@ +package org.example.entity.artist; + +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.FetchType; +import jakarta.persistence.JoinColumn; +import jakarta.persistence.ManyToOne; +import jakarta.persistence.Table; +import lombok.AccessLevel; +import lombok.Getter; +import lombok.NoArgsConstructor; +import org.example.entity.BaseEntity; + +@Entity +@Getter +@NoArgsConstructor(access = AccessLevel.PROTECTED) +@Table(name = "app_artist_search") +public class ArtistSearch extends BaseEntity { + + @Column(name = "name", nullable = false) + private String name; + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "artist_id") + private Artist artist; +} diff --git a/app/domain/show-domain/src/main/java/org/example/entity/genre/Genre.java b/app/domain/show-domain/src/main/java/org/example/entity/genre/Genre.java new file mode 100644 index 00000000..a5f49dbd --- /dev/null +++ b/app/domain/show-domain/src/main/java/org/example/entity/genre/Genre.java @@ -0,0 +1,20 @@ +package org.example.entity.genre; + +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.Table; +import lombok.AccessLevel; +import lombok.Getter; +import lombok.NoArgsConstructor; +import org.example.entity.BaseEntity; + +@Entity +@Getter +@NoArgsConstructor(access = AccessLevel.PROTECTED) +@Table(name = "app_genre") +public class Genre extends BaseEntity { + + @Column(name = "name", nullable = false) + private String name; + +} diff --git a/app/domain/show-domain/src/main/java/org/example/entity/show/Show.java b/app/domain/show-domain/src/main/java/org/example/entity/show/Show.java new file mode 100644 index 00000000..41d56813 --- /dev/null +++ b/app/domain/show-domain/src/main/java/org/example/entity/show/Show.java @@ -0,0 +1,41 @@ +package org.example.entity.show; + +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.Enumerated; +import jakarta.persistence.Table; +import java.time.LocalDate; +import lombok.AccessLevel; +import lombok.Getter; +import lombok.NoArgsConstructor; +import org.example.entity.BaseEntity; +import org.example.entity.show.info.SeatPrice; +import org.example.entity.show.info.Ticketing; + +@Entity +@Getter +@NoArgsConstructor(access = AccessLevel.PROTECTED) +@Table(name = "app_show") +public class Show extends BaseEntity { + + @Column(name = "title", nullable = false) + private String title; + + @Column(name = "content", nullable = false) + private String content; + + @Column(name = "date", nullable = false) + private LocalDate date; + + @Column(name = "location", nullable = false) + private String location; + + @Column(name = "image", nullable = false) + private String image; + + @Enumerated + private SeatPrice seatPrice; + + @Enumerated + private Ticketing ticketing; +} \ No newline at end of file diff --git a/app/domain/show-domain/src/main/java/org/example/entity/show/ShowArtist.java b/app/domain/show-domain/src/main/java/org/example/entity/show/ShowArtist.java new file mode 100644 index 00000000..1faedf8e --- /dev/null +++ b/app/domain/show-domain/src/main/java/org/example/entity/show/ShowArtist.java @@ -0,0 +1,23 @@ +package org.example.entity.show; + +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.Table; +import java.util.UUID; +import lombok.AccessLevel; +import lombok.Getter; +import lombok.NoArgsConstructor; +import org.example.entity.BaseEntity; + +@Entity +@Getter +@NoArgsConstructor(access = AccessLevel.PROTECTED) +@Table(name = "app_show_artist") +public class ShowArtist extends BaseEntity { + + @Column(name = "show_id", nullable = false) + private UUID showId; + + @Column(name = "artist_id", nullable = false) + private UUID artistId; +} diff --git a/app/domain/show-domain/src/main/java/org/example/entity/show/ShowGenre.java b/app/domain/show-domain/src/main/java/org/example/entity/show/ShowGenre.java new file mode 100644 index 00000000..aaf74717 --- /dev/null +++ b/app/domain/show-domain/src/main/java/org/example/entity/show/ShowGenre.java @@ -0,0 +1,24 @@ +package org.example.entity.show; + +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.Table; +import java.util.UUID; +import lombok.AccessLevel; +import lombok.Getter; +import lombok.NoArgsConstructor; +import org.example.entity.BaseEntity; + +@Entity +@Getter +@NoArgsConstructor(access = AccessLevel.PROTECTED) +@Table(name = "app_show_genre") +public class ShowGenre extends BaseEntity { + + @Column(name = "show_id", nullable = false) + private UUID showId; + + @Column(name = "genre_id", nullable = false) + private UUID genreId; + +} \ No newline at end of file diff --git a/app/domain/show-domain/src/main/java/org/example/entity/show/ShowSearch.java b/app/domain/show-domain/src/main/java/org/example/entity/show/ShowSearch.java new file mode 100644 index 00000000..c7e3f923 --- /dev/null +++ b/app/domain/show-domain/src/main/java/org/example/entity/show/ShowSearch.java @@ -0,0 +1,27 @@ +package org.example.entity.show; + +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.FetchType; +import jakarta.persistence.JoinColumn; +import jakarta.persistence.ManyToOne; +import jakarta.persistence.Table; +import lombok.AccessLevel; +import lombok.Getter; +import lombok.NoArgsConstructor; +import org.example.entity.BaseEntity; + +@Entity +@Getter +@NoArgsConstructor(access = AccessLevel.PROTECTED) +@Table(name = "app_show_search") +public class ShowSearch extends BaseEntity { + + @Column(name = "name", nullable = false) + private String name; + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "show_id") + private Show show; + +} diff --git a/app/domain/show-domain/src/main/java/org/example/entity/show/info/SeatPrice.java b/app/domain/show-domain/src/main/java/org/example/entity/show/info/SeatPrice.java new file mode 100644 index 00000000..e3094ade --- /dev/null +++ b/app/domain/show-domain/src/main/java/org/example/entity/show/info/SeatPrice.java @@ -0,0 +1,20 @@ +package org.example.entity.show.info; + +import io.hypersistence.utils.hibernate.type.json.JsonType; +import jakarta.persistence.Column; +import jakarta.persistence.Embeddable; +import java.util.HashMap; +import java.util.Map; +import org.hibernate.annotations.Type; + +@Embeddable +public class SeatPrice { + + @Type(JsonType.class) + @Column(name = "seat_price", columnDefinition = "jsonb", nullable = false) + private Map priceInformation = new HashMap<>(); + + public void savePriceInformation(String seatType, Integer price) { + priceInformation.put(seatType, price); + } +} diff --git a/app/domain/show-domain/src/main/java/org/example/entity/show/info/Ticketing.java b/app/domain/show-domain/src/main/java/org/example/entity/show/info/Ticketing.java new file mode 100644 index 00000000..6751e69d --- /dev/null +++ b/app/domain/show-domain/src/main/java/org/example/entity/show/info/Ticketing.java @@ -0,0 +1,23 @@ +package org.example.entity.show.info; + +import io.hypersistence.utils.hibernate.type.json.JsonType; +import jakarta.persistence.Column; +import jakarta.persistence.Embeddable; +import java.util.HashMap; +import java.util.Map; +import org.hibernate.annotations.Type; + +@Embeddable +public class Ticketing { + + @Type(JsonType.class) + @Column(name = "ticketing", columnDefinition = "jsonb", nullable = false) + private Map ticketingInformation = new HashMap<>(); + + public void saveTicketingInformation( + String ticketBookingSite, + String ticketingSiteUrl + ) { + ticketingInformation.put(ticketBookingSite, ticketingSiteUrl); + } +} diff --git a/app/domain/user-domain/src/main/java/org/example/entity/InterestShow.java b/app/domain/user-domain/src/main/java/org/example/entity/InterestShow.java new file mode 100644 index 00000000..edd81e2e --- /dev/null +++ b/app/domain/user-domain/src/main/java/org/example/entity/InterestShow.java @@ -0,0 +1,23 @@ +package org.example.entity; + +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.Table; +import java.util.UUID; +import lombok.AccessLevel; +import lombok.Getter; +import lombok.NoArgsConstructor; + +@Entity +@Getter +@NoArgsConstructor(access = AccessLevel.PROTECTED) +@Table(name = "app_interest_show") +public class InterestShow extends BaseEntity { + + @Column(name = "user_id", nullable = false) + private UUID userId; + + @Column(name = "show_id", nullable = false) + private UUID showId; + +} diff --git a/app/domain/user-domain/src/main/java/org/example/entity/SubscribeArtist.java b/app/domain/user-domain/src/main/java/org/example/entity/SubscribeArtist.java new file mode 100644 index 00000000..18740e77 --- /dev/null +++ b/app/domain/user-domain/src/main/java/org/example/entity/SubscribeArtist.java @@ -0,0 +1,24 @@ +package org.example.entity; + + +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.Table; +import java.util.UUID; +import lombok.AccessLevel; +import lombok.Getter; +import lombok.NoArgsConstructor; + +@Entity +@Getter +@NoArgsConstructor(access = AccessLevel.PROTECTED) +@Table(name = "app_subscribe_artist") +public class SubscribeArtist extends BaseEntity { + + @Column(name = "user_id", nullable = false) + private UUID userId; + + @Column(name = "artist_id", nullable = false) + private UUID artistId; + +} diff --git a/app/domain/user-domain/src/main/java/org/example/entity/SubscribeGenre.java b/app/domain/user-domain/src/main/java/org/example/entity/SubscribeGenre.java new file mode 100644 index 00000000..f3f426d1 --- /dev/null +++ b/app/domain/user-domain/src/main/java/org/example/entity/SubscribeGenre.java @@ -0,0 +1,22 @@ +package org.example.entity; + +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.Table; +import java.util.UUID; +import lombok.AccessLevel; +import lombok.Getter; +import lombok.NoArgsConstructor; + +@Entity +@Getter +@NoArgsConstructor(access = AccessLevel.PROTECTED) +@Table(name = "app_subscribe_genre") +public class SubscribeGenre extends BaseEntity { + + @Column(name = "user_id", nullable = false) + private UUID userId; + + @Column(name = "genre_id", nullable = false) + private UUID genreId; +} diff --git a/app/domain/user-domain/src/main/java/org/example/entity/TicketingAlert.java b/app/domain/user-domain/src/main/java/org/example/entity/TicketingAlert.java new file mode 100644 index 00000000..43f6b6ea --- /dev/null +++ b/app/domain/user-domain/src/main/java/org/example/entity/TicketingAlert.java @@ -0,0 +1,29 @@ +package org.example.entity; + +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.Table; +import java.time.LocalDateTime; +import java.util.UUID; +import lombok.AccessLevel; +import lombok.Getter; +import lombok.NoArgsConstructor; + +@Entity +@Getter +@NoArgsConstructor(access = AccessLevel.PROTECTED) +@Table(name = "app_ticketing_alert") +public class TicketingAlert extends BaseEntity { + + @Column(name = "name", nullable = false) + private String name; + + @Column(name = "schedule_alert_time", nullable = false) + private LocalDateTime alertTime; + + @Column(name = "user_id", nullable = false) + private UUID userId; + + @Column(name = "show_id", nullable = false) + private UUID showId; +} diff --git a/app/domain/user-domain/src/main/java/org/example/entity/User.java b/app/domain/user-domain/src/main/java/org/example/entity/User.java index 872788b5..78c10f0c 100644 --- a/app/domain/user-domain/src/main/java/org/example/entity/User.java +++ b/app/domain/user-domain/src/main/java/org/example/entity/User.java @@ -11,7 +11,7 @@ import lombok.Builder; import lombok.Getter; import lombok.NoArgsConstructor; -import org.example.entity.credential.SocialCredentials; +import org.example.entity.credential.SocialLoginCredential; import org.example.vo.UserGender; import org.example.vo.UserRole; @@ -31,7 +31,7 @@ public class User extends BaseEntity { private String fcmToken; @Embedded - private SocialCredentials socialCredentials; + private SocialLoginCredential socialLoginCredential; @Column(name = "gender", nullable = false) @Enumerated(value = EnumType.STRING) @@ -43,9 +43,9 @@ public class User extends BaseEntity { @Builder private User( - SocialCredentials socialCredentials + SocialLoginCredential socialLoginCredential ) { - this.socialCredentials = socialCredentials; + this.socialLoginCredential = socialLoginCredential; this.userRole = UserRole.USER; } } \ No newline at end of file diff --git a/app/domain/user-domain/src/main/java/org/example/entity/credential/SocialCredentials.java b/app/domain/user-domain/src/main/java/org/example/entity/credential/SocialLoginCredential.java similarity index 68% rename from app/domain/user-domain/src/main/java/org/example/entity/credential/SocialCredentials.java rename to app/domain/user-domain/src/main/java/org/example/entity/credential/SocialLoginCredential.java index 8a045bcc..2c1a5da4 100644 --- a/app/domain/user-domain/src/main/java/org/example/entity/credential/SocialCredentials.java +++ b/app/domain/user-domain/src/main/java/org/example/entity/credential/SocialLoginCredential.java @@ -9,13 +9,13 @@ import org.hibernate.annotations.Type; @Embeddable -public class SocialCredentials { +public class SocialLoginCredential { @Type(JsonType.class) - @Column(name = "social_credentials", columnDefinition = "jsonb", nullable = false) - private Map socialLoginTypeCredentials = new HashMap<>(); + @Column(name = "social_login_credential", columnDefinition = "jsonb", nullable = false) + private Map socialLoginTypeCredential = new HashMap<>(); public void saveCredentials(SocialLoginType socialLoginType, SocialCredential socialCredential) { - socialLoginTypeCredentials.put(socialLoginType, socialCredential); + socialLoginTypeCredential.put(socialLoginType, socialCredential); } } diff --git a/settings.gradle b/settings.gradle index cf1fdd70..7239040f 100644 --- a/settings.gradle +++ b/settings.gradle @@ -7,6 +7,7 @@ include(":app") include(":app:domain") include (":app:domain:common-domain") include(":app:domain:user-domain") +include (":app:domain:show-domain") include(":app:api") include (":app:api:common-api")