first implementation
This commit is contained in:
122
backend/src/main/java/com/aiteacher/book/Book.java
Normal file
122
backend/src/main/java/com/aiteacher/book/Book.java
Normal file
@@ -0,0 +1,122 @@
|
||||
package com.aiteacher.book;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
import java.time.Instant;
|
||||
import java.util.UUID;
|
||||
|
||||
@Entity
|
||||
@Table(name = "book")
|
||||
public class Book {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.UUID)
|
||||
private UUID id;
|
||||
|
||||
@Column(name = "title", nullable = false, length = 500)
|
||||
private String title;
|
||||
|
||||
@Column(name = "file_name", nullable = false, length = 500)
|
||||
private String fileName;
|
||||
|
||||
@Column(name = "file_size_bytes", nullable = false)
|
||||
private long fileSizeBytes;
|
||||
|
||||
@Column(name = "page_count")
|
||||
private Integer pageCount;
|
||||
|
||||
@Enumerated(EnumType.STRING)
|
||||
@Column(name = "status", nullable = false, length = 20)
|
||||
private BookStatus status;
|
||||
|
||||
@Column(name = "error_message", columnDefinition = "TEXT")
|
||||
private String errorMessage;
|
||||
|
||||
@Column(name = "uploaded_at", nullable = false)
|
||||
private Instant uploadedAt;
|
||||
|
||||
@Column(name = "processed_at")
|
||||
private Instant processedAt;
|
||||
|
||||
// Constructors
|
||||
|
||||
public Book() {
|
||||
}
|
||||
|
||||
public Book(String title, String fileName, long fileSizeBytes) {
|
||||
this.title = title;
|
||||
this.fileName = fileName;
|
||||
this.fileSizeBytes = fileSizeBytes;
|
||||
this.status = BookStatus.PENDING;
|
||||
this.uploadedAt = Instant.now();
|
||||
}
|
||||
|
||||
// Getters & Setters
|
||||
|
||||
public UUID getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public String getFileName() {
|
||||
return fileName;
|
||||
}
|
||||
|
||||
public void setFileName(String fileName) {
|
||||
this.fileName = fileName;
|
||||
}
|
||||
|
||||
public long getFileSizeBytes() {
|
||||
return fileSizeBytes;
|
||||
}
|
||||
|
||||
public void setFileSizeBytes(long fileSizeBytes) {
|
||||
this.fileSizeBytes = fileSizeBytes;
|
||||
}
|
||||
|
||||
public Integer getPageCount() {
|
||||
return pageCount;
|
||||
}
|
||||
|
||||
public void setPageCount(Integer pageCount) {
|
||||
this.pageCount = pageCount;
|
||||
}
|
||||
|
||||
public BookStatus getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(BookStatus status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public String getErrorMessage() {
|
||||
return errorMessage;
|
||||
}
|
||||
|
||||
public void setErrorMessage(String errorMessage) {
|
||||
this.errorMessage = errorMessage;
|
||||
}
|
||||
|
||||
public Instant getUploadedAt() {
|
||||
return uploadedAt;
|
||||
}
|
||||
|
||||
public void setUploadedAt(Instant uploadedAt) {
|
||||
this.uploadedAt = uploadedAt;
|
||||
}
|
||||
|
||||
public Instant getProcessedAt() {
|
||||
return processedAt;
|
||||
}
|
||||
|
||||
public void setProcessedAt(Instant processedAt) {
|
||||
this.processedAt = processedAt;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user