| 1 | package edu.ucsb.cs156.organic.entities; | |
| 2 | ||
| 3 | import lombok.*; | |
| 4 | ||
| 5 | import javax.persistence.*; | |
| 6 | ||
| 7 | import org.hibernate.annotations.Fetch; | |
| 8 | import org.hibernate.annotations.FetchMode; | |
| 9 | ||
| 10 | import java.time.Instant; | |
| 11 | import java.time.ZoneId; | |
| 12 | import java.time.format.DateTimeFormatter; | |
| 13 | import java.util.List; | |
| 14 | ||
| 15 | @Data | |
| 16 | @AllArgsConstructor | |
| 17 | @NoArgsConstructor(access = AccessLevel.PROTECTED) | |
| 18 | @Builder | |
| 19 | @Entity(name = "users") | |
| 20 | public class User { | |
| 21 | @Id | |
| 22 | private Integer githubId; | |
| 23 | private String githubNodeId; | |
| 24 | private String githubLogin; | |
| 25 | private String email; | |
| 26 | private String pictureUrl; | |
| 27 | private String fullName; | |
| 28 | private boolean emailVerified; | |
| 29 | private boolean admin; | |
| 30 | private boolean instructor; | |
| 31 | private String accessToken; | |
| 32 | ||
| 33 | @OneToMany(mappedBy = "user", cascade = CascadeType.REMOVE) @Fetch(FetchMode.JOIN) | |
| 34 | private List<UserEmail> emails; | |
| 35 | ||
| 36 | @Builder.Default | |
| 37 | private String lastOnline = Instant.now().toString(); | |
| 38 | ||
| 39 | @Override | |
| 40 | public String toString() { | |
| 41 |
1
1. toString : replaced return value with "" for edu/ucsb/cs156/organic/entities/User::toString → KILLED |
return String.format("User: githubId=%d githubLogin=%s admin=%s", githubId, githubLogin, this.admin); |
| 42 | } | |
| 43 | } | |
Mutations | ||
| 41 |
1.1 |