feat:add last-modified-at for both file and folder#23
feat:add last-modified-at for both file and folder#23JoaoCosme wants to merge 1 commit intoVault-Web:mainfrom
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR adds last-modified timestamp tracking for both files and folders by introducing a lastModifiedAt field (in milliseconds) to the FileDto and FolderDto classes. The FolderService is updated to read and populate these timestamps from filesystem attributes.
Key Changes
- Added
lastModifiedAtfield to bothFileDtoandFolderDto - Updated
FolderService.readFolder()to read filesystem attributes and populate the new timestamp fields - Minor import reordering for better code organization
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| backend/src/main/java/cloudpage/dto/FileDto.java | Added lastModifiedAt field to store file modification timestamp |
| backend/src/main/java/cloudpage/dto/FolderDto.java | Added lastModifiedAt field to store folder modification timestamp |
| backend/src/main/java/cloudpage/service/FolderService.java | Updated to read and populate lastModifiedAt for files and folders using filesystem attributes |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| folderAttrs.lastModifiedTime().toMillis() | ||
| ); | ||
| } catch (IOException e) { | ||
| throw new FileDeletionException("Failed to read folder attributes: " + path + " with exception: " + e.getMessage()); |
There was a problem hiding this comment.
Using FileDeletionException for a read operation is misleading. This exception should only be used for deletion failures. Consider creating a new exception type like FileReadException or use a more generic exception like RuntimeException with a descriptive message.
| attrs.lastModifiedTime().toMillis() | ||
| ); | ||
| } catch (IOException e) { | ||
| throw new FileDeletionException("Failed to read: " + filePath + "with exception : " + e.getMessage()); |
There was a problem hiding this comment.
Missing space before 'with exception'. Should be 'with exception :' (note: this is a pre-existing issue that also affects line 71).
There was a problem hiding this comment.
Please fix this, also in Line 71 as Copilot mentioned.
DenizAltunkapan
left a comment
There was a problem hiding this comment.
Looks good overall! @JoaoCosme
| attrs.lastModifiedTime().toMillis() | ||
| ); | ||
| } catch (IOException e) { | ||
| throw new FileDeletionException("Failed to read: " + filePath + "with exception : " + e.getMessage()); |
There was a problem hiding this comment.
Please fix this, also in Line 71 as Copilot mentioned.
| folderAttrs.lastModifiedTime().toMillis() | ||
| ); | ||
| } catch (IOException e) { | ||
| throw new FileDeletionException("Failed to read folder attributes: " + path + " with exception: " + e.getMessage()); |
Resolves #14