From e5c0f6a616d6508fd063528093f4901ec1377cac Mon Sep 17 00:00:00 2001
From: Lucas Bertrand-Christen <l.b-c@hotmail.com>
Date: Fri, 17 Nov 2023 16:47:42 +0100
Subject: [PATCH] fix:created-by-rename

---
 .../filestore/api/resources/NodesResource.java | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/TD4/src/main/java/fr/miage23/filestore/api/resources/NodesResource.java b/TD4/src/main/java/fr/miage23/filestore/api/resources/NodesResource.java
index 5d4e533..ceb58e8 100644
--- a/TD4/src/main/java/fr/miage23/filestore/api/resources/NodesResource.java
+++ b/TD4/src/main/java/fr/miage23/filestore/api/resources/NodesResource.java
@@ -8,8 +8,10 @@ import com.google.gson.stream.JsonWriter;
 import fr.miage23.filestore.TypeNode;
 import fr.miage23.filestore.api.dto.CollectionDto;
 import fr.miage23.filestore.api.dto.GETNodeDto;
+import fr.miage23.filestore.api.dto.GETOutputNodeDto;
 import fr.miage23.filestore.api.dto.InputNodeDto;
 import fr.miage23.filestore.api.dto.POSTNodeDto;
+import fr.miage23.filestore.api.dto.POSTOutputNodeDto;
 import fr.miage23.filestore.files.FileService;
 import fr.miage23.filestore.files.InMemoryFileServiceBean;
 import fr.miage23.filestore.files.entity.Node;
@@ -57,8 +59,8 @@ public class NodesResource {
                     .create();
             Node node = service.get("root");
             return Response.ok(gson.toJson(
-                    (new GETNodeDto(node.getType(), node.getId(), node.getParent(), node.getName(), node.getSize(), node.getCreation(), node.getModification())),
-                            GETNodeDto.class),
+                    (new GETOutputNodeDto(node.getType(), node.getId(), node.getParent(), node.getName(), node.getSize(), node.getCreation(), node.getModification())),
+                            GETOutputNodeDto.class),
                     MediaType.APPLICATION_JSON).build();
         } catch (NodeNotFoundException e) {
             return Response.status(Response.Status.NOT_FOUND).entity("Node not found.").build();
@@ -111,8 +113,8 @@ public class NodesResource {
                 .create();
         Node node = service.get(id);
         return Response.ok(gson.toJson(
-                        (new GETNodeDto(node.getType(), node.getId(), node.getParent(), node.getName(), node.getSize(), node.getCreation(), node.getModification())),
-                        GETNodeDto.class),
+                        (new GETOutputNodeDto(node.getType(), node.getId(), node.getParent(), node.getName(), node.getSize(), node.getCreation(), node.getModification())),
+                        GETOutputNodeDto.class),
                 MediaType.APPLICATION_JSON).build();
     }
 
@@ -141,8 +143,8 @@ public class NodesResource {
         Node node = service.get(newid);
 
         return Response.ok(gson.toJson(
-                        (new POSTNodeDto(node.getId())),
-                        POSTNodeDto.class),
+                        (new POSTOutputNodeDto(node.getId())),
+                        POSTOutputNodeDto.class),
                 MediaType.APPLICATION_JSON).build();
     }
 
@@ -173,8 +175,8 @@ public class NodesResource {
                 .create();
         Node node = service.get(newid);
         return Response.ok(gson.toJson(
-                        (new POSTNodeDto(node.getId())),
-                        POSTNodeDto.class),
+                        (new POSTOutputNodeDto(node.getId())),
+                        POSTOutputNodeDto.class),
                 MediaType.APPLICATION_JSON).build();
     }
 
-- 
GitLab