Ignore:
Timestamp:
08/29/22 22:31:57 (2 years ago)
Author:
Marko <Marko@…>
Branches:
master
Children:
dbd4834
Parents:
b68ae8d
Message:

Registration logic with confirmation token implemented

Location:
phonelux-backend/src/main/java/finki/it/phoneluxbackend
Files:
18 added
4 edited

Legend:

Unmodified
Added
Removed
  • phonelux-backend/src/main/java/finki/it/phoneluxbackend/controllers/PhoneController.java

    rb68ae8d rdfd5d87  
    1919    }
    2020
     21
     22    // handle request parameters for filtering phones
    2123    @GetMapping
    2224    public List<Phone> getPhones(){
     
    2426    }
    2527
    26     @PostMapping(path = "{phoneId}")
    27     public List<PhoneOffer> getOffersForPhone(@PathVariable("phoneId") Long phoneId){
    28         return phoneService.getOffersForPhone(phoneId);
    29     }
    30 
    3128}
  • phonelux-backend/src/main/java/finki/it/phoneluxbackend/entities/Phone.java

    rb68ae8d rdfd5d87  
    2525    private String model;
    2626
     27    @Column(name = "image_url")
     28    private String image_url;
     29
    2730    @OneToMany(fetch = FetchType.LAZY, mappedBy = "phone")
    2831    @JsonIgnore
  • phonelux-backend/src/main/java/finki/it/phoneluxbackend/entities/PhoneOffer.java

    rb68ae8d rdfd5d87  
    7777    @JsonIgnore
    7878    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    }
    79109}
  • phonelux-backend/src/main/java/finki/it/phoneluxbackend/services/PhoneService.java

    rb68ae8d rdfd5d87  
    2121    }
    2222
    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     }
    3023}
Note: See TracChangeset for help on using the changeset viewer.