1 | package edu.ucsb.cs156.happiercows.entities; | |
2 | ||
3 | import lombok.AllArgsConstructor; | |
4 | import lombok.Data; | |
5 | import lombok.NoArgsConstructor; | |
6 | import lombok.AccessLevel; | |
7 | import lombok.Builder; | |
8 | ||
9 | import javax.persistence.CascadeType; | |
10 | import javax.persistence.Entity; | |
11 | import javax.persistence.FetchType; | |
12 | import javax.persistence.GeneratedValue; | |
13 | import javax.persistence.GenerationType; | |
14 | import javax.persistence.Id; | |
15 | import javax.persistence.JoinTable; | |
16 | import javax.persistence.ManyToMany; | |
17 | import javax.persistence.JoinColumn; | |
18 | ||
19 | import com.fasterxml.jackson.annotation.JsonManagedReference; | |
20 | ||
21 | import java.util.List; | |
22 | ||
23 | @Data | |
24 | @AllArgsConstructor | |
25 | @NoArgsConstructor(access = AccessLevel.PROTECTED) | |
26 | @Builder | |
27 | @Entity(name = "users") | |
28 | public class User { | |
29 | @Id | |
30 | @GeneratedValue(strategy = GenerationType.IDENTITY) | |
31 | private long id; | |
32 | private String email; | |
33 | private String googleSub; | |
34 | private String pictureUrl; | |
35 | private String fullName; | |
36 | private String givenName; | |
37 | private String familyName; | |
38 | private boolean emailVerified; | |
39 | private String locale; | |
40 | private String hostedDomain; | |
41 | private boolean admin; | |
42 | ||
43 | @ManyToMany(fetch = FetchType.EAGER, cascade = {CascadeType.PERSIST,CascadeType.REMOVE}) | |
44 | @JoinTable(name = "user_commons", | |
45 | joinColumns = @JoinColumn(name = "user_id", referencedColumnName = "id"), | |
46 | inverseJoinColumns = @JoinColumn(name = "commons_id", referencedColumnName = "id")) | |
47 | private List<Commons> commons; | |
48 | ||
49 | @Override public String toString() { | |
50 |
1
1. toString : replaced return value with "" for edu/ucsb/cs156/happiercows/entities/User::toString → KILLED |
return String.format("User: id=%d email=%s",id,email); |
51 | } | |
52 | } | |
Mutations | ||
50 |
1.1 |