source: phonelux-backend/src/main/java/finki/it/phoneluxbackend/entities/Phone.java

Last change on this file was ffd50db, checked in by Marko <Marko@…>, 2 years ago

Added few methods in PhoneOffer service

  • Property mode set to 100644
File size: 1.2 KB
Line 
1package finki.it.phoneluxbackend.entities;
2
3import com.fasterxml.jackson.annotation.JsonIgnore;
4import lombok.*;
5
6import javax.persistence.*;
7import java.util.List;
8
9@AllArgsConstructor
10@NoArgsConstructor
11@Getter
12@Setter
13@ToString
14@Entity(name = "Phone")
15@Table(name = "phones")
16public class Phone {
17 @Id
18 @Column(name = "id")
19 private Long id;
20
21 @Column(name = "brand")
22 private String brand;
23
24 @Column(name = "model")
25 private String model;
26
27 @Column(name = "image_url")
28 private String image_url;
29
30 @Column(name = "total_offers")
31 private Integer total_offers;
32
33 @Column(name = "lowest_price")
34 private Integer lowestPrice;
35
36 @OneToMany(fetch = FetchType.LAZY, mappedBy = "phone")
37 @JsonIgnore
38 private List<PhoneOffer> phoneOffers;
39
40 public Phone(String brand, String model) {
41 this.brand = brand;
42 this.model = model;
43 }
44
45 public Phone(Long id, String brand, String model, String image_url, Integer total_offers, Integer lowestPrice) {
46 this.id = id;
47 this.brand = brand;
48 this.model = model;
49 this.image_url = image_url;
50 this.total_offers = total_offers;
51 this.lowestPrice = lowestPrice;
52 }
53}
Note: See TracBrowser for help on using the repository browser.