diff --git a/src/main/java/com/springboot/blog/entity/Category.java b/src/main/java/com/springboot/blog/entity/Category.java index 2426772f..639474e5 100644 --- a/src/main/java/com/springboot/blog/entity/Category.java +++ b/src/main/java/com/springboot/blog/entity/Category.java @@ -19,9 +19,15 @@ public class Category { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; + + @Column(nullable = false) private String name; + private String description; + @Column(unique = true, nullable = false) + private String slug; + @OneToMany(mappedBy = "category", cascade = CascadeType.ALL, orphanRemoval = true) private List posts; } diff --git a/src/main/java/com/springboot/blog/entity/User.java b/src/main/java/com/springboot/blog/entity/User.java index b6fbd154..2a5b3948 100644 --- a/src/main/java/com/springboot/blog/entity/User.java +++ b/src/main/java/com/springboot/blog/entity/User.java @@ -6,6 +6,7 @@ import lombok.NoArgsConstructor; import lombok.Setter; +import java.util.Date; import java.util.Set; @Setter @@ -19,14 +20,26 @@ public class User { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; + + @Column(nullable = false) private String name; + @Column(nullable = false, unique = true) private String username; + @Column(nullable = false, unique = true) private String email; + @Column(nullable = false) private String password; + private String address; + + @Column(unique = true) + private String postalCode; + + private Date birthDate; + @ManyToMany(fetch = FetchType.EAGER, cascade = CascadeType.ALL) @JoinTable(name = "users_roles", joinColumns = @JoinColumn(name = "user_id", referencedColumnName = "id"), diff --git a/src/main/java/com/springboot/blog/payload/CategoryDto.java b/src/main/java/com/springboot/blog/payload/CategoryDto.java index e14fffa5..980f37ea 100644 --- a/src/main/java/com/springboot/blog/payload/CategoryDto.java +++ b/src/main/java/com/springboot/blog/payload/CategoryDto.java @@ -12,5 +12,6 @@ public class CategoryDto { private Long id; private String name; + private String slug; private String description; }