Changeset dfd5d87 for phonelux-backend/src
- Timestamp:
- 08/29/22 22:31:57 (2 years ago)
- Branches:
- master
- Children:
- dbd4834
- Parents:
- b68ae8d
- Location:
- phonelux-backend/src/main
- Files:
-
- 18 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
phonelux-backend/src/main/java/finki/it/phoneluxbackend/controllers/PhoneController.java
rb68ae8d rdfd5d87 19 19 } 20 20 21 22 // handle request parameters for filtering phones 21 23 @GetMapping 22 24 public List<Phone> getPhones(){ … … 24 26 } 25 27 26 @PostMapping(path = "{phoneId}")27 public List<PhoneOffer> getOffersForPhone(@PathVariable("phoneId") Long phoneId){28 return phoneService.getOffersForPhone(phoneId);29 }30 31 28 } -
phonelux-backend/src/main/java/finki/it/phoneluxbackend/entities/Phone.java
rb68ae8d rdfd5d87 25 25 private String model; 26 26 27 @Column(name = "image_url") 28 private String image_url; 29 27 30 @OneToMany(fetch = FetchType.LAZY, mappedBy = "phone") 28 31 @JsonIgnore -
phonelux-backend/src/main/java/finki/it/phoneluxbackend/entities/PhoneOffer.java
rb68ae8d rdfd5d87 77 77 @JsonIgnore 78 78 private Phone phone; 79 80 public PhoneOffer(String offer_shop, String offer_name, 81 Integer price, String ram_memory, 82 String rom_memory, String color, 83 String front_camera, String back_camera, 84 String chipset, String battery, 85 String operating_system, String cpu, 86 String image_url, String offer_url, 87 Date last_updated, Boolean is_validated, 88 String offer_description, String offer_shop_code, Phone phone) { 89 this.offer_shop = offer_shop; 90 this.offer_name = offer_name; 91 this.price = price; 92 this.ram_memory = ram_memory; 93 this.rom_memory = rom_memory; 94 this.color = color; 95 this.front_camera = front_camera; 96 this.back_camera = back_camera; 97 this.chipset = chipset; 98 this.battery = battery; 99 this.operating_system = operating_system; 100 this.cpu = cpu; 101 this.image_url = image_url; 102 this.offer_url = offer_url; 103 this.last_updated = last_updated; 104 this.is_validated = is_validated; 105 this.offer_description = offer_description; 106 this.offer_shop_code = offer_shop_code; 107 this.phone = phone; 108 } 79 109 } -
phonelux-backend/src/main/java/finki/it/phoneluxbackend/services/PhoneService.java
rb68ae8d rdfd5d87 21 21 } 22 22 23 public List<PhoneOffer> getOffersForPhone(Long phoneId) {24 boolean exists = phoneRepository.existsById(phoneId);25 if(!exists)26 throw new IllegalStateException("Phone with id "+phoneId+" does not exist");27 28 return phoneRepository.findById(phoneId).get().getPhoneOffers();29 }30 23 } -
phonelux-backend/src/main/resources/application.properties
rb68ae8d rdfd5d87 6 6 spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQL9Dialect 7 7 spring.jpa.properties.hibernate.format_sql=true 8 9 spring.mail.host=localhost 10 spring.mail.port=1025 11 spring.mail.username=hello 12 spring.mail.password=hello 13 14 spring.mail.properties.mail.transport.protocol=smtp 15 spring.mail.properties.mail.smtp.ssl.trust="*" 16 spring.mail.properties.mail.smtp.auth=false 17 spring.mail.properties.mail.smtp.starttls.enable=false 18 spring.mail.properties.mail.smtp.connectiontimeout=5000 19 spring.mail.properties.mail.smtp.timeout=3000 20 spring.mail.properties.mail.smtp.writetimeout=5000
Note:
See TracChangeset
for help on using the changeset viewer.