Skip to content

Commit d5045a4

Browse files
committed
Merge branch 'feature/APIVictor' into feature/basicApp
2 parents 656452a + e851789 commit d5045a4

File tree

12 files changed

+2556
-1860
lines changed

12 files changed

+2556
-1860
lines changed

backend/webandtech/src/main/java/webapp8/webandtech/controller/api/products/ProductsRestController.java

Lines changed: 272 additions & 274 deletions
Large diffs are not rendered by default.

backend/webandtech/src/main/java/webapp8/webandtech/repository/ProductRepository.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ public interface ProductRepository extends JpaRepository<Product, Integer>{
2020
public Page<Product> findByproductcategory(String productcategory, Pageable page);
2121
public List<Product> findByproductcategory(String productcategory);
2222
public Page<Product> findByproductbrand(Brand brandname, Pageable page);
23+
public boolean existsIdproductBynameproduct(String nameproduct);
2324

2425
//public boolean existsidproductBynameproduct(String nameproduct);
2526
}

backend/webandtech/src/main/java/webapp8/webandtech/service/ProductService.java

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import java.io.IOException;
44
import java.util.List;
55
import java.util.NoSuchElementException;
6+
import java.util.Optional;
67

78
import org.hibernate.engine.jdbc.BlobProxy;
89
import org.springframework.beans.factory.annotation.Autowired;
@@ -27,8 +28,20 @@ public class ProductService {
2728

2829
@Autowired
2930
private RatingRepository ratingRepository;
30-
3131

32+
33+
34+
//api methods
35+
public void deleteProductApiById(int id) {
36+
Product pref = productRepository.findByIdproduct(id);
37+
productRepository.deleteById(pref.getIdproduct());
38+
}
39+
40+
public Optional<Product> getProductById(int id) {
41+
return productRepository.findById(id);
42+
}
43+
44+
//normal methods
3245
public void save(Product product){
3346
productRepository.save(product);
3447
}
@@ -62,6 +75,10 @@ public Page<Product> getProductsPage(Pageable page) {
6275
public Product getProduct(int idproduct) {
6376
return productRepository.findById(idproduct).orElseThrow(() -> new NoSuchElementException("Product not found"));
6477
}
78+
79+
public Product getProductByName(String nameproduct) {
80+
return productRepository.findBynameproduct(nameproduct);
81+
}
6582

6683
public Page<Product> getComponentsPage(Pageable page){
6784

@@ -115,6 +132,9 @@ public Page<Product> getMorePhones(Pageable page){
115132
Page<Product> phones = productRepository.findByproductcategory("telefono",page);
116133
return phones;
117134
}
135+
public boolean existsProduct(String nameProduct) {
136+
return productRepository.existsIdproductBynameproduct(nameProduct);
137+
}
118138

119139
@Modifying
120140
public void modifyDataProduct(Product product, MultipartFile image1, MultipartFile image2, MultipartFile image3) throws IOException {
@@ -185,4 +205,6 @@ public void deleteProductById(int idproduct) {
185205
ratingRepository.deleteByIdproduct(prev);
186206
productRepository.deleteById(prev.getIdproduct());
187207
}
208+
209+
188210
}

backend/webandtech/target/classes/static/css/style.css

Lines changed: 1 addition & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -2849,11 +2849,6 @@ td.invert-image a img {
28492849
}
28502850
/*-- //check out --*/
28512851

2852-
2853-
2854-
2855-
2856-
28572852
/*-- responsive media queries --*/
28582853
@media (max-width: 1440px){
28592854
.content-img-right h3 span {
@@ -5098,89 +5093,4 @@ td.invert-image a img {
50985093
margin: 5px auto 6px;
50995094
}
51005095
}
5101-
/*-- //responsive media queries --*/
5102-
5103-
5104-
5105-
5106-
5107-
5108-
/*-- submanuoctavio --*/
5109-
.submanuoctavio > li {
5110-
float:left;
5111-
}
5112-
5113-
.submanuoctavio li a {
5114-
background-color:#000;
5115-
color:#fff;
5116-
text-decoration:none;
5117-
padding:10px 12px;
5118-
display:block;
5119-
}
5120-
5121-
.submanuoctavio li a:hover {
5122-
background-color:#434343;
5123-
}
5124-
5125-
.submenu li ul {
5126-
display:none;
5127-
position:absolute;
5128-
5129-
}
5130-
5131-
.submenu li:hover > ul {
5132-
display:block;
5133-
}
5134-
5135-
.submanuoctavio li ul li {
5136-
position:relative;
5137-
}
5138-
5139-
#manuds li ul li {
5140-
float:none;
5141-
width:150px;
5142-
}
5143-
5144-
#menu ul li:hover {
5145-
display:block;
5146-
}
5147-
5148-
5149-
.dropbtn {
5150-
background-color: #04AA6D;
5151-
color: white;
5152-
padding: 16px;
5153-
font-size: 16px;
5154-
border: none;
5155-
}
5156-
5157-
.dropdown {
5158-
position: relative;
5159-
display: inline-block;
5160-
}
5161-
5162-
.dropdown-content {
5163-
display: none;
5164-
position: absolute;
5165-
background-color: #f1f1f1;
5166-
min-width: 160px;
5167-
box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
5168-
z-index: 1;
5169-
list-style: none;
5170-
top: 90%;
5171-
text-align: left;
5172-
z-index: 100;
5173-
}
5174-
5175-
.dropdown-content a {
5176-
color: black;
5177-
padding: 12px 16px;
5178-
text-decoration: none;
5179-
display: block;
5180-
}
5181-
5182-
.dropdown-content a:hover {background-color: #ddd;}
5183-
5184-
.dropdown:hover .dropdown-content {display: block;}
5185-
5186-
.dropdown:hover .dropbtn {background-color: #3e8e41;}
5096+
/*-- //responsive media queries --*/

0 commit comments

Comments
 (0)