From 8c410bc7080cd196072683cad80c4a5238d52f3a Mon Sep 17 00:00:00 2001 From: Javi <102818127+jrodriguezs2020@users.noreply.github.com> Date: Tue, 14 Jan 2025 17:41:22 +0100 Subject: [PATCH] more tests --- .../com/snapstudy/backend/TestDataInitializer.java | 3 --- .../restController/DocumentRestController.java | 14 ++++++++++++++ 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/backend/src/main/java/com/snapstudy/backend/TestDataInitializer.java b/backend/src/main/java/com/snapstudy/backend/TestDataInitializer.java index f58c56b..e83cc53 100644 --- a/backend/src/main/java/com/snapstudy/backend/TestDataInitializer.java +++ b/backend/src/main/java/com/snapstudy/backend/TestDataInitializer.java @@ -95,10 +95,7 @@ public void init() throws Exception { subjectRepository.save(s9); RepositoryDocument newRepo = new RepositoryDocument(d1.getId(), s1.getId()); - RepositoryDocument newRepo2 = new RepositoryDocument(d2.getId(), s2.getId()); - repodocumentRepository.save(newRepo); - repodocumentRepository.save(newRepo2); Document dt1 = new Document("Tema 1", "Prueba", s1, newRepo.getId(), ".pdf"); Document dt2 = new Document("Tema 2", "Prueba", s1, newRepo.getId(), ".pdf"); diff --git a/backend/src/main/java/com/snapstudy/backend/restController/DocumentRestController.java b/backend/src/main/java/com/snapstudy/backend/restController/DocumentRestController.java index 8d2ff20..5eacd92 100644 --- a/backend/src/main/java/com/snapstudy/backend/restController/DocumentRestController.java +++ b/backend/src/main/java/com/snapstudy/backend/restController/DocumentRestController.java @@ -281,6 +281,13 @@ public ResponseEntity apiTest(@RequestBody MultipartFile file, @PathVa } Long subjectId = subject.get().getId(); + System.out.println("----------------------------------------"); + System.out.println("----------------------------------------"); + System.out.println(subjectId); + System.out.println(degreeId); + System.out.println("----------------------------------------"); + System.out.println("----------------------------------------"); + if (file == null || degreeId == null || subject == null) { return new ResponseEntity<>(HttpStatus.BAD_REQUEST); } @@ -295,6 +302,13 @@ public ResponseEntity apiTest(@RequestBody MultipartFile file, @PathVa public ResponseEntity saveDocumentLogic(MultipartFile file, Degree degree, Subject subject) { + System.out.println("----------------------------------------"); + System.out.println("----------------------------------------"); + System.out.println(subject.getId()); + System.out.println(degree.getId()); + System.out.println("----------------------------------------"); + System.out.println("----------------------------------------"); + String path = "RepositoryDocuments/" + degree.getName() + "/" + subject.getName(); RepositoryDocument repository = getRepository(degree.getId(), subject.getId(), path); if (repository == null) {