Skip to content

Commit

Permalink
feat: 번쩍 관련 객체 정의 (#508)
Browse files Browse the repository at this point in the history
* feat(Lightning): Lightning 객체 정의

* feat(Tag): Tag 객체 정의

* feat(TagType): TagType 객체 정의

* chore(Lightning): 최소 글자수 변경

* chore(Meeting): ImageURL 제약조건 추가

* chore(Lightning): 컬럼 이름 추가

* chore(Tag): @NotNull 제거

* chore(Tag): @entity 추가

* chore(Lightning): 기획수정으로 인한 엔티티 변경

* chore(Meeting): 최솟값 추가

* chore(Meeting): 이미지 최댓값 변경
  • Loading branch information
mikekks authored Jan 15, 2025
1 parent 818a23b commit d3e1780
Show file tree
Hide file tree
Showing 5 changed files with 139 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
package org.sopt.makers.crew.main.entity.lightning;

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

import org.hibernate.annotations.Type;
import org.sopt.makers.crew.main.entity.common.BaseTimeEntity;
import org.sopt.makers.crew.main.entity.meeting.vo.ImageUrlVO;

import io.hypersistence.utils.hibernate.type.json.JsonBinaryType;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.EnumType;
import jakarta.persistence.Enumerated;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.Table;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import lombok.AccessLevel;
import lombok.Getter;
import lombok.NoArgsConstructor;

@Entity
@Getter
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@Table(name = "lightning")
public class Lightning extends BaseTimeEntity {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;

@NotNull
@Column(name = "leaderUserId")
private Integer leaderUserId;

@NotNull
@Size(min = 1, max = 30)
@Column(name = "title")
private String title;

@Column(name = "desc", columnDefinition = "TEXT")
private String desc;

@Column(name = "activityStartDate")
@NotNull
private LocalDate activityStartDate;

@Column(name = "activityEndDate")
@NotNull
private LocalDateTime activityEndDate;

@Column(name = "lightningTime")
private LocalDateTime lightningTime;

@Column(name = "lightningPlaceType")
@NotNull
@Enumerated(EnumType.STRING)
private LightningPlaceType lightningPlaceType;

@Column(name = "lightningPlace")
@NotNull
private String lightningPlace;

@Column(name = "minimumCapacity")
private int minimumCapacity;

@Column(name = "maximumCapacity")
private int maximumCapacity;

@Column(name = "imageURL", columnDefinition = "jsonb")
@Type(JsonBinaryType.class)
private List<ImageUrlVO> imageURL;

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package org.sopt.makers.crew.main.entity.lightning;

public enum LightningPlaceType {
OFFLINE,
ONLINE,
NOT_DECIDED
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import java.time.LocalDateTime;
import java.util.List;

import jakarta.validation.constraints.Size;
import lombok.AccessLevel;
import lombok.Builder;
import lombok.Getter;
Expand Down Expand Up @@ -78,6 +79,7 @@ public class Meeting extends BaseTimeEntity {
*/
@Column(name = "imageURL", columnDefinition = "jsonb")
@Type(JsonBinaryType.class)
@Size(min = 1, max = 6)
private List<ImageUrlVO> imageURL;

/**
Expand Down
47 changes: 47 additions & 0 deletions main/src/main/java/org/sopt/makers/crew/main/entity/tag/Tag.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
package org.sopt.makers.crew.main.entity.tag;

import org.sopt.makers.crew.main.entity.common.BaseTimeEntity;

import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.EnumType;
import jakarta.persistence.Enumerated;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.Table;
import jakarta.validation.constraints.NotNull;
import lombok.AccessLevel;
import lombok.Getter;
import lombok.NoArgsConstructor;

@Entity
@Getter
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@Table(name = "tag")
public class Tag extends BaseTimeEntity {

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;

/**
* @implSpec : 모임태그 or 번쩍태그 구분
* @implNote : 모임태그일 경우, lightningId == null
* @implNote : 번쩍태그일 경우, meetingId == null
* */
@Enumerated(EnumType.STRING)
@Column(name = "tagType")
@NotNull
private TagType tagType;

@Column(name = "meetingId")
private Integer meetingId;

@Column(name = "lightningId")
private Integer lightningId;

@NotNull
private String content;

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package org.sopt.makers.crew.main.entity.tag;

public enum TagType {
MEETING,
LIGHTING
}

0 comments on commit d3e1780

Please sign in to comment.