| 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.sql.Timestamp; | |
| 11 | // import java.time.Instant; | |
| 12 | import java.util.List; | |
| 13 | ||
| 14 | @Data | |
| 15 | @AllArgsConstructor | |
| 16 | @NoArgsConstructor(access = AccessLevel.PROTECTED) | |
| 17 | @Builder | |
| 18 | @Entity(name = "users") | |
| 19 | public class User { | |
| 20 | @Id | |
| 21 | private Integer githubId; | |
| 22 | private String githubNodeId; | |
| 23 | private String githubLogin; | |
| 24 | private String email; | |
| 25 | private String pictureUrl; | |
| 26 | private String fullName; | |
| 27 | private boolean emailVerified; | |
| 28 | private boolean admin; | |
| 29 | private boolean instructor; | |
| 30 | private String accessToken; | |
| 31 | ||
| 32 | @OneToMany(mappedBy = "user", cascade = CascadeType.REMOVE) @Fetch(FetchMode.JOIN) | |
| 33 | private List<UserEmail> emails; | |
| 34 | ||
| 35 | @Builder.Default | |
| 36 | private Timestamp lastOnline = new Timestamp(System.currentTimeMillis()); | |
| 37 | ||
| 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 | } | |
| 44 | ||
Mutations | ||
| 41 |
1.1 |