Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ public class DocumentVersion extends BaseTimeEntity {

private int version;

private String title;

private String originFileName;

private String fileKey;
Expand All @@ -33,12 +35,14 @@ public class DocumentVersion extends BaseTimeEntity {
@Builder
public DocumentVersion(
final int version,
final String title,
final String originFileName,
final String fileKey,
final Long fileSize,
final Document document
) {
this.version = version;
this.title = title;
this.originFileName = originFileName;
this.fileKey = fileKey;
this.fileSize = fileSize;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
import jakarta.validation.constraints.*;

public record DocumentRequest(
@NotBlank(message = "문서 제목은 비어있을 수 없습니다.")
@Size(max = 100, message = "문서 제목은 100자 이하여야 합니다.")
String title,

@NotBlank(message = "파일 이름은 비어있을 수 없습니다.")
@Pattern(regexp = "^[^/:*?\"<>|]+$",
message = "파일 이름에는 / : * ? \" < > | 문자를 사용할 수 없습니다.")
Expand All @@ -28,7 +32,7 @@ public Document toEntity(final User user) {
return Document.builder()
.user(user)
.documentType(fileType)
.title(fileName)
.title(title)
.build();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
public record DocumentVersionResponse(
Long id,
int version,
String title,
String fileName,
String fileUrl,
Long fileSize
Expand All @@ -16,6 +17,7 @@ public static DocumentVersionResponse of(final DocumentVersion documentVersion,
return DocumentVersionResponse.builder()
.id(documentVersion.getId())
.version(documentVersion.getVersion())
.title(documentVersion.getTitle())
.fileName(documentVersion.getOriginFileName())
.fileUrl(fileUrl)
.fileSize(documentVersion.getFileSize())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ private Long saveDocumentVersion(final Long userId, final Document document, fin

DocumentVersion documentVersion = DocumentVersion.builder()
.version(version)
.title(request.title())
.originFileName(request.fileName())
.fileKey(request.fileKey())
.fileSize(fileSize)
Expand Down
Loading