diff --git a/src/main/java/com/jangburich/domain/common/BaseEntity.java b/src/main/java/com/jangburich/domain/common/BaseEntity.java new file mode 100644 index 0000000..f724af1 --- /dev/null +++ b/src/main/java/com/jangburich/domain/common/BaseEntity.java @@ -0,0 +1,29 @@ +package com.jangburich.domain.common; + +import jakarta.persistence.Column; +import jakarta.persistence.EntityListeners; +import jakarta.persistence.EnumType; +import jakarta.persistence.Enumerated; +import jakarta.persistence.MappedSuperclass; +import java.time.LocalDateTime; +import lombok.Getter; +import org.springframework.data.annotation.CreatedDate; +import org.springframework.data.annotation.LastModifiedDate; +import org.springframework.data.jpa.domain.support.AuditingEntityListener; + +@Getter +@MappedSuperclass +@EntityListeners(AuditingEntityListener.class) +public abstract class BaseEntity { + @CreatedDate + @Column(name = "created_at", updatable = false) + private LocalDateTime createdAt; + + @LastModifiedDate + @Column(name = "updated_at") + private LocalDateTime updatedAt; + + @Enumerated(value = EnumType.STRING) + @Column(name = "status") + private Status status = Status.ACTIVE; +} diff --git a/src/main/java/com/jangburich/domain/common/Status.java b/src/main/java/com/jangburich/domain/common/Status.java new file mode 100644 index 0000000..8b3b700 --- /dev/null +++ b/src/main/java/com/jangburich/domain/common/Status.java @@ -0,0 +1,5 @@ +package com.jangburich.domain.common; + +public enum Status { + ACTIVE, INACTIVE +} diff --git a/src/main/java/com/jangburich/domain/favorite/domain/FavoriteStore.java b/src/main/java/com/jangburich/domain/favorite/domain/FavoriteStore.java new file mode 100644 index 0000000..b989a60 --- /dev/null +++ b/src/main/java/com/jangburich/domain/favorite/domain/FavoriteStore.java @@ -0,0 +1,35 @@ +package com.jangburich.domain.favorite.domain; + +import com.jangburich.domain.common.BaseEntity; +import com.jangburich.domain.store.domain.Store; +import com.jangburich.domain.user.domain.User; +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.FetchType; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Id; +import jakarta.persistence.JoinColumn; +import jakarta.persistence.ManyToOne; +import lombok.AccessLevel; +import lombok.Getter; +import lombok.NoArgsConstructor; + +@Entity +@Getter +@NoArgsConstructor(access = AccessLevel.PROTECTED) +public class FavoriteStore extends BaseEntity { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "id", updatable = false) + 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/com/jangburich/domain/favorite/domain/FavoriteTeam.java b/src/main/java/com/jangburich/domain/favorite/domain/FavoriteTeam.java new file mode 100644 index 0000000..7200938 --- /dev/null +++ b/src/main/java/com/jangburich/domain/favorite/domain/FavoriteTeam.java @@ -0,0 +1,35 @@ +package com.jangburich.domain.favorite.domain; + +import com.jangburich.domain.common.BaseEntity; +import com.jangburich.domain.team.domain.Team; +import com.jangburich.domain.user.domain.User; +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.FetchType; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Id; +import jakarta.persistence.JoinColumn; +import jakarta.persistence.ManyToOne; +import lombok.AccessLevel; +import lombok.Getter; +import lombok.NoArgsConstructor; + +@Entity +@Getter +@NoArgsConstructor(access = AccessLevel.PROTECTED) +public class FavoriteTeam extends BaseEntity { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "id", updatable = false) + private Long id; + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "user_id") + private User user; + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "team_id") + private Team team; +} diff --git a/src/main/java/com/jangburich/domain/menu/domain/Menu.java b/src/main/java/com/jangburich/domain/menu/domain/Menu.java new file mode 100644 index 0000000..af1b3d9 --- /dev/null +++ b/src/main/java/com/jangburich/domain/menu/domain/Menu.java @@ -0,0 +1,42 @@ +package com.jangburich.domain.menu.domain; + +import com.jangburich.domain.common.BaseEntity; +import com.jangburich.domain.store.domain.Store; +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.FetchType; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Id; +import jakarta.persistence.JoinColumn; +import jakarta.persistence.ManyToOne; +import lombok.AccessLevel; +import lombok.Getter; +import lombok.NoArgsConstructor; + +@Entity +@Getter +@NoArgsConstructor(access = AccessLevel.PROTECTED) +public class Menu extends BaseEntity { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "id", updatable = false) + private Long id; + + @Column(name = "name") + private String name; + + @Column(name = "description") + private String description; + + @Column(name = "image_url") + private String imageUrl; + + @Column(name = "price") + private Integer price; + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "store_id") + private Store store; +} diff --git a/src/main/java/com/jangburich/domain/order/domain/Cart.java b/src/main/java/com/jangburich/domain/order/domain/Cart.java new file mode 100644 index 0000000..014f63d --- /dev/null +++ b/src/main/java/com/jangburich/domain/order/domain/Cart.java @@ -0,0 +1,37 @@ +package com.jangburich.domain.order.domain; + +import com.jangburich.domain.common.BaseEntity; +import com.jangburich.domain.menu.domain.Menu; +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.FetchType; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Id; +import jakarta.persistence.JoinColumn; +import jakarta.persistence.ManyToOne; +import lombok.AccessLevel; +import lombok.Getter; +import lombok.NoArgsConstructor; + +@Entity +@Getter +@NoArgsConstructor(access = AccessLevel.PROTECTED) +public class Cart extends BaseEntity { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "id", updatable = false) + private Long id; + + @Column(name = "quantity") + private Integer quantity; + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "orders_id") + private Orders orders; + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "menu_id") + private Menu menu; +} diff --git a/src/main/java/com/jangburich/domain/order/domain/Orders.java b/src/main/java/com/jangburich/domain/order/domain/Orders.java new file mode 100644 index 0000000..260ab2a --- /dev/null +++ b/src/main/java/com/jangburich/domain/order/domain/Orders.java @@ -0,0 +1,40 @@ +package com.jangburich.domain.order.domain; + +import com.jangburich.domain.common.BaseEntity; +import com.jangburich.domain.store.domain.Store; +import com.jangburich.domain.team.domain.Team; +import com.jangburich.domain.user.domain.User; +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.FetchType; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Id; +import jakarta.persistence.JoinColumn; +import jakarta.persistence.ManyToOne; +import lombok.AccessLevel; +import lombok.Getter; +import lombok.NoArgsConstructor; + +@Entity +@Getter +@NoArgsConstructor(access = AccessLevel.PROTECTED) +public class Orders extends BaseEntity { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "id", updatable = false) + private Long id; + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "store_id") + private Store store; + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "user_id") + private User user; + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "team_id") + private Team team; +} diff --git a/src/main/java/com/jangburich/domain/owner/domain/Owner.java b/src/main/java/com/jangburich/domain/owner/domain/Owner.java new file mode 100644 index 0000000..4f83674 --- /dev/null +++ b/src/main/java/com/jangburich/domain/owner/domain/Owner.java @@ -0,0 +1,45 @@ +package com.jangburich.domain.owner.domain; + +import com.jangburich.domain.common.BaseEntity; +import com.jangburich.domain.user.domain.User; +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Id; +import jakarta.persistence.JoinColumn; +import jakarta.persistence.OneToOne; +import java.time.LocalDate; +import lombok.AccessLevel; +import lombok.Getter; +import lombok.NoArgsConstructor; + +@Entity +@Getter +@NoArgsConstructor(access = AccessLevel.PROTECTED) +public class Owner extends BaseEntity { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "id", updatable = false) + private Long id; + + @Column(name = "phone_number") + private String phoneNumber; + + @Column(name = "business_name") + private String businessName; + + @Column(name = "business_registration_number") + private String businessRegistrationNumber; + + @Column(name = "name") + private String name; + + @Column(name = "opening_date") + private LocalDate openingDate; + + @OneToOne + @JoinColumn(name = "user_id") + private User user; +} diff --git a/src/main/java/com/jangburich/domain/payment/domain/TeamPayment.java b/src/main/java/com/jangburich/domain/payment/domain/TeamPayment.java new file mode 100644 index 0000000..36c683d --- /dev/null +++ b/src/main/java/com/jangburich/domain/payment/domain/TeamPayment.java @@ -0,0 +1,36 @@ +package com.jangburich.domain.payment.domain; + +import com.jangburich.domain.common.BaseEntity; +import com.jangburich.domain.team.domain.Team; +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.FetchType; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Id; +import jakarta.persistence.JoinColumn; +import jakarta.persistence.ManyToOne; +import lombok.AccessLevel; +import lombok.Getter; +import lombok.NoArgsConstructor; + +@Entity +@Getter +@NoArgsConstructor(access = AccessLevel.PROTECTED) +public class TeamPayment extends BaseEntity { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "id", updatable = false) + private Long id; + + @Column(name = "total_amount") + private Integer totalAmount; + + @Column(name = "remaining_amount") + private Integer remainingAmount; + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "team_id") + private Team team; +} diff --git a/src/main/java/com/jangburich/domain/point/domain/PointTransaction.java b/src/main/java/com/jangburich/domain/point/domain/PointTransaction.java new file mode 100644 index 0000000..2feb850 --- /dev/null +++ b/src/main/java/com/jangburich/domain/point/domain/PointTransaction.java @@ -0,0 +1,41 @@ +package com.jangburich.domain.point.domain; + +import com.jangburich.domain.common.BaseEntity; +import com.jangburich.domain.store.domain.Store; +import com.jangburich.domain.team.domain.Team; +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.EnumType; +import jakarta.persistence.Enumerated; +import jakarta.persistence.FetchType; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Id; +import jakarta.persistence.JoinColumn; +import jakarta.persistence.ManyToOne; +import lombok.AccessLevel; +import lombok.Getter; +import lombok.NoArgsConstructor; + +@Entity +@Getter +@NoArgsConstructor(access = AccessLevel.PROTECTED) +public class PointTransaction extends BaseEntity { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "id", updatable = false) + private Long id; + + @Enumerated(EnumType.STRING) + @Column(name = "transaction_type") + private TransactionType transactionType; + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "team_id") + private Team team; + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "store_id") + private Store store; +} diff --git a/src/main/java/com/jangburich/domain/point/domain/TransactionType.java b/src/main/java/com/jangburich/domain/point/domain/TransactionType.java new file mode 100644 index 0000000..c603f17 --- /dev/null +++ b/src/main/java/com/jangburich/domain/point/domain/TransactionType.java @@ -0,0 +1,5 @@ +package com.jangburich.domain.point.domain; + +public enum TransactionType { + PURCHASE, REFUND, RECHARGE +} diff --git a/src/main/java/com/jangburich/domain/reservation/domain/Reservation.java b/src/main/java/com/jangburich/domain/reservation/domain/Reservation.java new file mode 100644 index 0000000..b422772 --- /dev/null +++ b/src/main/java/com/jangburich/domain/reservation/domain/Reservation.java @@ -0,0 +1,44 @@ +package com.jangburich.domain.reservation.domain; + +import com.jangburich.domain.common.BaseEntity; +import com.jangburich.domain.store.domain.Store; +import com.jangburich.domain.user.domain.User; +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.EnumType; +import jakarta.persistence.Enumerated; +import jakarta.persistence.FetchType; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Id; +import jakarta.persistence.JoinColumn; +import jakarta.persistence.ManyToOne; +import lombok.AccessLevel; +import lombok.Getter; +import lombok.NoArgsConstructor; + +@Entity +@Getter +@NoArgsConstructor(access = AccessLevel.PROTECTED) +public class Reservation extends BaseEntity { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "id", updatable = false) + private Long id; + + @Column(name = "people_count") + private Integer peopleCount; + + @Enumerated(EnumType.STRING) + @Column(name = "reservation_status") + private ReservationStatus reservationStatus; + + @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/com/jangburich/domain/reservation/domain/ReservationStatus.java b/src/main/java/com/jangburich/domain/reservation/domain/ReservationStatus.java new file mode 100644 index 0000000..e228fe4 --- /dev/null +++ b/src/main/java/com/jangburich/domain/reservation/domain/ReservationStatus.java @@ -0,0 +1,5 @@ +package com.jangburich.domain.reservation.domain; + +public enum ReservationStatus { + APPROVED, REJECTED, PENDING +} diff --git a/src/main/java/com/jangburich/domain/store/domain/Category.java b/src/main/java/com/jangburich/domain/store/domain/Category.java new file mode 100644 index 0000000..1c3416d --- /dev/null +++ b/src/main/java/com/jangburich/domain/store/domain/Category.java @@ -0,0 +1,27 @@ +package com.jangburich.domain.store.domain; + +public enum Category { + ALL("전체"), + KOREAN("한식"), + CHINESE("중식"), + JAPANESE("일식"), + WESTERN("양식"), + SNACK("분식"), + MEAT("육류"), + SEAFOOD("해산물"), + VIETNAMESE("베트남"), + MEXICAN("멕시코"), + INDIAN("인도"), + THAI("태국"), + OTHER("기타"); + + private final String displayName; + + Category(String displayName) { + this.displayName = displayName; + } + + public String getDisplayName() { + return displayName; + } +} diff --git a/src/main/java/com/jangburich/domain/store/domain/Store.java b/src/main/java/com/jangburich/domain/store/domain/Store.java new file mode 100644 index 0000000..0e5b221 --- /dev/null +++ b/src/main/java/com/jangburich/domain/store/domain/Store.java @@ -0,0 +1,80 @@ +package com.jangburich.domain.store.domain; + +import com.jangburich.domain.owner.domain.Owner; +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.EnumType; +import jakarta.persistence.Enumerated; +import jakarta.persistence.FetchType; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Id; +import jakarta.persistence.JoinColumn; +import jakarta.persistence.OneToOne; +import lombok.AccessLevel; +import lombok.Getter; +import lombok.NoArgsConstructor; + +@Entity +@Getter +@NoArgsConstructor(access = AccessLevel.PROTECTED) +public class Store { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "id") + private Long id; + + @OneToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "owner_id") + private Owner owner; + + @Column(name = "name") + private String name; + + @Enumerated(EnumType.STRING) + @Column(name = "category") + private Category category; + + @Column(name = "representative_image") + private String representativeImage; + + @Column(name = "reservation_available") + private Boolean reservationAvailable; + + @Column(name = "max_reservation") + private Long maxReservation; + + @Column(name = "min_prepayment") + private Long minPrepayment; + + @Column(name = "prepayment_duration") + private Long prepaymentDuration; + + @Column(name = "introduction") + private String introduction; + + @Column(name = "latitude") + private Double latitude; + + @Column(name = "longitude") + private Double longitude; + + @Column(name = "address") + private String address; + + @Column(name = "location") + private String location; + + @Column(name = "day_of_week") + private String dayOfWeek; + + @Column(name = "open_time") + private String openTime; + + @Column(name = "close_time") + private String closeTime; + + @Column(name = "contact_number") + private String contactNumber; +} diff --git a/src/main/java/com/jangburich/domain/team/domain/Team.java b/src/main/java/com/jangburich/domain/team/domain/Team.java new file mode 100644 index 0000000..6d3b17c --- /dev/null +++ b/src/main/java/com/jangburich/domain/team/domain/Team.java @@ -0,0 +1,31 @@ +package com.jangburich.domain.team.domain; + +import com.jangburich.domain.common.BaseEntity; +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Id; +import lombok.AccessLevel; +import lombok.Getter; +import lombok.NoArgsConstructor; + +@Entity +@Getter +@NoArgsConstructor(access = AccessLevel.PROTECTED) +public class Team extends BaseEntity { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "id", updatable = false) + private Long id; + + @Column(name = "name") + private String name; + + @Column(name = "point") + private Integer point; + + @Column(name = "member_limit") + private Integer memberLimit; +} diff --git a/src/main/java/com/jangburich/domain/user/domain/User.java b/src/main/java/com/jangburich/domain/user/domain/User.java new file mode 100644 index 0000000..2edfcf1 --- /dev/null +++ b/src/main/java/com/jangburich/domain/user/domain/User.java @@ -0,0 +1,46 @@ +package com.jangburich.domain.user.domain; + +import com.jangburich.domain.common.BaseEntity; +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Id; +import lombok.AccessLevel; +import lombok.Getter; +import lombok.NoArgsConstructor; + +@Entity +@Getter +@NoArgsConstructor(access = AccessLevel.PROTECTED) +public class User extends BaseEntity { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "id", updatable = false) + private Long userId; + + @Column(name = "provider_id") + private String providerId; + + @Column(name = "email") + private String email; + + @Column(name = "phone_number") + private String phoneNumber; + + @Column(name = "is_term_accepted") + private Boolean isTermAccepted; + + @Column(name = "nickname", nullable = false, unique = true) + private String nickname; + + @Column(name = "profile_image_url") + private String profileImageUrl; + + @Column(name = "character_image_url") + private String characterImageUrl; + + @Column(name = "role") + private String role; +} diff --git a/src/main/java/com/jangburich/domain/user/domain/repository/UserRepository.java b/src/main/java/com/jangburich/domain/user/domain/repository/UserRepository.java new file mode 100644 index 0000000..933583f --- /dev/null +++ b/src/main/java/com/jangburich/domain/user/domain/repository/UserRepository.java @@ -0,0 +1,9 @@ +package com.jangburich.domain.user.domain.repository; + +import com.jangburich.domain.user.domain.User; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.stereotype.Repository; + +@Repository +public interface UserRepository extends JpaRepository { +}