diff --git a/server/src/main/java/com/mixel/docusphere/controller/UserController.java b/server/src/main/java/com/mixel/docusphere/controller/UserController.java index 5b9035f..75b1428 100644 --- a/server/src/main/java/com/mixel/docusphere/controller/UserController.java +++ b/server/src/main/java/com/mixel/docusphere/controller/UserController.java @@ -1,5 +1,6 @@ package com.mixel.docusphere.controller; +import com.mixel.docusphere.dto.UserDTO; import com.mixel.docusphere.entity.User; import com.mixel.docusphere.service.UserService; import org.springframework.beans.factory.annotation.Autowired; @@ -33,10 +34,16 @@ public class UserController { } @PostMapping - public User createUser(@RequestBody User user) { + public User createUser(@RequestBody UserDTO userDTO) { + User user = new User(); + user.setUsername(userDTO.getUsername()); + user.setName(userDTO.getName()); + user.setEmail(userDTO.getEmail()); + user.setPasswordHash(userDTO.getPassword()); return userService.save(user); } + // FIXME: Use DTO instead of entity @PutMapping("/{id}") public ResponseEntity updateUser(@PathVariable UUID id, @RequestBody User userDetails) { Optional user = userService.findById(id); diff --git a/server/src/main/java/com/mixel/docusphere/dto/DocumentDTO.java b/server/src/main/java/com/mixel/docusphere/dto/DocumentDTO.java new file mode 100644 index 0000000..0d2d592 --- /dev/null +++ b/server/src/main/java/com/mixel/docusphere/dto/DocumentDTO.java @@ -0,0 +1,6 @@ +package com.mixel.docusphere.dto; + +// FIXME: Implement document DTO +public class DocumentDTO { + +} diff --git a/server/src/main/java/com/mixel/docusphere/dto/UserDTO.java b/server/src/main/java/com/mixel/docusphere/dto/UserDTO.java new file mode 100644 index 0000000..be4df3b --- /dev/null +++ b/server/src/main/java/com/mixel/docusphere/dto/UserDTO.java @@ -0,0 +1,41 @@ +package com.mixel.docusphere.dto; + +public class UserDTO { + private String username; + private String name; + private String email; + private String password; + + // Getters and Setters + public String getUsername() { + return username; + } + + public void setUsername(String username) { + this.username = username; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } +} diff --git a/server/src/main/java/com/mixel/docusphere/entity/Document.java b/server/src/main/java/com/mixel/docusphere/entity/Document.java index a7f71c6..4948082 100644 --- a/server/src/main/java/com/mixel/docusphere/entity/Document.java +++ b/server/src/main/java/com/mixel/docusphere/entity/Document.java @@ -15,6 +15,9 @@ public class Document { @Column(name = "Name", nullable = false) private String name; + @Column(name = "Description", nullable = true) + private String description; + @Column(name = "S3Path", nullable = false) private String s3Path; diff --git a/server/src/main/java/com/mixel/docusphere/entity/User.java b/server/src/main/java/com/mixel/docusphere/entity/User.java index 6950ab6..48e87d5 100644 --- a/server/src/main/java/com/mixel/docusphere/entity/User.java +++ b/server/src/main/java/com/mixel/docusphere/entity/User.java @@ -1,5 +1,6 @@ package com.mixel.docusphere.entity; +import com.fasterxml.jackson.annotation.JsonIgnore; import jakarta.persistence.*; import java.time.LocalDateTime; import java.util.UUID; @@ -21,9 +22,11 @@ public class User { @Column(name = "Email", nullable = false, unique = true) private String email; + @JsonIgnore @Column(name = "PasswordHash", nullable = false) private String passwordHash; + @JsonIgnore @Column(name = "PasswordSalt", nullable = false) private String passwordSalt;