File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2626@ RestController
2727public class UploadsController {
2828 private final UploadRepository uploadRepository ;
29+ private static final String DESCRIPTION_HEADER_NAME = "TM-Description" ;
2930
3031 public UploadsController (UploadRepository uploadRepository ) {
3132 this .uploadRepository = uploadRepository ;
@@ -63,6 +64,7 @@ public ResponseEntity<byte[]> getUpload(
6364
6465 return ResponseEntity .ok ()
6566 .header ("Content-Type" , upload .getMimeType ())
67+ .header (DESCRIPTION_HEADER_NAME , upload .getDescription ())
6668 .lastModified (upload .getLastModified ().toInstant ())
6769 .contentLength (upload .getContentLength ())
6870 .cacheControl (CacheControl .noCache ().cachePublic ())
@@ -79,6 +81,7 @@ public ResponseEntity<byte[]> getLatestUpload(@PathVariable String category) {
7981 .findFirstWithContentByCategoryOrderByLastModifiedDesc (category )
8082 .map (upload -> ResponseEntity .ok ()
8183 .header ("Content-Type" , upload .getMimeType ())
84+ .header (DESCRIPTION_HEADER_NAME , upload .getDescription ())
8285 .lastModified (upload .getLastModified ().toInstant ())
8386 .contentLength (upload .getContentLength ())
8487 .cacheControl (CacheControl .noCache ().cachePublic ())
Original file line number Diff line number Diff line change @@ -58,6 +58,8 @@ public class Upload extends AuditMetadata {
5858
5959 private String hash ;
6060
61+ private String description ;
62+
6163 // <editor-fold desc="getters and setters">
6264 public int getContentLength () {
6365 return getContent () == null ? 0 : content .length ;
@@ -163,4 +165,13 @@ public void computeHash() {
163165 this .hash = null ;
164166 }
165167 }
168+
169+ public String getDescription () {
170+ return description ;
171+ }
172+
173+ public Upload setDescription (String description ) {
174+ this .description = description ;
175+ return this ;
176+ }
166177}
Original file line number Diff line number Diff line change @@ -31,4 +31,6 @@ public interface UploadSummary {
3131 OffsetDateTime getLastModified ();
3232
3333 int getContentLength ();
34+
35+ String getDescription ();
3436}
Original file line number Diff line number Diff line change 1+ alter table if exists upload
2+ add column description varchar (255 ) default null ;
3+
4+ alter table if exists history .upload_revisions
5+ add column description varchar (255 ) default null ;
You can’t perform that action at this time.
0 commit comments