| 1 | package edu.ucsb.cs156.dining.entities; | |
| 2 | ||
| 3 | import com.fasterxml.jackson.annotation.JsonIgnore; | |
| 4 | import edu.ucsb.cs156.dining.statuses.ModerationStatus; | |
| 5 | import jakarta.persistence.*; | |
| 6 | import lombok.*; | |
| 7 | import org.hibernate.annotations.Fetch; | |
| 8 | import org.hibernate.annotations.FetchMode; | |
| 9 | ||
| 10 | import java.time.LocalDate; | |
| 11 | import java.util.List; | |
| 12 | ||
| 13 | /** | |
| 14 | * This is a JPA entity that represents a user. | |
| 15 | */ | |
| 16 | ||
| 17 | @Data | |
| 18 | @AllArgsConstructor | |
| 19 | @NoArgsConstructor(access = AccessLevel.PROTECTED) | |
| 20 | @Builder | |
| 21 | @Entity(name = "users") | |
| 22 | public class User { | |
| 23 | @Id | |
| 24 | @GeneratedValue(strategy = GenerationType.IDENTITY) | |
| 25 | private long id; | |
| 26 | private String email; | |
| 27 | private String googleSub; | |
| 28 | private String pictureUrl; | |
| 29 | private String fullName; | |
| 30 | private String givenName; | |
| 31 | private String familyName; | |
| 32 | private boolean emailVerified; | |
| 33 | private String locale; | |
| 34 | private String hostedDomain; | |
| 35 | private boolean admin; | |
| 36 | private boolean moderator; | |
| 37 | private String alias; | |
| 38 | private String proposedAlias; | |
| 39 | @Enumerated(EnumType.STRING) | |
| 40 | private ModerationStatus status; | |
| 41 | private LocalDate dateApproved; | |
| 42 | ||
| 43 | @ToString.Exclude | |
| 44 | @JsonIgnore | |
| 45 | @OneToMany(mappedBy="reviewer") | |
| 46 | @Fetch(FetchMode.JOIN) | |
| 47 | private List<Review> reviews; | |
| 48 | | |
| 49 | public String getAlias() { | |
| 50 |
1
1. getAlias : negated conditional → KILLED |
if (this.alias == null) { |
| 51 | this.alias = "Anonymous User"; | |
| 52 | } | |
| 53 |
1
1. getAlias : replaced return value with "" for edu/ucsb/cs156/dining/entities/User::getAlias → KILLED |
return this.alias; |
| 54 | } | |
| 55 | } | |
Mutations | ||
| 50 |
1.1 |
|
| 53 |
1.1 |