-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* [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
- Loading branch information
Showing
30 changed files
with
551 additions
and
0 deletions.
There are no files selected for viewing
19 changes: 19 additions & 0 deletions
19
src/main/java/org/hankki/hankkiserver/domain/common/BaseCreatedAtEntity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
|
||
} |
23 changes: 23 additions & 0 deletions
23
src/main/java/org/hankki/hankkiserver/domain/common/BaseTimeEntity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
|
||
} |
15 changes: 15 additions & 0 deletions
15
src/main/java/org/hankki/hankkiserver/domain/common/Point.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
|
||
} |
9 changes: 9 additions & 0 deletions
9
src/main/java/org/hankki/hankkiserver/domain/config/JpaAuditingConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 { | ||
} |
32 changes: 32 additions & 0 deletions
32
src/main/java/org/hankki/hankkiserver/domain/favorite/model/Favorite.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
|
||
} |
7 changes: 7 additions & 0 deletions
7
src/main/java/org/hankki/hankkiserver/domain/favorite/repository/FavoriteRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<Favorite, Long> { | ||
} |
28 changes: 28 additions & 0 deletions
28
src/main/java/org/hankki/hankkiserver/domain/favoritestore/model/FavoriteStore.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
|
||
} |
7 changes: 7 additions & 0 deletions
7
...java/org/hankki/hankkiserver/domain/favoritestore/repository/FavoriteStoreRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<FavoriteStore, Long> { | ||
} |
28 changes: 28 additions & 0 deletions
28
src/main/java/org/hankki/hankkiserver/domain/heart/model/Heart.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
|
||
} |
7 changes: 7 additions & 0 deletions
7
src/main/java/org/hankki/hankkiserver/domain/heart/repository/HeartRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<Heart, Long> { | ||
} |
30 changes: 30 additions & 0 deletions
30
src/main/java/org/hankki/hankkiserver/domain/menu/model/Menu.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
|
||
} |
7 changes: 7 additions & 0 deletions
7
src/main/java/org/hankki/hankkiserver/domain/menu/repository/MenuRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<Menu, Long> { | ||
} |
34 changes: 34 additions & 0 deletions
34
src/main/java/org/hankki/hankkiserver/domain/report/model/Report.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
|
||
} |
7 changes: 7 additions & 0 deletions
7
src/main/java/org/hankki/hankkiserver/domain/report/repository/ReportRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<Report, Long> { | ||
} |
39 changes: 39 additions & 0 deletions
39
src/main/java/org/hankki/hankkiserver/domain/store/model/Store.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
|
||
} |
22 changes: 22 additions & 0 deletions
22
src/main/java/org/hankki/hankkiserver/domain/store/model/StoreCategory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
|
||
} |
26 changes: 26 additions & 0 deletions
26
src/main/java/org/hankki/hankkiserver/domain/store/model/StoreImage.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
|
||
} |
7 changes: 7 additions & 0 deletions
7
src/main/java/org/hankki/hankkiserver/domain/store/repository/StoreImageRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<StoreImage, Long> { | ||
} |
7 changes: 7 additions & 0 deletions
7
src/main/java/org/hankki/hankkiserver/domain/store/repository/StoreRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<Store, Long> { | ||
} |
25 changes: 25 additions & 0 deletions
25
src/main/java/org/hankki/hankkiserver/domain/university/model/University.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
|
||
} |
Oops, something went wrong.