Removed classes
This commit is contained in:
parent
a94620a5ed
commit
f9caf17a18
@ -1,20 +0,0 @@
|
||||
package com.cubetiqs.demo.domain;
|
||||
|
||||
import lombok.*;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Entity
|
||||
@Table(name = "products")
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class Product {
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.AUTO)
|
||||
private Long id;
|
||||
private String name;
|
||||
private BigDecimal price;
|
||||
private Boolean deleted;
|
||||
}
|
@ -1,8 +0,0 @@
|
||||
package com.cubetiqs.demo.repository;
|
||||
|
||||
import com.cubetiqs.demo.domain.Product;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
public interface ProductRepository extends JpaRepository<Product, Long> {
|
||||
|
||||
}
|
@ -1,34 +0,0 @@
|
||||
package com.cubetiqs.demo.rest;
|
||||
|
||||
import com.cubetiqs.demo.domain.Product;
|
||||
import com.cubetiqs.demo.repository.ProductRepository;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping(path = "/products")
|
||||
public class ProductController {
|
||||
private final ProductRepository productRepository;
|
||||
|
||||
@Autowired
|
||||
public ProductController(ProductRepository productRepository) {
|
||||
this.productRepository = productRepository;
|
||||
}
|
||||
|
||||
@RequestMapping(method = {RequestMethod.GET})
|
||||
public List<Product> getAllProducts() {
|
||||
return productRepository.findAll();
|
||||
}
|
||||
|
||||
@GetMapping("/{id}")
|
||||
public Product getOneProduct(@PathVariable Long id) {
|
||||
return productRepository.findById(id).orElse(null);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
public Product createProduct(@RequestBody Product item) {
|
||||
return productRepository.save(item);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user