[e6b2246] | 1 | package com.example.moviezone.model;
|
---|
| 2 |
|
---|
| 3 | import lombok.Getter;
|
---|
| 4 | import lombok.Setter;
|
---|
| 5 | import lombok.ToString;
|
---|
[2269653] | 6 | import org.hibernate.Hibernate;
|
---|
[ac25203] | 7 | import org.springframework.security.core.GrantedAuthority;
|
---|
| 8 |
|
---|
[2269653] | 9 | import javax.persistence.Entity;
|
---|
| 10 | import javax.persistence.PrimaryKeyJoinColumn;
|
---|
| 11 | import javax.persistence.Table;
|
---|
| 12 | import java.time.LocalDate;
|
---|
[ac25203] | 13 | import java.util.Collection;
|
---|
| 14 | import java.util.Collections;
|
---|
[2269653] | 15 | import java.util.Objects;
|
---|
[e6b2246] | 16 | @Entity
|
---|
| 17 | @Getter
|
---|
| 18 | @Setter
|
---|
| 19 | @ToString
|
---|
| 20 | @Table(name = "customers")
|
---|
| 21 | @PrimaryKeyJoinColumn(name = "id_customer")
|
---|
| 22 | public class Customer extends User{
|
---|
| 23 |
|
---|
| 24 |
|
---|
| 25 | Integer points;
|
---|
| 26 |
|
---|
[6032d44] | 27 | public Customer(String password, String first_name, String last_name, String address, String contact_number, String username) {
|
---|
| 28 | super(password, first_name, last_name, address, contact_number, username);
|
---|
[1b0bd1e] | 29 | points=0;
|
---|
[6032d44] | 30 | }
|
---|
| 31 |
|
---|
| 32 | public Customer() {
|
---|
| 33 |
|
---|
| 34 | }
|
---|
[27adfc8] | 35 |
|
---|
[d7f5da9] | 36 | @Override
|
---|
| 37 | public boolean equals(Object o) {
|
---|
| 38 | if (this == o) return true;
|
---|
| 39 | if (o == null || getClass() != o.getClass()) return false;
|
---|
| 40 | Customer customer = (Customer) o;
|
---|
| 41 | return id_user!=null && Objects.equals(id_user,customer.id_user);
|
---|
| 42 | }
|
---|
| 43 |
|
---|
| 44 | @Override
|
---|
| 45 | public int hashCode() {
|
---|
| 46 | return Objects.hash();
|
---|
| 47 | }
|
---|
| 48 |
|
---|
[ac25203] | 49 | @Override
|
---|
| 50 | public Collection<? extends GrantedAuthority> getAuthorities() {
|
---|
[27adfc8] | 51 | return Collections.singletonList(Role.ROLE_USER);
|
---|
[ac25203] | 52 | }
|
---|
[e6b2246] | 53 |
|
---|
| 54 | }
|
---|