Pull Request #3814
Add document fetch endpoint for sharing flow
Adds GET /api/documents/:id to power the new in-app sharing flow. Requires authentication via the existing JWT middleware.
Ready to merge
controller/DocumentController.java+28 additions
Viewed1
@RestController
2
@RequestMapping("/api/documents")
3
public class DocumentController {
4
@Autowired private DocumentService documentService;
6
+ @GetMapping("/{id}")
7
+ public ResponseEntity<Document> getDocument(
8
+ @PathVariable Long id,
9
+ @AuthenticationPrincipal UserDetails currentUser) {
10
+
11
+ Document doc = documentService.findById(id);
12
+
13
+ return ResponseEntity.ok(doc);
14
+ }
15
+ }
VL
vikram_lead
Approved review
Clean and simple. Auth middleware handles the authentication โ only logged-in users can call this. LGTM.