Skip to content

Commit efbcf05

Browse files
committed
FullStack Backend
1 parent bfb8bc0 commit efbcf05

38 files changed

+624
-96
lines changed
Lines changed: 23 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -1,107 +1,40 @@
11

2-
# Spring Boot Projects - Full Stack
2+
# Ecommerce (Shopping Mall) Project Full Stack
33

4-
# Part-9: Full Stack [Spring Boot and React JS]
5-
* ### (resource/code)
6-
## Project-1. FullStack: Spring Boot React JS Database MySQL, CRUD example
7-
* Company Employee how to handle and using CRUD methods.
8-
### QUICK overview of React JS and Spring Boot
9-
* React is used to build user interface(UI) on the front end;
10-
* React is not a framework (unlike Angular, which is more opinionated)
11-
* React is an open-source project created by Facebook
12-
------------
13-
* Spring Boot to develop REST web service and Microservices
14-
* Spring Boot has taken Spring framework to the next level. That has drastically reduced the configuration and setup time required for spring projects
15-
* Spring Boot has possible configuration scratch to advanced, that actually matter to your application.
16-
17-
18-
![Figure-1](https://user-images.githubusercontent.com/11626327/97261692-b1931480-1862-11eb-9c73-4eb6157c06fc.png)
19-
20-
--> `Frontend-side tools and technologies used:`
21-
* React
22-
* Modern JavaScript (ES6)
23-
* NodeJS and NPM
24-
* VS Code IDE
25-
* Create React App CLI
26-
* Bootstarp 4.5 and Axios HTTP Library
27-
28-
--> `Backend-side tools and technologies used: `
29-
30-
Backend represents 2 folders:
31-
* backend
32-
* backend + Swagger
33-
34-
* SpringBoot 2 +
35-
* Spring Data JPA (Hibernate)
36-
* Maven 3.2 +
37-
* JDK 1.8
38-
* Embedded Tomcat 8.5 +
39-
* MySQL Database (using tool workbench_)
40-
--> Prerequesites
41-
* Basic Knowledge with HTML / CSS
42-
* Basic Knowledge of JavaScript and Programming
43-
* Node.js and npm installed
44-
* React basic (from scratch )
45-
* Swagger UI (documentation & API testing_) // http://localhost:8080/swagger-ui.html#/
46-
47-
![Screen Shot 2020-11-12 at 5 01 26 PM](https://user-images.githubusercontent.com/11626327/98912066-ef519780-2508-11eb-830f-590747a416c8.png)
48-
49-
* ReactJS Snippet Component (install VSC pluggin)
50-
51-
52-
Confuguration Router:
53-
54-
`npm install react-router-dom `
55-
56-
57-
In React.JS we should know about skelet of source in VSC:
58-
59-
`rcc` command given as :
60-
------------------------
61-
import React, { Component } from 'react';
4+
## Categories
5+
6+
ApparelCategory
627

63-
class HeaderComponents extends Component {
64-
render() {
65-
return (
66-
<div>
8+
GenderCategory
679

68-
</div>
69-
);
70-
}
71-
}
10+
PriceRangeCategory​
7211

73-
export default HeaderComponents;
74-
----------------------------
12+
ProductBrandCategory​
7513

14+
SortByCategory​
7615

77-
## Project-2. FullStack: Spring Boot + React + Swagger API Shopping Mall Project
78-
------
16+
Images​
7917

18+
ApparelImages​
8019

81-
<img width="794" alt="Screen Shot 2020-11-10 at 11 15 55 PM" src="https://user-images.githubusercontent.com/11626327/98685483-c2876e00-23aa-11eb-92ae-9012000c46bb.png">
20+
BrandImages​
8221

83-
## Project-4. Spring Boot AWS S3 Upload
22+
CarouselImages​
8423

85-
![Screen Shot 2020-11-05 at 11 31 02 AM](https://user-images.githubusercontent.com/11626327/98190535-94450100-1f5a-11eb-8019-804d32892b93.png)
24+
Info​
8625

87-
AWS/ Bucket
88-
![Screen Shot 2020-11-05 at 11 30 49 AM](https://user-images.githubusercontent.com/11626327/98190604-bb9bce00-1f5a-11eb-8b51-ebf75cd5215f.png)
26+
ProductInfo​
8927

90-
## Project-6. Shopping Card.
28+
BankInfo​
9129

92-
The stack will be the following:
30+
ContacInfo​
9331

94-
Java 10
95-
Maven as the build manager
96-
Spring Boot with Spring MVC as the server-side frameworks
97-
Thymeleaf as the server-side template engine
98-
React for the client-side interaction
99-
Bootstrap as the CSS framework.
100-
101-
102-
![Screen Shot 2020-12-16 at 2 34 14 PM](https://user-images.githubusercontent.com/11626327/102309460-2c97c200-3fac-11eb-8ee6-917c6dff5679.png)
32+
ProductInfo​
10333

34+
AddressInfo
35+
36+
<img width="917" alt="Screen Shot 2020-12-19 at 9 49 15 PM" src="https://user-images.githubusercontent.com/11626327/102714154-1709fb80-4310-11eb-9a57-2cfb2dbd5207.png">
37+
38+
10439
# Using and Recommendated List of References
105-
1. [Bootstarapping](https://getbootstrap.com/docs/4.5/getting-started/introduction/)
106-
2. [Full Stack: React and Spring](https://www.youtube.com/watch?v=S5AFJIfRxQU&list=PLGRDMO4rOGcNLnW1L2vgsExTBg-VPoZHr&index=14)
107-
3. [Shopping Card](https://pusher.com/tutorials/shopping-cart-java-react)
40+
1.

Part-9.SpringBoot-React-Projects/Project-5.Spring-ReactJS-Ecommerce-Shopping/fullstack/backend/model/pom.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,10 @@
110110
<groupId>org.springframework.boot</groupId>
111111
<artifactId>spring-boot-starter-cache</artifactId>
112112
</dependency>
113+
<dependency>
114+
<groupId>org.springframework.boot</groupId>
115+
<artifactId>spring-boot-starter-data-jpa</artifactId>
116+
</dependency>
113117
</dependencies>
114118

115119
<build>

Part-9.SpringBoot-React-Projects/Project-5.Spring-ReactJS-Ecommerce-Shopping/fullstack/backend/model/src/main/java/com/urunov/ModelApplication.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,12 @@
22

33
import org.springframework.boot.SpringApplication;
44
import org.springframework.boot.autoconfigure.SpringBootApplication;
5+
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
56
import org.springframework.cache.annotation.EnableCaching;
67

7-
@SpringBootApplication
8+
//@SpringBootApplication
9+
@SpringBootApplication(exclude={DataSourceAutoConfiguration.class})
10+
811
//@EnableCaching
912
public class ModelApplication {
1013

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
package com.urunov.controller;
2+
3+
import com.urunov.dto.ProductInfoDTO;
4+
import com.urunov.entity.elements.info.ProductInfo;
5+
import com.urunov.model.FilterAttributesResponse;
6+
import com.urunov.model.MainScreenResponse;
7+
import com.urunov.model.SearchSuggestionResponse;
8+
import com.urunov.service.interfaces.CommonDataService;
9+
import com.urunov.service.interfaces.LoadFakeDataService;
10+
import org.springframework.beans.factory.annotation.Autowired;
11+
import org.springframework.core.env.Environment;
12+
import org.springframework.http.HttpStatus;
13+
import org.springframework.http.ResponseEntity;
14+
import org.springframework.web.bind.annotation.GetMapping;
15+
import org.springframework.web.bind.annotation.RequestParam;
16+
import org.springframework.web.bind.annotation.RestController;
17+
18+
import java.util.HashMap;
19+
import java.util.Objects;
20+
21+
/**
22+
* User: hamdamboy
23+
* Project: model
24+
* Github: @urunov
25+
*/
26+
27+
@RestController
28+
public class DataController {
29+
30+
@Autowired
31+
Environment environment;
32+
33+
@Autowired
34+
CommonDataService commonDataService;
35+
36+
@Autowired
37+
LoadFakeDataService loadFakeDataService;
38+
39+
public void fillWithTestDate(){
40+
if(Objects.equals(environment.getProperty("ACTIVE_PROFILE"), "dev")){
41+
loadFakeDataService.loadTestData();
42+
}
43+
}
44+
45+
public ResponseEntity<?> getProductsByCategories(@RequestParam("q") String queryParams)
46+
{
47+
ProductInfoDTO productInfoDTO = commonDataService.getProductsByCategories(queryParams);
48+
49+
if(productInfoDTO == null) {
50+
return ResponseEntity.badRequest().body("Query has not followed the required format.");
51+
}
52+
return ResponseEntity.ok(productInfoDTO);
53+
}
54+
55+
@GetMapping(value = "/products", params = "product_id")
56+
public ResponseEntity<?> getProductsById(@RequestParam("product_id") String queryParams)
57+
{
58+
HashMap<Integer, ProductInfo> resultMap = commonDataService.getProductsById(queryParams);
59+
60+
if(resultMap == null)
61+
{
62+
return ResponseEntity.badRequest().body("Query has not followed the required format.");
63+
}
64+
65+
return ResponseEntity.ok(resultMap);
66+
}
67+
68+
69+
@GetMapping("/home")
70+
public ResponseEntity <?> getMainScreenData(){
71+
72+
MainScreenResponse mainScreenInfoList = commonDataService.getHomeScreenData("homeAPI");
73+
if(mainScreenInfoList == null) {
74+
return new ResponseEntity<Error>(HttpStatus.CONFLICT);
75+
}
76+
77+
return ResponseEntity.of(mainScreenInfoList);
78+
}
79+
80+
81+
public ResponseEntity<?> getFilterAttributesProducts(@RequestParam("g") String queryParams)
82+
{
83+
String[] splitParams = queryParams.split("=");
84+
if(splitParams.length>=1 && splitParams[0].equals("productname")){
85+
queryParams = "category=all";
86+
}
87+
88+
FilterAttributesResponse result = commonDataService.getFilterAttributesByProducts(queryParams);
89+
90+
if(result == null)
91+
{
92+
return ResponseEntity.badRequest().body("Query has not followed the required format.");
93+
}
94+
95+
return ResponseEntity.ok(result);
96+
}
97+
98+
public ResponseEntity<?> getSearchSuggestionList()
99+
{
100+
SearchSuggestionResponse searchSuggestionResponse = commonDataService.getSearchSuggestionList();
101+
if(searchSuggestionResponse == null)
102+
{
103+
return new ResponseEntity<Error>(HttpStatus.CONFLICT);
104+
}
105+
106+
return ResponseEntity.of(searchSuggestionResponse);
107+
}
108+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
package com.urunov.dao.sql.categories;
2+
3+
import com.urunov.entity.elements.categories.ApparelCategory;
4+
import org.springframework.data.jpa.repository.JpaRepository;
5+
import org.springframework.data.jpa.repository.Query;
6+
7+
import java.util.List;
8+
9+
/**
10+
* User: hamdamboy
11+
* Project: model
12+
* Github: @urunov
13+
*/
14+
public interface ApparelCategoryRepository extends JpaRepository<ApparelCategory, Integer> {
15+
16+
// @Query(value = "SELECT c FROM ApparelImages c where c.apparelCategory.type=?1 and" +
17+
// " c.genderCategory.type=?2")
18+
//
19+
// @Query(value = "SELECT c FROM ApparelCategory c")
20+
// List<ApparelCategory> getAllDate();
21+
22+
23+
ApparelCategory findByType(String title);
24+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
package com.urunov.dao.sql.categories;
2+
3+
/**
4+
* User: hamdamboy
5+
* Project: model
6+
* Github: @urunov
7+
*/
8+
public interface GenderCategoryRepository {
9+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
package com.urunov.dao.sql.categories;
2+
3+
/**
4+
* User: hamdamboy
5+
* Project: model
6+
* Github: @urunov
7+
*/
8+
public interface PriceRangeCategoryRepository {
9+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
package com.urunov.dao.sql.categories;
2+
3+
/**
4+
* User: hamdamboy
5+
* Project: model
6+
* Github: @urunov
7+
*/
8+
public interface ProductBrandCategoryRepository {
9+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
package com.urunov.dao.sql.categories;
2+
3+
/**
4+
* User: hamdamboy
5+
* Project: model
6+
* Github: @urunov
7+
*/
8+
public interface SortByCategoryRepository {
9+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
package com.urunov.dao.sql.images;
2+
3+
/**
4+
* User: hamdamboy
5+
* Project: model
6+
* Github: @urunov
7+
*/
8+
public interface ApparelImagesRepository {
9+
}

0 commit comments

Comments
 (0)