Index: phonelux-backend/src/main/java/finki/it/phoneluxbackend/PhoneluxBackendApplication.java
===================================================================
--- phonelux-backend/src/main/java/finki/it/phoneluxbackend/PhoneluxBackendApplication.java	(revision b68ae8d3cc34d054d169fb34943b9fcd77bff7c2)
+++ phonelux-backend/src/main/java/finki/it/phoneluxbackend/PhoneluxBackendApplication.java	(revision b68ae8d3cc34d054d169fb34943b9fcd77bff7c2)
@@ -0,0 +1,13 @@
+package finki.it.phoneluxbackend;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+@SpringBootApplication
+public class PhoneluxBackendApplication {
+
+	public static void main(String[] args) {
+		SpringApplication.run(PhoneluxBackendApplication.class, args);
+	}
+
+}
Index: phonelux-backend/src/main/java/finki/it/phoneluxbackend/controllers/PhoneController.java
===================================================================
--- phonelux-backend/src/main/java/finki/it/phoneluxbackend/controllers/PhoneController.java	(revision b68ae8d3cc34d054d169fb34943b9fcd77bff7c2)
+++ phonelux-backend/src/main/java/finki/it/phoneluxbackend/controllers/PhoneController.java	(revision b68ae8d3cc34d054d169fb34943b9fcd77bff7c2)
@@ -0,0 +1,31 @@
+package finki.it.phoneluxbackend.controllers;
+
+import finki.it.phoneluxbackend.entities.Phone;
+import finki.it.phoneluxbackend.entities.PhoneOffer;
+import finki.it.phoneluxbackend.services.PhoneService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+@RestController
+@RequestMapping(path = "/")
+public class PhoneController {
+    private final PhoneService phoneService;
+
+    @Autowired
+    public PhoneController(PhoneService phoneService) {
+        this.phoneService = phoneService;
+    }
+
+    @GetMapping
+    public List<Phone> getPhones(){
+        return phoneService.getPhones();
+    }
+
+    @PostMapping(path = "{phoneId}")
+    public List<PhoneOffer> getOffersForPhone(@PathVariable("phoneId") Long phoneId){
+        return phoneService.getOffersForPhone(phoneId);
+    }
+
+}
Index: phonelux-backend/src/main/java/finki/it/phoneluxbackend/entities/Phone.java
===================================================================
--- phonelux-backend/src/main/java/finki/it/phoneluxbackend/entities/Phone.java	(revision b68ae8d3cc34d054d169fb34943b9fcd77bff7c2)
+++ phonelux-backend/src/main/java/finki/it/phoneluxbackend/entities/Phone.java	(revision b68ae8d3cc34d054d169fb34943b9fcd77bff7c2)
@@ -0,0 +1,37 @@
+package finki.it.phoneluxbackend.entities;
+
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import lombok.*;
+
+import javax.persistence.*;
+import java.util.List;
+
+@AllArgsConstructor
+@NoArgsConstructor
+@Getter
+@Setter
+@ToString
+@Entity(name = "Phone")
+@Table(name = "phones")
+public class Phone {
+    @Id
+    @Column(name = "id")
+    private Long id;
+
+    @Column(name = "brand")
+    private String brand;
+
+    @Column(name = "model")
+    private String model;
+
+    @OneToMany(fetch = FetchType.LAZY, mappedBy = "phone")
+    @JsonIgnore
+    private List<PhoneOffer> phoneOffers;
+
+    public Phone(String brand, String model) {
+        this.brand = brand;
+        this.model = model;
+    }
+
+
+}
Index: phonelux-backend/src/main/java/finki/it/phoneluxbackend/entities/PhoneOffer.java
===================================================================
--- phonelux-backend/src/main/java/finki/it/phoneluxbackend/entities/PhoneOffer.java	(revision b68ae8d3cc34d054d169fb34943b9fcd77bff7c2)
+++ phonelux-backend/src/main/java/finki/it/phoneluxbackend/entities/PhoneOffer.java	(revision b68ae8d3cc34d054d169fb34943b9fcd77bff7c2)
@@ -0,0 +1,79 @@
+package finki.it.phoneluxbackend.entities;
+
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import lombok.*;
+
+import javax.persistence.*;
+import java.util.Date;
+
+@AllArgsConstructor
+@NoArgsConstructor
+@Getter
+@Setter
+@ToString
+@Entity(name = "PhoneOffer")
+@Table(name = "phone_offers")
+public class PhoneOffer {
+    @Id
+    @Column(name = "offer_id")
+    private Long id;
+
+    @Column(name = "offer_shop")
+    private String offer_shop;
+
+    @Column(name = "offer_name")
+    private String offer_name;
+
+    @Column(name = "price")
+    private Integer price;
+
+    @Column(name = "ram_memory")
+    private String ram_memory;
+
+    @Column(name = "rom_memory")
+    private String rom_memory;
+
+    @Column(name = "color")
+    private String color;
+
+    @Column(name = "front_camera")
+    private String front_camera;
+
+    @Column(name = "back_camera")
+    private String back_camera;
+
+    @Column(name = "chipset")
+    private String chipset;
+
+    @Column(name = "battery")
+    private String battery;
+
+    @Column(name = "operating_system")
+    private String operating_system;
+
+    @Column(name = "cpu")
+    private String cpu;
+
+    @Column(name = "image_url")
+    private String image_url;
+
+    @Column(name = "offer_url")
+    private String offer_url;
+
+    @Column(name = "last_updated")
+    private Date last_updated;
+
+    @Column(name = "is_validated")
+    private Boolean is_validated;
+
+    @Column(name = "offer_description")
+    private String offer_description;
+
+    @Column(name = "offer_shop_code")
+    private String offer_shop_code;
+
+    @ManyToOne(fetch = FetchType.LAZY)
+    @JoinColumn(name = "phone_id", referencedColumnName = "id")
+    @JsonIgnore
+    private Phone phone;
+}
Index: phonelux-backend/src/main/java/finki/it/phoneluxbackend/repositories/PhoneRepository.java
===================================================================
--- phonelux-backend/src/main/java/finki/it/phoneluxbackend/repositories/PhoneRepository.java	(revision b68ae8d3cc34d054d169fb34943b9fcd77bff7c2)
+++ phonelux-backend/src/main/java/finki/it/phoneluxbackend/repositories/PhoneRepository.java	(revision b68ae8d3cc34d054d169fb34943b9fcd77bff7c2)
@@ -0,0 +1,10 @@
+package finki.it.phoneluxbackend.repositories;
+
+import finki.it.phoneluxbackend.entities.Phone;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.stereotype.Repository;
+
+@Repository
+public interface PhoneRepository extends JpaRepository<Phone,Long> {
+
+}
Index: phonelux-backend/src/main/java/finki/it/phoneluxbackend/services/PhoneService.java
===================================================================
--- phonelux-backend/src/main/java/finki/it/phoneluxbackend/services/PhoneService.java	(revision b68ae8d3cc34d054d169fb34943b9fcd77bff7c2)
+++ phonelux-backend/src/main/java/finki/it/phoneluxbackend/services/PhoneService.java	(revision b68ae8d3cc34d054d169fb34943b9fcd77bff7c2)
@@ -0,0 +1,30 @@
+package finki.it.phoneluxbackend.services;
+
+import finki.it.phoneluxbackend.entities.Phone;
+import finki.it.phoneluxbackend.entities.PhoneOffer;
+import finki.it.phoneluxbackend.repositories.PhoneRepository;
+import org.springframework.data.domain.Sort;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+@Service
+public class PhoneService {
+    private final PhoneRepository phoneRepository;
+
+    public PhoneService(PhoneRepository phoneRepository){
+        this.phoneRepository = phoneRepository;
+    }
+
+    public List<Phone> getPhones(){
+        return phoneRepository.findAll();
+    }
+
+    public List<PhoneOffer> getOffersForPhone(Long phoneId) {
+        boolean exists = phoneRepository.existsById(phoneId);
+        if(!exists)
+            throw new IllegalStateException("Phone with id "+phoneId+" does not exist");
+
+        return phoneRepository.findById(phoneId).get().getPhoneOffers();
+    }
+}
Index: phonelux-backend/src/main/resources/application.properties
===================================================================
--- phonelux-backend/src/main/resources/application.properties	(revision b68ae8d3cc34d054d169fb34943b9fcd77bff7c2)
+++ phonelux-backend/src/main/resources/application.properties	(revision b68ae8d3cc34d054d169fb34943b9fcd77bff7c2)
@@ -0,0 +1,7 @@
+spring.datasource.url=jdbc:postgresql://localhost:5432/phonelux
+spring.datasource.username=
+spring.datasource.password=
+spring.jpa.hibernate.ddl-auto=update
+spring.jpa.show-sql=true
+spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQL9Dialect
+spring.jpa.properties.hibernate.format_sql=true
