@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
@Entity(name = "authority")
public class Authority {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id; // PK
@Column(length = 40, nullable = false, unique = true) // 제약조건
private String name; // 권한명 ex) "ROLE_MEMBER", "ROLE_ADMIN"
}
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
@Entity(name = "user")
public class User {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@Column(unique = true, nullable = false)
private String username;
@Column(nullable = false)
@JsonIgnore
private String password;
@Transient // DB 에 반영 안함. (영속화 하지 않음)
@ToString.Exclude // toString() 결과에서 뺌.
@JsonIgnore
private String re_password; // 비밀번호 확인 입력
@ManyToMany(fetch = FetchType.EAGER)
@ToString.Exclude
@Builder.Default
@JsonIgnore
private List<Authority> authorities = new ArrayList<>();
public void addAuthoriy(Authority... authorities){
Collections.addAll(this.authorities, authorities);
} // 권한 변경
private LocalDateTime delete_at;
}
package com.lec.bt70_JPA_KANBAN.domain;
import jakarta.persistence.*;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.time.LocalDateTime;
@Data
@NoArgsConstructor
@Builder
@AllArgsConstructor
@Entity(name="board")
public class Board {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
@Column(nullable = false)
private LocalDateTime created_at;
@Column(nullable = false)
private LocalDateTime modified_at;
@Column(nullable = false)
private String board_name;
@Column(nullable = false)
private String board_info;
private ColorEnum color;
private LocalDateTime delete_at;
}
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
@Entity(name="cards")
public class Cards {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long card_id;
@Column(nullable = false)
private String title;
@Column(nullable = false)
private String contnet;
private LocalDateTime deadline;
@Column(nullable = false)
private LocalDateTime created_at;
@Column(nullable = false)
private LocalDateTime modified_at;
private LocalDateTime deleted_at;
}
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Entity(name="colums")
public class Colums {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
@Column(nullable = false)
private String title;
private LocalDateTime deleted_at;
@ManyToOne(optional = false) // notnull+빈값이 들어가면 안딤
@JoinColumn(name = "board_id")
@Column(nullable = false)
private Board board;
}
@Data
@AllArgsConstructor
@NoArgsConstructor
@Entity(name="comments")
public class Comments {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long comment_id;
@Column(nullable = false)
private String content;
@Column(nullable = false)
private LocalDateTime created_at;
@Column(nullable = false)
private LocalDateTime modified;
@Column(nullable = false)
private LocalDateTime deleted_at;
}
기존의 Postman은 맥북 카탈레나 10.15.7 버젼과 맞지 않아 Postman구버젼으로 쓰기
댓글 영역