Skip to content

Commit

Permalink
feat : 엔티티 세팅 (#22)
Browse files Browse the repository at this point in the history
  • Loading branch information
GaBaljaintheroom authored Jun 21, 2024
1 parent 7c1ef11 commit 7179f06
Show file tree
Hide file tree
Showing 20 changed files with 355 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}
9 changes: 9 additions & 0 deletions app/domain/show-domain/build.gradle
Original file line number Diff line number Diff line change
@@ -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'
}
Original file line number Diff line number Diff line change
@@ -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;

}
Original file line number Diff line number Diff line change
@@ -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;
}
Original file line number Diff line number Diff line change
@@ -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;

}
Original file line number Diff line number Diff line change
@@ -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;
}
Original file line number Diff line number Diff line change
@@ -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;
}
Original file line number Diff line number Diff line change
@@ -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;

}
Original file line number Diff line number Diff line change
@@ -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;

}
Original file line number Diff line number Diff line change
@@ -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<String, Integer> priceInformation = new HashMap<>();

public void savePriceInformation(String seatType, Integer price) {
priceInformation.put(seatType, price);
}
}
Original file line number Diff line number Diff line change
@@ -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<String, String> ticketingInformation = new HashMap<>();

public void saveTicketingInformation(
String ticketBookingSite,
String ticketingSiteUrl
) {
ticketingInformation.put(ticketBookingSite, ticketingSiteUrl);
}
}
Original file line number Diff line number Diff line change
@@ -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;

}
Original file line number Diff line number Diff line change
@@ -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;

}
Original file line number Diff line number Diff line change
@@ -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;
}
Loading

0 comments on commit 7179f06

Please sign in to comment.