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