Changeset dfd5d87 for phonelux-backend


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
Files:
18 added
7 edited

Legend:

Unmodified
Added
Removed
  • phonelux-backend/pom.xml

    rb68ae8d rdfd5d87  
    2222                        <artifactId>spring-boot-starter-data-jpa</artifactId>
    2323                </dependency>
    24 <!--            <dependency>-->
    25 <!--                    <groupId>org.springframework.boot</groupId>-->
    26 <!--                    <artifactId>spring-boot-starter-security</artifactId>-->
    27 <!--            </dependency>-->
     24                <dependency>
     25                        <groupId>org.springframework.boot</groupId>
     26                        <artifactId>spring-boot-starter-security</artifactId>
     27                </dependency>
    2828                <dependency>
    2929                        <groupId>org.springframework.boot</groupId>
    3030                        <artifactId>spring-boot-starter-web</artifactId>
    3131                </dependency>
    32 
     32                <dependency>
     33                        <groupId>org.springframework.boot</groupId>
     34                        <artifactId>spring-boot-starter-mail</artifactId>
     35                </dependency>
    3336                <dependency>
    3437                        <groupId>org.postgresql</groupId>
     
    4649                        <scope>test</scope>
    4750                </dependency>
    48 <!--            <dependency>-->
    49 <!--                    <groupId>org.springframework.security</groupId>-->
    50 <!--                    <artifactId>spring-security-test</artifactId>-->
    51 <!--                    <scope>test</scope>-->
    52 <!--            </dependency>-->
     51                <dependency>
     52                        <groupId>org.springframework.security</groupId>
     53                        <artifactId>spring-security-test</artifactId>
     54                        <scope>test</scope>
     55                </dependency>
    5356        </dependencies>
    5457
  • 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}
  • phonelux-backend/src/main/resources/application.properties

    rb68ae8d rdfd5d87  
    66spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQL9Dialect
    77spring.jpa.properties.hibernate.format_sql=true
     8
     9spring.mail.host=localhost
     10spring.mail.port=1025
     11spring.mail.username=hello
     12spring.mail.password=hello
     13
     14spring.mail.properties.mail.transport.protocol=smtp
     15spring.mail.properties.mail.smtp.ssl.trust="*"
     16spring.mail.properties.mail.smtp.auth=false
     17spring.mail.properties.mail.smtp.starttls.enable=false
     18spring.mail.properties.mail.smtp.connectiontimeout=5000
     19spring.mail.properties.mail.smtp.timeout=3000
     20spring.mail.properties.mail.smtp.writetimeout=5000
Note: See TracChangeset for help on using the changeset viewer.