Skip to content

Commit

Permalink
feat : SpaceWall엔티티에 isPublic 컬럼 추가 (Fastcampus-Final-Team3#204)
Browse files Browse the repository at this point in the history
- 공유페이지 저장시엔 설정이 안되기 때문에 @ColumnDefault로 디폴트 값 false로 설정
  • Loading branch information
miyounlee committed Oct 26, 2023
1 parent 571e04f commit e979c17
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/main/java/com/javajober/spaceWall/domain/SpaceWall.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,16 @@

import lombok.Builder;
import lombok.Getter;
import org.hibernate.annotations.ColumnDefault;
import org.hibernate.annotations.DynamicInsert;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.*;
import java.time.LocalDateTime;

@DynamicInsert
@Getter
@Table(name = "space_wall")
@EntityListeners(AuditingEntityListener.class)
Expand Down Expand Up @@ -47,6 +50,10 @@ public class SpaceWall {
@Column(name = "flag", nullable = false)
private FlagType flag;

@ColumnDefault("false")
@Column(name = "is_public")
private Boolean isPublic;

@CreatedDate
@Column(name = "created_at")
private LocalDateTime createdAt;
Expand All @@ -64,23 +71,29 @@ protected SpaceWall() {

@Builder
public SpaceWall(final String blocks, final String shareURL, final AddSpace addSpace, final Member member,
final SpaceWallCategoryType spaceWallCategoryType, final FlagType flag) {
final SpaceWallCategoryType spaceWallCategoryType, final FlagType flag, final Boolean isPublic) {
this.blocks = blocks;
this.shareURL = shareURL;
this.addSpace = addSpace;
this.member = member;
this.spaceWallCategoryType = spaceWallCategoryType;
this.flag = flag;
this.isPublic = isPublic;
}

public void update(final DataStringUpdateRequest request, final FlagType flag, final String blockInfoArrayAsString){
this.blocks = blockInfoArrayAsString;
this.shareURL = request.getShareURL();
this.flag = flag;
}

public void fileUpdate(final DataUpdateRequest request, final FlagType flag, final String blockInfoArrayAsString){
this.blocks = blockInfoArrayAsString;
this.shareURL = request.getShareURL();
this.flag = flag;
}

public void updateIsPublic(final Boolean isPublic) {
this.isPublic = isPublic;
}
}

0 comments on commit e979c17

Please sign in to comment.