| 1 | package edu.ucsb.cs156.frontiers.models; | |
| 2 | ||
| 3 | import edu.ucsb.cs156.frontiers.entities.User; | |
| 4 | import lombok.AllArgsConstructor; | |
| 5 | import lombok.Builder; | |
| 6 | import lombok.Data; | |
| 7 | ||
| 8 | @Data | |
| 9 | @AllArgsConstructor | |
| 10 | @Builder | |
| 11 | public class UserDataDTO { | |
| 12 | private long id; | |
| 13 | private String email; | |
| 14 | private String googleSub; | |
| 15 | private String pictureUrl; | |
| 16 | private String fullName; | |
| 17 | private String givenName; | |
| 18 | private String familyName; | |
| 19 | private boolean admin; | |
| 20 | private boolean instructor; | |
| 21 | ||
| 22 | public static UserDataDTO from(User user, boolean isAdmin, boolean isInstructor) { | |
| 23 | UserDataDTO dto = | |
| 24 | UserDataDTO.builder() | |
| 25 | .id(user.getId()) | |
| 26 | .email(user.getEmail()) | |
| 27 | .googleSub(user.getGoogleSub()) | |
| 28 | .pictureUrl(user.getPictureUrl()) | |
| 29 | .fullName(user.getFullName()) | |
| 30 | .givenName(user.getGivenName()) | |
| 31 | .familyName(user.getFamilyName()) | |
| 32 | .admin(isAdmin) | |
| 33 | .instructor(isInstructor) | |
| 34 | .build(); | |
| 35 |
1
1. from : replaced return value with null for edu/ucsb/cs156/frontiers/models/UserDataDTO::from → KILLED |
return dto; |
| 36 | } | |
| 37 | } | |
Mutations | ||
| 35 |
1.1 |