Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[REFACTOR] 엔티티에 Not Null 제약조건 추가 #402

Open
wants to merge 12 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
@Builder
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@AllArgsConstructor
public class MainDescription extends BaseEntity {
public class MainDescription{

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/org/sopt/app/domain/entity/Notification.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,11 @@ public class Notification extends BaseEntity{
@Column(name = "notification_title", columnDefinition = "TEXT")
private String title;

@NotNull
@Column(name = "notification_content", columnDefinition = "TEXT")
private String content;

@NotNull
@Column(name = "notification_type")
@Enumerated(EnumType.STRING)
private NotificationType type;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.sopt.app.domain.entity;

import jakarta.validation.constraints.NotNull;
import java.util.Set;
import lombok.*;
import org.sopt.app.application.playground.dto.PlaygroundUserFindCondition;
Expand All @@ -13,8 +14,10 @@
public class RecommendedUserIds {

@Id
@NotNull
private String condition;

@NotNull
private Set<Long> userIds;

public RecommendedUserIds(final PlaygroundUserFindCondition request, final Set<Long> userIds) {
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/org/sopt/app/domain/entity/User.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.sopt.app.domain.entity;

import jakarta.validation.constraints.NotNull;
import lombok.*;
import java.util.Collection;
import java.util.Collections;
Expand All @@ -21,11 +22,14 @@ public class User extends BaseEntity implements UserDetails {
@Column(name = "user_id")
private Long id;

@NotNull
private String username;

@NotNull
@Column(unique = true)
private Long playgroundId;

@NotNull
private String playgroundToken;

@Builder
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.sopt.app.domain.entity.fortune;

import jakarta.persistence.*;
import jakarta.validation.constraints.NotNull;
import lombok.*;

@Getter
Expand All @@ -12,12 +13,16 @@ public class FortuneCard {
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;

@NotNull
private String name;

@NotNull
private String description;

@NotNull
@Column(columnDefinition = "TEXT")
private String imageUrl;

@NotNull
private String imageColorCode;
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import lombok.*;
import jakarta.persistence.*;
import jakarta.validation.constraints.NotNull;
import org.hibernate.annotations.ColumnDefault;
import org.sopt.app.domain.entity.BaseEntity;

@Getter
Expand All @@ -22,12 +23,16 @@ public class PokeHistory extends BaseEntity {
@NotNull
private Long pokedId;

@NotNull
@Column(columnDefinition = "TEXT")
private String message;

@NotNull
@ColumnDefault("false")
private Boolean isReply;

@NotNull
@ColumnDefault("false")
private Boolean isAnonymous;

public void activateReply() {
Expand Down
6 changes: 6 additions & 0 deletions src/main/java/org/sopt/app/domain/entity/soptamp/Mission.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@

import io.hypersistence.utils.hibernate.type.array.ListArrayType;
import jakarta.persistence.*;
import jakarta.validation.constraints.NotNull;
import java.util.List;
import lombok.*;
import org.hibernate.annotations.ColumnDefault;
import org.hibernate.annotations.Type;

@Entity
Expand All @@ -18,10 +20,14 @@ public class Mission {
@Column(name = "mission_id")
private Long id;

@NotNull
private String title;

@NotNull
private Integer level;

@NotNull
@ColumnDefault("false")
private boolean display;

@Type(value= ListArrayType.class)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.sopt.app.domain.entity.soptamp;

import jakarta.persistence.*;
import jakarta.validation.constraints.NotNull;
import lombok.*;
import org.sopt.app.domain.entity.BaseEntity;
import org.sopt.app.domain.enums.PlaygroundPart;
Expand All @@ -16,16 +17,22 @@ public class SoptampUser extends BaseEntity {
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;

@NotNull
private Long userId;

@NotNull
private String profileMessage;

@NotNull
private Long totalPoints;

@NotNull
private String nickname;

@NotNull
private Long generation;

@NotNull
private String part;

public void initTotalPoints() {
Expand Down
5 changes: 5 additions & 0 deletions src/main/java/org/sopt/app/domain/entity/soptamp/Stamp.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import io.hypersistence.utils.hibernate.type.array.ListArrayType;
import jakarta.persistence.*;
import jakarta.validation.constraints.NotNull;
import java.util.List;
import lombok.*;
import org.hibernate.annotations.Type;
Expand All @@ -18,16 +19,20 @@ public class Stamp extends BaseEntity {
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;

@NotNull
private String contents;

@Column(columnDefinition = "text[]")
@Type(value= ListArrayType.class)
private List<String> images;

@NotNull
private Long userId;

@NotNull
private Long missionId;

@NotNull
@Column(length = 10)
private String activityDate;

Expand Down
Loading