[b68ae8d] | 1 | package finki.it.phoneluxbackend.entities;
|
---|
| 2 |
|
---|
| 3 | import com.fasterxml.jackson.annotation.JsonIgnore;
|
---|
| 4 | import lombok.*;
|
---|
| 5 |
|
---|
| 6 | import javax.persistence.*;
|
---|
[f25d07e] | 7 | import java.util.ArrayList;
|
---|
[b68ae8d] | 8 | import java.util.Date;
|
---|
[f25d07e] | 9 | import java.util.List;
|
---|
[b68ae8d] | 10 |
|
---|
| 11 | @AllArgsConstructor
|
---|
| 12 | @NoArgsConstructor
|
---|
| 13 | @Getter
|
---|
| 14 | @Setter
|
---|
| 15 | @ToString
|
---|
[5201690] | 16 | @EqualsAndHashCode
|
---|
[b68ae8d] | 17 | @Entity(name = "PhoneOffer")
|
---|
| 18 | @Table(name = "phone_offers")
|
---|
| 19 | public class PhoneOffer {
|
---|
| 20 | @Id
|
---|
| 21 | @Column(name = "offer_id")
|
---|
| 22 | private Long id;
|
---|
| 23 |
|
---|
| 24 | @Column(name = "offer_shop")
|
---|
| 25 | private String offer_shop;
|
---|
| 26 |
|
---|
| 27 | @Column(name = "offer_name")
|
---|
| 28 | private String offer_name;
|
---|
| 29 |
|
---|
| 30 | @Column(name = "price")
|
---|
| 31 | private Integer price;
|
---|
| 32 |
|
---|
| 33 | @Column(name = "ram_memory")
|
---|
| 34 | private String ram_memory;
|
---|
| 35 |
|
---|
| 36 | @Column(name = "rom_memory")
|
---|
| 37 | private String rom_memory;
|
---|
| 38 |
|
---|
| 39 | @Column(name = "color")
|
---|
| 40 | private String color;
|
---|
| 41 |
|
---|
| 42 | @Column(name = "front_camera")
|
---|
| 43 | private String front_camera;
|
---|
| 44 |
|
---|
| 45 | @Column(name = "back_camera")
|
---|
| 46 | private String back_camera;
|
---|
| 47 |
|
---|
| 48 | @Column(name = "chipset")
|
---|
| 49 | private String chipset;
|
---|
| 50 |
|
---|
| 51 | @Column(name = "battery")
|
---|
| 52 | private String battery;
|
---|
| 53 |
|
---|
| 54 | @Column(name = "operating_system")
|
---|
| 55 | private String operating_system;
|
---|
| 56 |
|
---|
| 57 | @Column(name = "cpu")
|
---|
| 58 | private String cpu;
|
---|
| 59 |
|
---|
| 60 | @Column(name = "image_url")
|
---|
| 61 | private String image_url;
|
---|
| 62 |
|
---|
| 63 | @Column(name = "offer_url")
|
---|
| 64 | private String offer_url;
|
---|
| 65 |
|
---|
| 66 | @Column(name = "last_updated")
|
---|
| 67 | private Date last_updated;
|
---|
| 68 |
|
---|
| 69 | @Column(name = "is_validated")
|
---|
| 70 | private Boolean is_validated;
|
---|
| 71 |
|
---|
| 72 | @Column(name = "offer_description")
|
---|
| 73 | private String offer_description;
|
---|
| 74 |
|
---|
| 75 | @Column(name = "offer_shop_code")
|
---|
| 76 | private String offer_shop_code;
|
---|
| 77 |
|
---|
[f25d07e] | 78 | @ManyToMany(mappedBy = "favouriteOffers")
|
---|
[5201690] | 79 | @JsonIgnore
|
---|
[f25d07e] | 80 | private List<User> users = new ArrayList<User>();
|
---|
| 81 |
|
---|
[b68ae8d] | 82 | @ManyToOne(fetch = FetchType.LAZY)
|
---|
| 83 | @JoinColumn(name = "phone_id", referencedColumnName = "id")
|
---|
| 84 | @JsonIgnore
|
---|
| 85 | private Phone phone;
|
---|
[dfd5d87] | 86 |
|
---|
| 87 | public PhoneOffer(String offer_shop, String offer_name,
|
---|
| 88 | Integer price, String ram_memory,
|
---|
| 89 | String rom_memory, String color,
|
---|
| 90 | String front_camera, String back_camera,
|
---|
| 91 | String chipset, String battery,
|
---|
| 92 | String operating_system, String cpu,
|
---|
| 93 | String image_url, String offer_url,
|
---|
| 94 | Date last_updated, Boolean is_validated,
|
---|
| 95 | String offer_description, String offer_shop_code, Phone phone) {
|
---|
| 96 | this.offer_shop = offer_shop;
|
---|
| 97 | this.offer_name = offer_name;
|
---|
| 98 | this.price = price;
|
---|
| 99 | this.ram_memory = ram_memory;
|
---|
| 100 | this.rom_memory = rom_memory;
|
---|
| 101 | this.color = color;
|
---|
| 102 | this.front_camera = front_camera;
|
---|
| 103 | this.back_camera = back_camera;
|
---|
| 104 | this.chipset = chipset;
|
---|
| 105 | this.battery = battery;
|
---|
| 106 | this.operating_system = operating_system;
|
---|
| 107 | this.cpu = cpu;
|
---|
| 108 | this.image_url = image_url;
|
---|
| 109 | this.offer_url = offer_url;
|
---|
| 110 | this.last_updated = last_updated;
|
---|
| 111 | this.is_validated = is_validated;
|
---|
| 112 | this.offer_description = offer_description;
|
---|
| 113 | this.offer_shop_code = offer_shop_code;
|
---|
| 114 | this.phone = phone;
|
---|
| 115 | }
|
---|
[5201690] | 116 |
|
---|
| 117 | public PhoneOffer(Long id,
|
---|
| 118 | String offer_shop,
|
---|
| 119 | String offer_name,
|
---|
| 120 | Integer price,
|
---|
| 121 | String ram_memory,
|
---|
| 122 | String rom_memory,
|
---|
| 123 | String color,
|
---|
| 124 | String front_camera,
|
---|
| 125 | String back_camera,
|
---|
| 126 | String chipset,
|
---|
| 127 | String battery,
|
---|
| 128 | String operating_system,
|
---|
| 129 | String cpu,
|
---|
| 130 | String image_url,
|
---|
| 131 | String offer_url,
|
---|
| 132 | Date last_updated,
|
---|
| 133 | Boolean is_validated,
|
---|
| 134 | String offer_description,
|
---|
| 135 | String offer_shop_code) {
|
---|
| 136 | this.id = id;
|
---|
| 137 | this.offer_shop = offer_shop;
|
---|
| 138 | this.offer_name = offer_name;
|
---|
| 139 | this.price = price;
|
---|
| 140 | this.ram_memory = ram_memory;
|
---|
| 141 | this.rom_memory = rom_memory;
|
---|
| 142 | this.color = color;
|
---|
| 143 | this.front_camera = front_camera;
|
---|
| 144 | this.back_camera = back_camera;
|
---|
| 145 | this.chipset = chipset;
|
---|
| 146 | this.battery = battery;
|
---|
| 147 | this.operating_system = operating_system;
|
---|
| 148 | this.cpu = cpu;
|
---|
| 149 | this.image_url = image_url;
|
---|
| 150 | this.offer_url = offer_url;
|
---|
| 151 | this.last_updated = last_updated;
|
---|
| 152 | this.is_validated = is_validated;
|
---|
| 153 | this.offer_description = offer_description;
|
---|
| 154 | this.offer_shop_code = offer_shop_code;
|
---|
| 155 | }
|
---|
[b68ae8d] | 156 | }
|
---|