-
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.
Merge pull request #64 from billbill-project/feature/users
Feature/users API 개발 및 중간 model 공유
- Loading branch information
Showing
13 changed files
with
358 additions
and
17 deletions.
There are no files selected for viewing
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
54 changes: 54 additions & 0 deletions
54
src/main/java/site/billbill/apiserver/api/users/dto/response/BorrowHistoryResponse.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,54 @@ | ||
package site.billbill.apiserver.api.users.dto.response; | ||
|
||
import com.fasterxml.jackson.annotation.JsonFormat; | ||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import jakarta.persistence.EnumType; | ||
import jakarta.persistence.Enumerated; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Data; | ||
import site.billbill.apiserver.common.utils.posts.ItemHistoryType; | ||
|
||
import java.time.OffsetDateTime; | ||
import java.util.List; | ||
|
||
@Data | ||
@AllArgsConstructor | ||
public class BorrowHistoryResponse { | ||
@Schema(description = "대여 기록 번호", example = "2") | ||
private long borrowSeq; | ||
@Schema(description = "물품 ID", example = "ITEM-XXXXX...") | ||
private String itemId; | ||
@Schema(description = "대여자 ID", example = "USER-XXXXX...") | ||
private String borrowerId; | ||
@Enumerated(EnumType.STRING) | ||
@Schema(description = "물품 타입", example = "BORROWING / BORROWED / EXCHANGE") | ||
private ItemHistoryType type; | ||
@Schema( | ||
description = "물품 이미지 리스트", | ||
type = "array", | ||
example = "[\"image1.jpg\", \"image2.jpg\"]" | ||
) | ||
private List<String> itemImages; | ||
@Schema(description = "물품 이름", example = "Pronto600 폴라로이드 카메라") | ||
private String title; | ||
@Schema(description = "대여 시작 일자", example = "yyyy-MM-dd") | ||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd") | ||
private OffsetDateTime startedAt; | ||
@Schema(description = "대여 종료 일자", example = "yyyy-MM-dd") | ||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd") | ||
private OffsetDateTime endedAt; | ||
@Schema(description = "아이템 상태", example = "3") | ||
private int itemStatus; | ||
@Schema(description = "좋아요 수", example = "12") | ||
private long likeCount; | ||
@Schema(description = "채팅 수", example = "1") | ||
private long chatCount; | ||
@Schema(description = "조회 수", example = "12") | ||
private int viewCount; | ||
@Schema(description = "생성일시", example = "yyyy-MM-dd HH:mm:ss") | ||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "Asia/Seoul") | ||
private OffsetDateTime createdAt; | ||
@Schema(description = "수정일시", example = "yyyy-MM-dd HH:mm:ss") | ||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "Asia/Seoul") | ||
private OffsetDateTime updatedAt; | ||
} |
44 changes: 44 additions & 0 deletions
44
src/main/java/site/billbill/apiserver/api/users/dto/response/PostHistoryResponse.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,44 @@ | ||
package site.billbill.apiserver.api.users.dto.response; | ||
|
||
import com.fasterxml.jackson.annotation.JsonFormat; | ||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import jakarta.persistence.EnumType; | ||
import jakarta.persistence.Enumerated; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Data; | ||
import site.billbill.apiserver.common.utils.posts.ItemType; | ||
|
||
import java.time.OffsetDateTime; | ||
import java.util.List; | ||
|
||
@Data | ||
@AllArgsConstructor | ||
public class PostHistoryResponse { | ||
@Schema(description = "물품 ID", example = "ITEM-XXXXX...") | ||
private String itemId; | ||
// @Enumerated(EnumType.STRING) | ||
// @Schema(description = "물품 타입", example = "BORROW") | ||
// private ItemType type; | ||
@Schema( | ||
description = "물품 이미지 리스트", | ||
type = "array", | ||
example = "[\"image1.jpg\", \"image2.jpg\"]" | ||
) | ||
private List<String> itemImages; | ||
@Schema(description = "물품 이름", example = "Pronto600 폴라로이드 카메라") | ||
private String title; | ||
@Schema(description = "아이템 상태", example = "3") | ||
private int itemStatus; | ||
@Schema(description = "좋아요 수", example = "12") | ||
private long likeCount; | ||
@Schema(description = "채팅 수", example = "1") | ||
private long chatCount; | ||
@Schema(description = "조회 수", example = "12") | ||
private int viewCount; | ||
@Schema(description = "생성일시", example = "yyyy-MM-dd HH:mm:ss") | ||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "Asia/Seoul") | ||
private OffsetDateTime createdAt; | ||
@Schema(description = "수정일시", example = "yyyy-MM-dd HH:mm:ss") | ||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "Asia/Seoul") | ||
private OffsetDateTime updatedAt; | ||
} |
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
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
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
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
7 changes: 7 additions & 0 deletions
7
src/main/java/site/billbill/apiserver/common/utils/posts/ItemHistoryType.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 site.billbill.apiserver.common.utils.posts; | ||
|
||
public enum ItemHistoryType { | ||
BORROWING, | ||
BORROWED, | ||
EXCHANGE | ||
} |
6 changes: 6 additions & 0 deletions
6
src/main/java/site/billbill/apiserver/common/utils/posts/ItemType.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,6 @@ | ||
package site.billbill.apiserver.common.utils.posts; | ||
|
||
public enum ItemType { | ||
BORROW, | ||
EXCHANGE | ||
} |
32 changes: 32 additions & 0 deletions
32
src/main/java/site/billbill/apiserver/model/chat/ChatChannelJpaEntity.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 site.billbill.apiserver.model.chat; | ||
|
||
|
||
import jakarta.persistence.*; | ||
import lombok.*; | ||
import site.billbill.apiserver.common.converter.BooleanConverter; | ||
import site.billbill.apiserver.model.BaseTime; | ||
import site.billbill.apiserver.model.post.ItemsJpaEntity; | ||
import site.billbill.apiserver.model.user.UserJpaEntity; | ||
|
||
@Entity @Builder | ||
@Table(name = "chat_channel") | ||
@Getter @Setter | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
public class ChatChannelJpaEntity extends BaseTime { | ||
@Id | ||
@Column(name = "channel_id", nullable = false) | ||
private String channelId; | ||
@ManyToOne | ||
@JoinColumn(name="item_id") | ||
private ItemsJpaEntity item; | ||
@ManyToOne | ||
@JoinColumn(name="owner_id") | ||
private UserJpaEntity owner; | ||
@ManyToOne | ||
@JoinColumn(name="contact_id") | ||
private UserJpaEntity contact; | ||
@Column(name = "del_yn", nullable = false) | ||
@Convert(converter = BooleanConverter.class) | ||
private boolean delYn = false; | ||
} |
38 changes: 38 additions & 0 deletions
38
src/main/java/site/billbill/apiserver/model/post/BorrowHistJapEntity.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,38 @@ | ||
package site.billbill.apiserver.model.post; | ||
|
||
import jakarta.persistence.*; | ||
import lombok.*; | ||
import org.hibernate.annotations.CreationTimestamp; | ||
import site.billbill.apiserver.common.converter.BooleanConverter; | ||
import site.billbill.apiserver.model.BaseTime; | ||
import site.billbill.apiserver.model.user.UserJpaEntity; | ||
|
||
import java.time.OffsetDateTime; | ||
|
||
@Entity | ||
@Builder | ||
@Table(name = "borrow_hist") | ||
@Getter @Setter | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
public class BorrowHistJapEntity extends BaseTime { | ||
@Id @GeneratedValue(strategy = GenerationType.IDENTITY) | ||
@Column(name = "borrow_seq", nullable = false) | ||
private long borrowSeq; | ||
@ManyToOne | ||
@JoinColumn(name = "item_id", nullable = false) | ||
private ItemsJpaEntity item; | ||
@ManyToOne | ||
@JoinColumn(name = "borrower_id", nullable = false) | ||
private UserJpaEntity borrower; | ||
@Column(name = "started_at", nullable = false) | ||
private OffsetDateTime startedAt; | ||
@Column(name = "ended_at", nullable = false) | ||
private OffsetDateTime endedAt; | ||
@Convert(converter = BooleanConverter.class) | ||
@Column(name = "use_yn", nullable = false) | ||
private boolean useYn = true; | ||
@Convert(converter = BooleanConverter.class) | ||
@Column(name = "del_yn", nullable = false) | ||
private boolean delYn = false; | ||
} |
Oops, something went wrong.