source: src/main/java/com/example/moviezone/model/Customer.java@ 0ba5d1a

Last change on this file since 0ba5d1a was d7f5da9, checked in by milamihajlovska <mila.mihajlovska01@…>, 22 months ago

changes for login (not working)

  • Property mode set to 100644
File size: 1.3 KB
Line 
1package com.example.moviezone.model;
2
3import lombok.Getter;
4import lombok.Setter;
5import lombok.ToString;
6import org.hibernate.Hibernate;
7import org.springframework.security.core.GrantedAuthority;
8
9import javax.persistence.Entity;
10import javax.persistence.PrimaryKeyJoinColumn;
11import javax.persistence.Table;
12import java.time.LocalDate;
13import java.util.Collection;
14import java.util.Collections;
15import java.util.Objects;
16@Entity
17@Getter
18@Setter
19@ToString
20@Table(name = "customers")
21@PrimaryKeyJoinColumn(name = "id_customer")
22public class Customer extends User{
23
24
25 Integer points;
26
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);
29 }
30
31 public Customer() {
32
33 }
34
35 @Override
36 public boolean equals(Object o) {
37 if (this == o) return true;
38 if (o == null || getClass() != o.getClass()) return false;
39 Customer customer = (Customer) o;
40 return id_user!=null && Objects.equals(id_user,customer.id_user);
41 }
42
43 @Override
44 public int hashCode() {
45 return Objects.hash();
46 }
47
48 @Override
49 public Collection<? extends GrantedAuthority> getAuthorities() {
50 return Collections.singletonList(Role.ROLE_USER);
51 }
52
53}
Note: See TracBrowser for help on using the repository browser.