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
2 changes: 2 additions & 0 deletions src/main/java/com/ucms_backend/dto/AttachmentResponse.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ public class AttachmentResponse {
private long sizeBytes;
private String signedUrl;
private LocalDateTime uploadedAt;
private String uploaderRole;

public static AttachmentResponse from(TicketAttachment attachment, String signedUrl) {
return AttachmentResponse.builder()
Expand All @@ -28,6 +29,7 @@ public static AttachmentResponse from(TicketAttachment attachment, String signed
.sizeBytes(attachment.getSizeBytes())
.signedUrl(signedUrl)
.uploadedAt(attachment.getUploadedAt())
.uploaderRole(attachment.getUploaderRole())
.build();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ public class TicketAttachment {
@Column(name = "uploaded_at", nullable = false)
private LocalDateTime uploadedAt;

@Column(name = "uploader_role", length = 20)
private String uploaderRole;

@PrePersist
void onPrePersist() {
if (uploadedAt == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ public AttachmentResponse uploadAttachment(Long ticketId, MultipartFile file) {
.originalFilename(originalFilename)
.mimeType(detectedMimeType)
.sizeBytes(file.getSize())
.uploaderRole(role)
.build();

TicketAttachment saved = ticketAttachmentRepository.save(attachment);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ALTER TABLE ticket_attachment
ADD COLUMN IF NOT EXISTS uploader_role VARCHAR(20);
Loading