We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 82a009c commit deef6b1Copy full SHA for deef6b1
src/main/java/com/otavio/aifoodapp/dto/UserDTO.java
@@ -0,0 +1,19 @@
1
+package com.otavio.aifoodapp.dto;
2
+
3
+import com.otavio.aifoodapp.model.User;
4
5
+public record UserDTO(
6
+ Long id,
7
+ String email,
8
+ String name,
9
+ String role
10
+) {
11
+ public static UserDTO fromUser(User user) {
12
+ return new UserDTO(
13
+ user.getId(),
14
+ user.getEmail(),
15
+ user.getUsername(),
16
+ user.getRole() != null ? user.getRole().toString() : "USER"
17
+ );
18
+ }
19
+}
0 commit comments