Skip to content

Commit

Permalink
[feat] posts관련 도메인
Browse files Browse the repository at this point in the history
  • Loading branch information
jainefer committed Nov 18, 2024
1 parent 3dd18b8 commit 19fe5e4
Show file tree
Hide file tree
Showing 9 changed files with 284 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package site.billbill.apiserver.common.enums.items;

public enum PriceStandard {
DAY,
MONTH,
YEAR
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
package site.billbill.apiserver.model.post;

import jakarta.persistence.*;
import lombok.*;
import org.hibernate.annotations.DynamicUpdate;
import site.billbill.apiserver.common.converter.BooleanConverter;
import site.billbill.apiserver.common.converter.StringListConverter;
import site.billbill.apiserver.common.enums.items.PriceStandard;
import site.billbill.apiserver.common.enums.user.DeviceType;
import site.billbill.apiserver.model.BaseTime;
import site.billbill.apiserver.model.user.UserJpaEntity;

import java.time.LocalDate;
import java.util.List;

@DynamicUpdate
@Entity
@Builder
@Table(name = "items_borrow")
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
public class ItemsBorrowJpaEntity extends BaseTime {
@Id
@Column(name = "item_id", nullable = false)
private String id;
@OneToOne
@MapsId
private ItemsJpaEntity items;
@Enumerated(EnumType.STRING)
@Column(name = "price_standard")
private PriceStandard priceStandard;
@Column(name = "price", nullable = false)
private int price;
@Column(name="deposit",nullable = false)
private int deposit;
@Column(name="start_date",nullable = false)
private LocalDate startDate;
@Column(name = "end_date", nullable = false)
private LocalDate endDate;
@Column(name ="borrow_satus_code")
private String borrowStatusCode;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package site.billbill.apiserver.model.post;

import jakarta.persistence.*;
import lombok.*;
import org.hibernate.annotations.DynamicUpdate;

@DynamicUpdate
@Entity
@Builder
@Table(name = "items_category")
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
public class ItemsCategoryJpaEntity {

@Id
@Column(name ="category_id")
private String id;

@ManyToOne
@JoinColumn(name="upper_cat_id",nullable = false)
private ItemsCategoryJpaEntity upperCategory;

@Column(name="name")
private String name;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package site.billbill.apiserver.model.post;

import jakarta.persistence.*;
import lombok.*;
import org.hibernate.annotations.DynamicUpdate;
import site.billbill.apiserver.common.converter.StringListConverter;
import site.billbill.apiserver.model.BaseTime;

@DynamicUpdate
@Entity
@Builder
@Table(name = "items_exchange")
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
public class ItemsExchangeJpaEntity extends BaseTime {
@Id
@Column(name="item_id")
private String item_id;

@ManyToOne
@MapsId
private ItemsJpaEntity items;
@Convert(converter = StringListConverter.class)
@JoinColumn(name="wisiList",nullable = false)
String wishList;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
package site.billbill.apiserver.model.post;

import io.micrometer.core.annotation.Counted;
import jakarta.persistence.*;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import site.billbill.apiserver.common.converter.BooleanConverter;
import site.billbill.apiserver.common.converter.StringListConverter;
import site.billbill.apiserver.model.BaseTime;
import site.billbill.apiserver.model.user.UserJpaEntity;

import java.time.LocalDate;
import java.util.List;

@Entity
@Table(name = "items")
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
public class ItemsJpaEntity extends BaseTime {
@Id
@Column(name = "item_id", nullable = false)
private String id;
@ManyToOne
@JoinColumn(name="owner_id")
private UserJpaEntity owner;
@Convert(converter = StringListConverter.class)
@Column(name = "images", nullable = true)
private List<String> images;
@Column(name = "title", nullable = false)
private String title;
@Column(name="content",nullable = false)
private String content;
@Column(name="like_count",nullable = false)
private int viewCount;
@Column(name = "del_yn", nullable = false)
@Convert(converter = BooleanConverter.class)
private boolean delYn;

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package site.billbill.apiserver.model.post;

import jakarta.persistence.*;
import lombok.*;
import org.hibernate.annotations.DynamicUpdate;
import site.billbill.apiserver.model.BaseTime;

import java.awt.*;

@DynamicUpdate
@Entity
@Builder
@Table(name = "items_location")
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
public class ItemsLocationJpaEntity extends BaseTime {
@Id
@Column(name="item_id")
private String id;

@MapsId
@ManyToOne
private ItemsJpaEntity items;

@Column(name="address",nullable = false)
private String address;

@Column(name="coordinates",nullable = false)
private Point coordinates;

@Column(name = "latitude", nullable = true)
private Double latitude;
@Column(name = "longitude", nullable = true)
private Double longitude;



}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package site.billbill.apiserver.model.post;

import jakarta.persistence.*;
import lombok.*;
import org.hibernate.annotations.DynamicUpdate;
import site.billbill.apiserver.model.BaseTime;
import site.billbill.apiserver.model.user.UserJpaEntity;

@DynamicUpdate
@Entity
@Builder
@Table(name = "items_review")
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
public class ItemsReviewJpaEntity extends BaseTime {

@Id
@Column(name="review_id")
private String id;
@ManyToOne
@JoinColumn(name="item_id")
private ItemsJpaEntity items;
@ManyToOne
@JoinColumn(name="user_id")
private UserJpaEntity user;

@Column(name="rating",nullable = false)
private int rating;
@Column(name="content",nullable = false)
private String content;

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package site.billbill.apiserver.model.post.emebeded;

import jakarta.persistence.Column;
import jakarta.persistence.Embeddable;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

import java.io.Serializable;

@Embeddable
@AllArgsConstructor
@NoArgsConstructor
@EqualsAndHashCode
@Data
public class ItemsLikeId implements Serializable {
@Column(name="item_id")
private String itemId;
@Column(name="user_id")
private String userId;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package site.billbill.apiserver.model.post;

import jakarta.mail.FetchProfile;
import jakarta.persistence.*;
import lombok.*;
import org.hibernate.annotations.DynamicUpdate;
import site.billbill.apiserver.common.converter.BooleanConverter;
import site.billbill.apiserver.model.BaseTime;
import site.billbill.apiserver.model.post.emebeded.ItemsLikeId;
import site.billbill.apiserver.model.user.UserJpaEntity;

@DynamicUpdate
@Entity
@Builder
@Table(name = "items_like")
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor

public class itemsLikeJpaEntity extends BaseTime {
@EmbeddedId
private ItemsLikeId id;

@ManyToOne
@MapsId
@JoinColumn(name="item_id")
private ItemsJpaEntity items;

@ManyToOne
@MapsId
@JoinColumn(name="user_id")
private UserJpaEntity user;

@Column(name = "del_yn", nullable = false)
@Convert(converter = BooleanConverter.class)
private boolean delYn;

}

0 comments on commit 19fe5e4

Please sign in to comment.