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