User.java
package edu.ucsb.cs156.dining.entities;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import lombok.AccessLevel;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.time.LocalDate;
/**
* This is a JPA entity that represents a user.
*/
@Data
@AllArgsConstructor
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@Builder
@Entity(name = "users")
public class User {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private long id;
private String email;
private String googleSub;
private String pictureUrl;
private String fullName;
private String givenName;
private String familyName;
private boolean emailVerified;
private String locale;
private String hostedDomain;
private boolean admin;
private String alias;
private String proposedAlias;
private String status;
private LocalDate dateApproved;
public String getAlias() {
if (this.alias == null) {
this.alias = "Anonymous User";
}
return this.alias;
}
}