feat: implement Q&A database persistence and Telegram bot integration
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
package com.rit.portal.entity;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import jakarta.persistence.*;
|
||||
import lombok.*;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Entity
|
||||
@Table(name = "community_answers")
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
public class CommunityAnswer {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Integer id;
|
||||
|
||||
@ManyToOne(fetch = FetchType.LAZY)
|
||||
@JoinColumn(name = "question_id", nullable = false)
|
||||
@JsonIgnore
|
||||
private CommunityQuestion question;
|
||||
|
||||
@Column(nullable = false, columnDefinition = "TEXT")
|
||||
private String body;
|
||||
|
||||
@Column(nullable = false)
|
||||
private String author;
|
||||
|
||||
@Column(name = "upvotes")
|
||||
private Integer upvotes = 0;
|
||||
|
||||
@Column(name = "is_accepted")
|
||||
private Boolean isAccepted = false;
|
||||
|
||||
@Column(name = "created_at")
|
||||
private LocalDateTime createdAt = LocalDateTime.now();
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package com.rit.portal.entity;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
import lombok.*;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Entity
|
||||
@Table(name = "community_questions")
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
public class CommunityQuestion {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Integer id;
|
||||
|
||||
@Column(nullable = false)
|
||||
private String title;
|
||||
|
||||
@Column(nullable = false, columnDefinition = "TEXT")
|
||||
private String body;
|
||||
|
||||
@Column(nullable = false)
|
||||
private String author;
|
||||
|
||||
@Column(name = "upvotes")
|
||||
private Integer upvotes = 0;
|
||||
|
||||
@Column(name = "tags", columnDefinition = "text[]")
|
||||
private List<String> tags = new ArrayList<>();
|
||||
|
||||
@Column(name = "is_answered")
|
||||
private Boolean isAnswered = false;
|
||||
|
||||
@Column(name = "created_at")
|
||||
private LocalDateTime createdAt = LocalDateTime.now();
|
||||
|
||||
@OneToMany(mappedBy = "question", cascade = CascadeType.ALL, fetch = FetchType.EAGER)
|
||||
@Builder.Default
|
||||
private List<CommunityAnswer> answers = new ArrayList<>();
|
||||
}
|
||||
@@ -15,7 +15,7 @@ public class NotePyq {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
private Integer id;
|
||||
|
||||
@Column(nullable = false)
|
||||
private String title;
|
||||
|
||||
Reference in New Issue
Block a user