From e57fcb116d4787c8a382352ca8d61cfd1c8983d2 Mon Sep 17 00:00:00 2001 From: Parkjyun <98092394+Parkjyun@users.noreply.github.com> Date: Thu, 4 Jul 2024 18:29:13 +0900 Subject: [PATCH] =?UTF-8?q?[feat]=20=20database=20=EC=B4=88=EA=B8=B0=20?= =?UTF-8?q?=EC=97=94=ED=8B=B0=ED=8B=B0=20=EA=B5=AC=EC=84=B1=20=EB=B0=8F=20?= =?UTF-8?q?=EA=B0=9C=EB=B0=9C=20(#7)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * [feat] create enum types for domain * [feat] create basetimeentity for domain * [feat] create Store jpa entity and repository * [feat] create User jpa entity and repository * [feat] create University jpa entity and repository * [feat] create Menu jpa entity and repository * [feat] create Report jpa entity and repository * [feat] create Heart jpa entity and repository * [feat] create Favorite jpa entity and repository --- .../domain/common/BaseCreatedAtEntity.java | 19 ++++++++ .../domain/common/BaseTimeEntity.java | 23 +++++++++ .../hankkiserver/domain/common/Point.java | 15 ++++++ .../domain/config/JpaAuditingConfig.java | 9 ++++ .../domain/favorite/model/Favorite.java | 32 +++++++++++++ .../repository/FavoriteRepository.java | 7 +++ .../favoritestore/model/FavoriteStore.java | 28 +++++++++++ .../repository/FavoriteStoreRepository.java | 7 +++ .../domain/heart/model/Heart.java | 28 +++++++++++ .../heart/repository/HeartRepository.java | 7 +++ .../hankkiserver/domain/menu/model/Menu.java | 30 ++++++++++++ .../menu/repository/MenuRepository.java | 7 +++ .../domain/report/model/Report.java | 34 +++++++++++++ .../report/repository/ReportRepository.java | 7 +++ .../domain/store/model/Store.java | 39 +++++++++++++++ .../domain/store/model/StoreCategory.java | 22 +++++++++ .../domain/store/model/StoreImage.java | 26 ++++++++++ .../repository/StoreImageRepository.java | 7 +++ .../store/repository/StoreRepository.java | 7 +++ .../domain/university/model/University.java | 25 ++++++++++ .../repository/UniversityRepository.java | 7 +++ .../model/UniversityStore.java | 28 +++++++++++ .../repository/UniversityStoreRepository.java | 7 +++ .../domain/user/model/MemberStatus.java | 14 ++++++ .../domain/user/model/Platform.java | 14 ++++++ .../hankkiserver/domain/user/model/User.java | 48 +++++++++++++++++++ .../domain/user/model/UserInfo.java | 26 ++++++++++ .../domain/user/model/UserRole.java | 14 ++++++ .../user/repository/UserInfoRepository.java | 7 +++ .../user/repository/UserRepository.java | 7 +++ 30 files changed, 551 insertions(+) create mode 100644 src/main/java/org/hankki/hankkiserver/domain/common/BaseCreatedAtEntity.java create mode 100644 src/main/java/org/hankki/hankkiserver/domain/common/BaseTimeEntity.java create mode 100644 src/main/java/org/hankki/hankkiserver/domain/common/Point.java create mode 100644 src/main/java/org/hankki/hankkiserver/domain/config/JpaAuditingConfig.java create mode 100644 src/main/java/org/hankki/hankkiserver/domain/favorite/model/Favorite.java create mode 100644 src/main/java/org/hankki/hankkiserver/domain/favorite/repository/FavoriteRepository.java create mode 100644 src/main/java/org/hankki/hankkiserver/domain/favoritestore/model/FavoriteStore.java create mode 100644 src/main/java/org/hankki/hankkiserver/domain/favoritestore/repository/FavoriteStoreRepository.java create mode 100644 src/main/java/org/hankki/hankkiserver/domain/heart/model/Heart.java create mode 100644 src/main/java/org/hankki/hankkiserver/domain/heart/repository/HeartRepository.java create mode 100644 src/main/java/org/hankki/hankkiserver/domain/menu/model/Menu.java create mode 100644 src/main/java/org/hankki/hankkiserver/domain/menu/repository/MenuRepository.java create mode 100644 src/main/java/org/hankki/hankkiserver/domain/report/model/Report.java create mode 100644 src/main/java/org/hankki/hankkiserver/domain/report/repository/ReportRepository.java create mode 100644 src/main/java/org/hankki/hankkiserver/domain/store/model/Store.java create mode 100644 src/main/java/org/hankki/hankkiserver/domain/store/model/StoreCategory.java create mode 100644 src/main/java/org/hankki/hankkiserver/domain/store/model/StoreImage.java create mode 100644 src/main/java/org/hankki/hankkiserver/domain/store/repository/StoreImageRepository.java create mode 100644 src/main/java/org/hankki/hankkiserver/domain/store/repository/StoreRepository.java create mode 100644 src/main/java/org/hankki/hankkiserver/domain/university/model/University.java create mode 100644 src/main/java/org/hankki/hankkiserver/domain/university/repository/UniversityRepository.java create mode 100644 src/main/java/org/hankki/hankkiserver/domain/universitystore/model/UniversityStore.java create mode 100644 src/main/java/org/hankki/hankkiserver/domain/universitystore/repository/UniversityStoreRepository.java create mode 100644 src/main/java/org/hankki/hankkiserver/domain/user/model/MemberStatus.java create mode 100644 src/main/java/org/hankki/hankkiserver/domain/user/model/Platform.java create mode 100644 src/main/java/org/hankki/hankkiserver/domain/user/model/User.java create mode 100644 src/main/java/org/hankki/hankkiserver/domain/user/model/UserInfo.java create mode 100644 src/main/java/org/hankki/hankkiserver/domain/user/model/UserRole.java create mode 100644 src/main/java/org/hankki/hankkiserver/domain/user/repository/UserInfoRepository.java create mode 100644 src/main/java/org/hankki/hankkiserver/domain/user/repository/UserRepository.java diff --git a/src/main/java/org/hankki/hankkiserver/domain/common/BaseCreatedAtEntity.java b/src/main/java/org/hankki/hankkiserver/domain/common/BaseCreatedAtEntity.java new file mode 100644 index 00000000..04650c4a --- /dev/null +++ b/src/main/java/org/hankki/hankkiserver/domain/common/BaseCreatedAtEntity.java @@ -0,0 +1,19 @@ +package org.hankki.hankkiserver.domain.common; + +import jakarta.persistence.Column; +import jakarta.persistence.EntityListeners; +import jakarta.persistence.MappedSuperclass; +import org.springframework.data.annotation.CreatedDate; +import org.springframework.data.jpa.domain.support.AuditingEntityListener; + +import java.time.LocalDateTime; + +@MappedSuperclass +@EntityListeners(AuditingEntityListener.class) +public abstract class BaseCreatedAtEntity { + + @CreatedDate + @Column(updatable = false) + private LocalDateTime createdAt; + +} diff --git a/src/main/java/org/hankki/hankkiserver/domain/common/BaseTimeEntity.java b/src/main/java/org/hankki/hankkiserver/domain/common/BaseTimeEntity.java new file mode 100644 index 00000000..a2e9ee18 --- /dev/null +++ b/src/main/java/org/hankki/hankkiserver/domain/common/BaseTimeEntity.java @@ -0,0 +1,23 @@ +package org.hankki.hankkiserver.domain.common; + +import jakarta.persistence.Column; +import jakarta.persistence.EntityListeners; +import jakarta.persistence.MappedSuperclass; +import org.springframework.data.annotation.CreatedDate; +import org.springframework.data.annotation.LastModifiedDate; +import org.springframework.data.jpa.domain.support.AuditingEntityListener; + +import java.time.LocalDateTime; + +@MappedSuperclass +@EntityListeners(AuditingEntityListener.class) +public abstract class BaseTimeEntity { + + @CreatedDate + @Column(updatable = false) + private LocalDateTime createdAt; + + @LastModifiedDate + private LocalDateTime updatedAt; + +} diff --git a/src/main/java/org/hankki/hankkiserver/domain/common/Point.java b/src/main/java/org/hankki/hankkiserver/domain/common/Point.java new file mode 100644 index 00000000..1fd12842 --- /dev/null +++ b/src/main/java/org/hankki/hankkiserver/domain/common/Point.java @@ -0,0 +1,15 @@ +package org.hankki.hankkiserver.domain.common; + +import jakarta.persistence.Column; +import jakarta.persistence.Embeddable; + +@Embeddable +public class Point { + + @Column(nullable = false) + private double latitude; + + @Column(nullable = false) + private double longitude; + +} diff --git a/src/main/java/org/hankki/hankkiserver/domain/config/JpaAuditingConfig.java b/src/main/java/org/hankki/hankkiserver/domain/config/JpaAuditingConfig.java new file mode 100644 index 00000000..4e5defc5 --- /dev/null +++ b/src/main/java/org/hankki/hankkiserver/domain/config/JpaAuditingConfig.java @@ -0,0 +1,9 @@ +package org.hankki.hankkiserver.domain.config; + +import org.springframework.context.annotation.Configuration; +import org.springframework.data.jpa.repository.config.EnableJpaAuditing; + +@Configuration +@EnableJpaAuditing +public class JpaAuditingConfig { +} diff --git a/src/main/java/org/hankki/hankkiserver/domain/favorite/model/Favorite.java b/src/main/java/org/hankki/hankkiserver/domain/favorite/model/Favorite.java new file mode 100644 index 00000000..8522f7e6 --- /dev/null +++ b/src/main/java/org/hankki/hankkiserver/domain/favorite/model/Favorite.java @@ -0,0 +1,32 @@ +package org.hankki.hankkiserver.domain.favorite.model; + +import jakarta.persistence.*; +import lombok.AccessLevel; +import lombok.Getter; +import lombok.NoArgsConstructor; +import org.hankki.hankkiserver.domain.common.BaseTimeEntity; +import org.hankki.hankkiserver.domain.user.model.User; + +@Entity +@Getter +@NoArgsConstructor(access = AccessLevel.PROTECTED) +public class Favorite extends BaseTimeEntity { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "favorite_id") + private Long id; + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "user_id") + private User user; + + @Column(nullable = false) + private String name; + + private String detail; + + @Column(nullable = false) + private String favorite_image_url; + +} diff --git a/src/main/java/org/hankki/hankkiserver/domain/favorite/repository/FavoriteRepository.java b/src/main/java/org/hankki/hankkiserver/domain/favorite/repository/FavoriteRepository.java new file mode 100644 index 00000000..07d21f28 --- /dev/null +++ b/src/main/java/org/hankki/hankkiserver/domain/favorite/repository/FavoriteRepository.java @@ -0,0 +1,7 @@ +package org.hankki.hankkiserver.domain.favorite.repository; + +import org.hankki.hankkiserver.domain.favorite.model.Favorite; +import org.springframework.data.jpa.repository.JpaRepository; + +public interface FavoriteRepository extends JpaRepository { +} diff --git a/src/main/java/org/hankki/hankkiserver/domain/favoritestore/model/FavoriteStore.java b/src/main/java/org/hankki/hankkiserver/domain/favoritestore/model/FavoriteStore.java new file mode 100644 index 00000000..3550fc07 --- /dev/null +++ b/src/main/java/org/hankki/hankkiserver/domain/favoritestore/model/FavoriteStore.java @@ -0,0 +1,28 @@ +package org.hankki.hankkiserver.domain.favoritestore.model; + +import jakarta.persistence.*; +import lombok.AccessLevel; +import lombok.Getter; +import lombok.NoArgsConstructor; +import org.hankki.hankkiserver.domain.favorite.model.Favorite; +import org.hankki.hankkiserver.domain.store.model.Store; + +@Entity +@Getter +@NoArgsConstructor(access = AccessLevel.PROTECTED) +public class FavoriteStore { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "favorite_store_id") + private Long id; + + @ManyToOne + @JoinColumn(name = "store_id") + private Store store; + + @ManyToOne + @JoinColumn(name = "favorite_id") + private Favorite favorite; + +} diff --git a/src/main/java/org/hankki/hankkiserver/domain/favoritestore/repository/FavoriteStoreRepository.java b/src/main/java/org/hankki/hankkiserver/domain/favoritestore/repository/FavoriteStoreRepository.java new file mode 100644 index 00000000..2340b52f --- /dev/null +++ b/src/main/java/org/hankki/hankkiserver/domain/favoritestore/repository/FavoriteStoreRepository.java @@ -0,0 +1,7 @@ +package org.hankki.hankkiserver.domain.favoritestore.repository; + +import org.hankki.hankkiserver.domain.favoritestore.model.FavoriteStore; +import org.springframework.data.jpa.repository.JpaRepository; + +public interface FavoriteStoreRepository extends JpaRepository { +} diff --git a/src/main/java/org/hankki/hankkiserver/domain/heart/model/Heart.java b/src/main/java/org/hankki/hankkiserver/domain/heart/model/Heart.java new file mode 100644 index 00000000..8623a22c --- /dev/null +++ b/src/main/java/org/hankki/hankkiserver/domain/heart/model/Heart.java @@ -0,0 +1,28 @@ +package org.hankki.hankkiserver.domain.heart.model; + +import jakarta.persistence.*; +import lombok.AccessLevel; +import lombok.Getter; +import lombok.NoArgsConstructor; +import org.hankki.hankkiserver.domain.store.model.Store; +import org.hankki.hankkiserver.domain.user.model.User; + +@Entity +@Getter +@NoArgsConstructor(access = AccessLevel.PROTECTED) +public class Heart { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "heart_id") + private Long id; + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "user_id") + private User user; + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "store_id") + private Store store; + +} diff --git a/src/main/java/org/hankki/hankkiserver/domain/heart/repository/HeartRepository.java b/src/main/java/org/hankki/hankkiserver/domain/heart/repository/HeartRepository.java new file mode 100644 index 00000000..ef846376 --- /dev/null +++ b/src/main/java/org/hankki/hankkiserver/domain/heart/repository/HeartRepository.java @@ -0,0 +1,7 @@ +package org.hankki.hankkiserver.domain.heart.repository; + +import org.hankki.hankkiserver.domain.heart.model.Heart; +import org.springframework.data.jpa.repository.JpaRepository; + +public interface HeartRepository extends JpaRepository { +} diff --git a/src/main/java/org/hankki/hankkiserver/domain/menu/model/Menu.java b/src/main/java/org/hankki/hankkiserver/domain/menu/model/Menu.java new file mode 100644 index 00000000..b2920a14 --- /dev/null +++ b/src/main/java/org/hankki/hankkiserver/domain/menu/model/Menu.java @@ -0,0 +1,30 @@ +package org.hankki.hankkiserver.domain.menu.model; + +import jakarta.persistence.*; +import lombok.AccessLevel; +import lombok.Getter; +import lombok.NoArgsConstructor; +import org.hankki.hankkiserver.domain.common.BaseTimeEntity; +import org.hankki.hankkiserver.domain.store.model.Store; + +@Entity +@Getter +@NoArgsConstructor(access = AccessLevel.PROTECTED) +public class Menu extends BaseTimeEntity { + + @Id + @GeneratedValue + @Column(name = "menu_id") + private Long id; + + @ManyToOne + @JoinColumn(name = "store_id") + private Store store; + + @Column(nullable = false) + private String name; + + @Column(nullable = false) + private int price; + +} diff --git a/src/main/java/org/hankki/hankkiserver/domain/menu/repository/MenuRepository.java b/src/main/java/org/hankki/hankkiserver/domain/menu/repository/MenuRepository.java new file mode 100644 index 00000000..6b801001 --- /dev/null +++ b/src/main/java/org/hankki/hankkiserver/domain/menu/repository/MenuRepository.java @@ -0,0 +1,7 @@ +package org.hankki.hankkiserver.domain.menu.repository; + +import org.hankki.hankkiserver.domain.menu.model.Menu; +import org.springframework.data.jpa.repository.JpaRepository; + +public interface MenuRepository extends JpaRepository { +} diff --git a/src/main/java/org/hankki/hankkiserver/domain/report/model/Report.java b/src/main/java/org/hankki/hankkiserver/domain/report/model/Report.java new file mode 100644 index 00000000..ffe2e835 --- /dev/null +++ b/src/main/java/org/hankki/hankkiserver/domain/report/model/Report.java @@ -0,0 +1,34 @@ +package org.hankki.hankkiserver.domain.report.model; + +import jakarta.persistence.*; +import lombok.AccessLevel; +import lombok.Getter; +import lombok.NoArgsConstructor; +import org.hankki.hankkiserver.domain.common.BaseCreatedAtEntity; +import org.hankki.hankkiserver.domain.store.model.Store; +import org.hankki.hankkiserver.domain.university.model.University; +import org.hankki.hankkiserver.domain.user.model.User; + +@Entity +@Getter +@NoArgsConstructor(access = AccessLevel.PROTECTED) +public class Report extends BaseCreatedAtEntity { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "report_id") + private Long id; + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "user_id") + private User user; + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "store_id") + private Store store; + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "university_id") + private University university; + +} diff --git a/src/main/java/org/hankki/hankkiserver/domain/report/repository/ReportRepository.java b/src/main/java/org/hankki/hankkiserver/domain/report/repository/ReportRepository.java new file mode 100644 index 00000000..e3a83419 --- /dev/null +++ b/src/main/java/org/hankki/hankkiserver/domain/report/repository/ReportRepository.java @@ -0,0 +1,7 @@ +package org.hankki.hankkiserver.domain.report.repository; + +import org.hankki.hankkiserver.domain.report.model.Report; +import org.springframework.data.jpa.repository.JpaRepository; + +public interface ReportRepository extends JpaRepository { +} diff --git a/src/main/java/org/hankki/hankkiserver/domain/store/model/Store.java b/src/main/java/org/hankki/hankkiserver/domain/store/model/Store.java new file mode 100644 index 00000000..8c4e05d6 --- /dev/null +++ b/src/main/java/org/hankki/hankkiserver/domain/store/model/Store.java @@ -0,0 +1,39 @@ +package org.hankki.hankkiserver.domain.store.model; + +import jakarta.persistence.*; +import lombok.AccessLevel; +import lombok.Getter; +import lombok.NoArgsConstructor; +import org.hankki.hankkiserver.domain.common.BaseTimeEntity; +import org.hankki.hankkiserver.domain.common.Point; + +@Entity +@Getter +@NoArgsConstructor(access = AccessLevel.PROTECTED) +public class Store extends BaseTimeEntity { + + @Id + @Column(name = "store_id") + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Long id; + + @Embedded + private Point point; + + @Column(nullable = false) + private String name; + + @Enumerated(EnumType.STRING) + @Column(nullable = false) + private StoreCategory category; + + @Column(nullable = false) + private int heartCount; + + @Column(nullable = false) + private int lowestPrice; + + @Column(nullable = false) + private boolean isDeleted; + +} diff --git a/src/main/java/org/hankki/hankkiserver/domain/store/model/StoreCategory.java b/src/main/java/org/hankki/hankkiserver/domain/store/model/StoreCategory.java new file mode 100644 index 00000000..8161c2fe --- /dev/null +++ b/src/main/java/org/hankki/hankkiserver/domain/store/model/StoreCategory.java @@ -0,0 +1,22 @@ +package org.hankki.hankkiserver.domain.store.model; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +@Getter +@AllArgsConstructor +public enum StoreCategory { + + KOREAN("한식"), + CHINESE("중식"), + JAPANESE("일식"), + WESTERN("양식"), + CONVENIENCEFOOD("간편식"), + BUNSIK("분식"), + SALAD("샐러드"), + FASTFOOD("패스트푸드"), + ETC("기타"); + + private final String name; + +} diff --git a/src/main/java/org/hankki/hankkiserver/domain/store/model/StoreImage.java b/src/main/java/org/hankki/hankkiserver/domain/store/model/StoreImage.java new file mode 100644 index 00000000..813aaf41 --- /dev/null +++ b/src/main/java/org/hankki/hankkiserver/domain/store/model/StoreImage.java @@ -0,0 +1,26 @@ +package org.hankki.hankkiserver.domain.store.model; + +import jakarta.persistence.*; +import lombok.AccessLevel; +import lombok.Getter; +import lombok.NoArgsConstructor; +import org.hankki.hankkiserver.domain.common.BaseCreatedAtEntity; + +@Entity +@Getter +@NoArgsConstructor(access = AccessLevel.PROTECTED) +public class StoreImage extends BaseCreatedAtEntity { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "store_image_id") + private Long id; + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "store_id") + private Store store; + + @Column(nullable = false) + private String image_url; + +} diff --git a/src/main/java/org/hankki/hankkiserver/domain/store/repository/StoreImageRepository.java b/src/main/java/org/hankki/hankkiserver/domain/store/repository/StoreImageRepository.java new file mode 100644 index 00000000..26def5f3 --- /dev/null +++ b/src/main/java/org/hankki/hankkiserver/domain/store/repository/StoreImageRepository.java @@ -0,0 +1,7 @@ +package org.hankki.hankkiserver.domain.store.repository; + +import org.hankki.hankkiserver.domain.store.model.StoreImage; +import org.springframework.data.jpa.repository.JpaRepository; + +public interface StoreImageRepository extends JpaRepository { +} diff --git a/src/main/java/org/hankki/hankkiserver/domain/store/repository/StoreRepository.java b/src/main/java/org/hankki/hankkiserver/domain/store/repository/StoreRepository.java new file mode 100644 index 00000000..509b37f3 --- /dev/null +++ b/src/main/java/org/hankki/hankkiserver/domain/store/repository/StoreRepository.java @@ -0,0 +1,7 @@ +package org.hankki.hankkiserver.domain.store.repository; + +import org.hankki.hankkiserver.domain.store.model.Store; +import org.springframework.data.jpa.repository.JpaRepository; + +public interface StoreRepository extends JpaRepository { +} diff --git a/src/main/java/org/hankki/hankkiserver/domain/university/model/University.java b/src/main/java/org/hankki/hankkiserver/domain/university/model/University.java new file mode 100644 index 00000000..f60cd0b7 --- /dev/null +++ b/src/main/java/org/hankki/hankkiserver/domain/university/model/University.java @@ -0,0 +1,25 @@ +package org.hankki.hankkiserver.domain.university.model; + +import jakarta.persistence.*; +import lombok.AccessLevel; +import lombok.Getter; +import lombok.NoArgsConstructor; +import org.hankki.hankkiserver.domain.common.Point; + +@Entity +@Getter +@NoArgsConstructor(access = AccessLevel.PROTECTED) +public class University { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "university_id") + private Long id; + + @Embedded + private Point point; + + @Column(nullable = false) + private String name; + +} diff --git a/src/main/java/org/hankki/hankkiserver/domain/university/repository/UniversityRepository.java b/src/main/java/org/hankki/hankkiserver/domain/university/repository/UniversityRepository.java new file mode 100644 index 00000000..b0341671 --- /dev/null +++ b/src/main/java/org/hankki/hankkiserver/domain/university/repository/UniversityRepository.java @@ -0,0 +1,7 @@ +package org.hankki.hankkiserver.domain.university.repository; + +import org.hankki.hankkiserver.domain.university.model.University; +import org.springframework.data.jpa.repository.JpaRepository; + +public interface UniversityRepository extends JpaRepository { +} diff --git a/src/main/java/org/hankki/hankkiserver/domain/universitystore/model/UniversityStore.java b/src/main/java/org/hankki/hankkiserver/domain/universitystore/model/UniversityStore.java new file mode 100644 index 00000000..71625a11 --- /dev/null +++ b/src/main/java/org/hankki/hankkiserver/domain/universitystore/model/UniversityStore.java @@ -0,0 +1,28 @@ +package org.hankki.hankkiserver.domain.universitystore.model; + +import jakarta.persistence.*; +import lombok.AccessLevel; +import lombok.Getter; +import lombok.NoArgsConstructor; +import org.hankki.hankkiserver.domain.store.model.Store; +import org.hankki.hankkiserver.domain.university.model.University; + +@Entity +@Getter +@NoArgsConstructor(access = AccessLevel.PROTECTED) +public class UniversityStore { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "university_store_id") + private Long id; + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "university_id") + private University university; + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "store_id") + private Store store; + +} diff --git a/src/main/java/org/hankki/hankkiserver/domain/universitystore/repository/UniversityStoreRepository.java b/src/main/java/org/hankki/hankkiserver/domain/universitystore/repository/UniversityStoreRepository.java new file mode 100644 index 00000000..339e5b14 --- /dev/null +++ b/src/main/java/org/hankki/hankkiserver/domain/universitystore/repository/UniversityStoreRepository.java @@ -0,0 +1,7 @@ +package org.hankki.hankkiserver.domain.universitystore.repository; + +import org.hankki.hankkiserver.domain.universitystore.model.UniversityStore; +import org.springframework.data.jpa.repository.JpaRepository; + +public interface UniversityStoreRepository extends JpaRepository { +} diff --git a/src/main/java/org/hankki/hankkiserver/domain/user/model/MemberStatus.java b/src/main/java/org/hankki/hankkiserver/domain/user/model/MemberStatus.java new file mode 100644 index 00000000..81f2f8e8 --- /dev/null +++ b/src/main/java/org/hankki/hankkiserver/domain/user/model/MemberStatus.java @@ -0,0 +1,14 @@ +package org.hankki.hankkiserver.domain.user.model; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +@Getter +@AllArgsConstructor +public enum MemberStatus { + + ACTIVE("ACTIVE"), INACTICE("INACTIVE"); + + private final String value; + +} diff --git a/src/main/java/org/hankki/hankkiserver/domain/user/model/Platform.java b/src/main/java/org/hankki/hankkiserver/domain/user/model/Platform.java new file mode 100644 index 00000000..128cee50 --- /dev/null +++ b/src/main/java/org/hankki/hankkiserver/domain/user/model/Platform.java @@ -0,0 +1,14 @@ +package org.hankki.hankkiserver.domain.user.model; + +import lombok.Getter; +import lombok.RequiredArgsConstructor; + +@Getter +@RequiredArgsConstructor +public enum Platform { + + KAKAO("KAKAO"), APPLE("APPLE"); + + private final String value; + +} diff --git a/src/main/java/org/hankki/hankkiserver/domain/user/model/User.java b/src/main/java/org/hankki/hankkiserver/domain/user/model/User.java new file mode 100644 index 00000000..a2348cf1 --- /dev/null +++ b/src/main/java/org/hankki/hankkiserver/domain/user/model/User.java @@ -0,0 +1,48 @@ +package org.hankki.hankkiserver.domain.user.model; + +import jakarta.persistence.*; +import lombok.AccessLevel; +import lombok.Getter; +import lombok.NoArgsConstructor; +import org.hankki.hankkiserver.domain.common.BaseTimeEntity; + +import java.time.LocalDateTime; + +@Entity +@Getter +@Table(name = "users") +@NoArgsConstructor(access = AccessLevel.PROTECTED) +public class User extends BaseTimeEntity { + + @Id + @Column(name = "user_id") + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Long id; + + @OneToOne + @JoinColumn(name = "user_info_id") + private UserInfo userInfo; + + @Enumerated(EnumType.STRING) + @Column(nullable = false) + private Platform platform; + + @Enumerated(EnumType.STRING) + private UserRole UserRole; + + @Enumerated(EnumType.STRING) + @Column(nullable = false) + private MemberStatus status; + + @Column(nullable = false) + private String serialId; + + @Column(nullable = false) + private String name; + + @Column(nullable = false) + private String email; + + private LocalDateTime deletedAt; + +} diff --git a/src/main/java/org/hankki/hankkiserver/domain/user/model/UserInfo.java b/src/main/java/org/hankki/hankkiserver/domain/user/model/UserInfo.java new file mode 100644 index 00000000..f3d530ff --- /dev/null +++ b/src/main/java/org/hankki/hankkiserver/domain/user/model/UserInfo.java @@ -0,0 +1,26 @@ +package org.hankki.hankkiserver.domain.user.model; + +import jakarta.persistence.*; +import lombok.AccessLevel; +import lombok.Getter; +import lombok.NoArgsConstructor; + +@Entity +@Getter +@NoArgsConstructor(access = AccessLevel.PROTECTED) +public class UserInfo { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "user_info_id") + private Long id; + + @Column(nullable = false) + private String nickname; + + @Column(nullable = false) + private String profileImageUrl; + + private String refreshToken; + +} diff --git a/src/main/java/org/hankki/hankkiserver/domain/user/model/UserRole.java b/src/main/java/org/hankki/hankkiserver/domain/user/model/UserRole.java new file mode 100644 index 00000000..5e944f37 --- /dev/null +++ b/src/main/java/org/hankki/hankkiserver/domain/user/model/UserRole.java @@ -0,0 +1,14 @@ +package org.hankki.hankkiserver.domain.user.model; + +import lombok.Getter; +import lombok.RequiredArgsConstructor; + +@Getter +@RequiredArgsConstructor +public enum UserRole { + + ADMIN("ADMIN"), USER("USER"); + + private final String value; + +} diff --git a/src/main/java/org/hankki/hankkiserver/domain/user/repository/UserInfoRepository.java b/src/main/java/org/hankki/hankkiserver/domain/user/repository/UserInfoRepository.java new file mode 100644 index 00000000..b1a26a84 --- /dev/null +++ b/src/main/java/org/hankki/hankkiserver/domain/user/repository/UserInfoRepository.java @@ -0,0 +1,7 @@ +package org.hankki.hankkiserver.domain.user.repository; + +import org.hankki.hankkiserver.domain.user.model.UserInfo; +import org.springframework.data.jpa.repository.JpaRepository; + +public interface UserInfoRepository extends JpaRepository { +} diff --git a/src/main/java/org/hankki/hankkiserver/domain/user/repository/UserRepository.java b/src/main/java/org/hankki/hankkiserver/domain/user/repository/UserRepository.java new file mode 100644 index 00000000..be2baa94 --- /dev/null +++ b/src/main/java/org/hankki/hankkiserver/domain/user/repository/UserRepository.java @@ -0,0 +1,7 @@ +package org.hankki.hankkiserver.domain.user.repository; + +import org.hankki.hankkiserver.domain.user.model.User; +import org.springframework.data.jpa.repository.JpaRepository; + +public interface UserRepository extends JpaRepository { +}