From f9caf17a1853f96f86949aa05354507f90b69119 Mon Sep 17 00:00:00 2001 From: Sambo Chea Date: Wed, 10 Jun 2020 17:58:31 +0700 Subject: [PATCH] Removed classes --- .../com/cubetiqs/demo/domain/Product.java | 20 ----------- .../demo/repository/ProductRepository.java | 8 ----- .../cubetiqs/demo/rest/ProductController.java | 34 ------------------- 3 files changed, 62 deletions(-) delete mode 100644 src/main/java/com/cubetiqs/demo/domain/Product.java delete mode 100644 src/main/java/com/cubetiqs/demo/repository/ProductRepository.java delete mode 100644 src/main/java/com/cubetiqs/demo/rest/ProductController.java diff --git a/src/main/java/com/cubetiqs/demo/domain/Product.java b/src/main/java/com/cubetiqs/demo/domain/Product.java deleted file mode 100644 index 0d24b98..0000000 --- a/src/main/java/com/cubetiqs/demo/domain/Product.java +++ /dev/null @@ -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; -} diff --git a/src/main/java/com/cubetiqs/demo/repository/ProductRepository.java b/src/main/java/com/cubetiqs/demo/repository/ProductRepository.java deleted file mode 100644 index 0817ecf..0000000 --- a/src/main/java/com/cubetiqs/demo/repository/ProductRepository.java +++ /dev/null @@ -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 { - -} diff --git a/src/main/java/com/cubetiqs/demo/rest/ProductController.java b/src/main/java/com/cubetiqs/demo/rest/ProductController.java deleted file mode 100644 index 5bbe69d..0000000 --- a/src/main/java/com/cubetiqs/demo/rest/ProductController.java +++ /dev/null @@ -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 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); - } -}