fix(backend): add @Builder.Default to entity fields and add unit test suite

This commit is contained in:
Shanmuga Krishnan S M
2026-08-20 10:14:29 +05:30
parent 4e2edb7c52
commit 128e033a9a
5 changed files with 127 additions and 0 deletions

View File

@@ -30,11 +30,14 @@ public class CommunityAnswer {
private String author;
@Column(name = "upvotes")
@Builder.Default
private Integer upvotes = 0;
@Column(name = "is_accepted")
@Builder.Default
private Boolean isAccepted = false;
@Column(name = "created_at")
@Builder.Default
private LocalDateTime createdAt = LocalDateTime.now();
}

View File

@@ -29,15 +29,19 @@ public class CommunityQuestion {
private String author;
@Column(name = "upvotes")
@Builder.Default
private Integer upvotes = 0;
@Column(name = "tags", columnDefinition = "text[]")
@Builder.Default
private List<String> tags = new ArrayList<>();
@Column(name = "is_answered")
@Builder.Default
private Boolean isAnswered = false;
@Column(name = "created_at")
@Builder.Default
private LocalDateTime createdAt = LocalDateTime.now();
@OneToMany(mappedBy = "question", cascade = CascadeType.ALL, fetch = FetchType.EAGER)

View File

@@ -39,8 +39,10 @@ public class NotePyq {
private String fileSize;
@Column(name = "downloads_count")
@Builder.Default
private Integer downloadsCount = 0;
@Column(name = "uploaded_at")
@Builder.Default
private LocalDateTime uploadedAt = LocalDateTime.now();
}