Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit f9c32fa

Browse files
committed
Swagger API Backend
1 parent c8fb7fd commit f9c32fa

File tree

48 files changed

+1634
-1530
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+1634
-1530
lines changed

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

Lines changed: 26 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -94,30 +94,41 @@
9494
</dependency>
9595

9696

97-
<dependency>
98-
<groupId>org.springframework.data</groupId>
99-
<artifactId>spring-data-redis</artifactId>
100-
<version>2.2.6.RELEASE</version>
101-
</dependency>
97+
<!-- <dependency>-->
98+
<!-- <groupId>org.springframework.data</groupId>-->
99+
<!-- <artifactId>spring-data-redis</artifactId>-->
100+
<!-- <version>2.2.6.RELEASE</version>-->
101+
<!-- </dependency>-->
102102

103-
<dependency>
104-
<groupId>redis.clients</groupId>
105-
<artifactId>jedis</artifactId>
106-
<version>3.2.0</version>
107-
<type>jar</type>
108-
</dependency>
103+
<!-- <dependency>-->
104+
<!-- <groupId>redis.clients</groupId>-->
105+
<!-- <artifactId>jedis</artifactId>-->
106+
<!-- <version>3.2.0</version>-->
107+
<!-- <type>jar</type>-->
108+
<!-- </dependency>-->
109109

110110
<dependency>
111111
<groupId>org.springframework.boot</groupId>
112112
<artifactId>spring-boot-starter-cache</artifactId>
113113
</dependency>
114-
<!-- https://mvnrepository.com/artifact/org.springframework/spring-jdbc -->
114+
<!-- &lt;!&ndash; https://mvnrepository.com/artifact/org.springframework/spring-jdbc &ndash;&gt;-->
115+
<!-- <dependency>-->
116+
<!-- <groupId>org.springframework</groupId>-->
117+
<!-- <artifactId>spring-jdbc</artifactId>-->
118+
<!-- <version>5.2.12.RELEASE</version>-->
119+
<!-- </dependency>-->
120+
115121
<dependency>
116-
<groupId>org.springframework</groupId>
117-
<artifactId>spring-jdbc</artifactId>
118-
<version>5.2.12.RELEASE</version>
122+
<groupId>io.springfox</groupId>
123+
<artifactId>springfox-swagger2</artifactId>
124+
<version>2.9.2</version>
119125
</dependency>
120126

127+
<dependency>
128+
<groupId>io.springfox</groupId>
129+
<artifactId>springfox-swagger-ui</artifactId>
130+
<version>2.9.2</version>
131+
</dependency>
121132
</dependencies>
122133

123134
<build>
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
//package com.urunov.configureAPI;
2+
//
3+
//import org.springframework.context.annotation.Bean;
4+
//import org.springframework.context.annotation.Configuration;
5+
//import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
6+
//import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;
7+
//import springfox.documentation.builders.ApiInfoBuilder;
8+
//import springfox.documentation.builders.RequestHandlerSelectors;
9+
//import springfox.documentation.service.ApiInfo;
10+
//import springfox.documentation.service.Contact;
11+
//import springfox.documentation.spi.DocumentationType;
12+
//import springfox.documentation.spring.web.plugins.Docket;
13+
//import springfox.documentation.swagger2.annotations.EnableSwagger2;
14+
//
15+
//import static springfox.documentation.builders.PathSelectors.regex;
16+
//
17+
///**
18+
// * User: hamdamboy
19+
// * Project: security
20+
// * Github: @urunov
21+
// */
22+
//@Configuration
23+
//@EnableSwagger2
24+
//public class modelAPI extends WebMvcConfigurationSupport {
25+
//
26+
// @Bean
27+
// public Docket postsApi() {
28+
//
29+
// return new Docket(DocumentationType.SWAGGER_2)
30+
// .select()
31+
// .apis(RequestHandlerSelectors.basePackage("com.urunov.controller"))
32+
// .paths(regex("/api/v1.*"))
33+
// .build()
34+
// .apiInfo(metaData());
35+
// }
36+
//
37+
// private ApiInfo metaData() {
38+
// return new ApiInfoBuilder()
39+
// .title("Ecommerce Platform: Shopping Mall")
40+
// .description("\"Spring Boot REST API for Employee")
41+
// .version("1.0.0")
42+
// .license("Apache License Version 2.0")
43+
// .licenseUrl("https://www.apache.org/licenses/LICENSE-2.0\"")
44+
// .contact(new Contact("Urunov Hamdamboy", "https://github.com/urunov/", "myindexu@gamil.com"))
45+
// .build();
46+
// }
47+
// @Override
48+
// protected void addResourceHandlers(ResourceHandlerRegistry registry) {
49+
// registry.addResourceHandler("swagger-ui.html")
50+
// .addResourceLocations("classpath:/META-INF/resources/");
51+
// registry.addResourceHandler("/webjars/**")
52+
// .addResourceLocations("classpath:/META-INF/resources/webjars/");
53+
// }
54+
//
55+
//}
Lines changed: 118 additions & 118 deletions
Original file line numberDiff line numberDiff line change
@@ -1,118 +1,118 @@
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.HomeTabsDataResponse;
7-
import com.urunov.model.MainScreenResponse;
8-
import com.urunov.model.SearchSuggestionResponse;
9-
10-
import com.urunov.service.interfaces.CommonDataService;
11-
import com.urunov.service.interfaces.LoadFakeDataService;
12-
import org.springframework.beans.factory.annotation.Autowired;
13-
import org.springframework.core.env.Environment;
14-
import org.springframework.http.HttpStatus;
15-
import org.springframework.http.ResponseEntity;
16-
import org.springframework.web.bind.annotation.GetMapping;
17-
import org.springframework.web.bind.annotation.RequestParam;
18-
import org.springframework.web.bind.annotation.RestController;
19-
20-
import java.util.HashMap;
21-
import java.util.Objects;
22-
23-
/**
24-
* User: hamdamboy
25-
* Project: model
26-
* Github: @urunov
27-
*/
28-
29-
@RestController
30-
public class CommonDataController {
31-
32-
@Autowired
33-
Environment environment;
34-
35-
@Autowired
36-
CommonDataService commonDataService;
37-
38-
@Autowired
39-
LoadFakeDataService loadFakeDataService;
40-
41-
public void fillWithTestDate() {
42-
if (Objects.equals(environment.getProperty("ACTIVE_PROFILE"), "dev")) {
43-
loadFakeDataService.loadTestData();
44-
}
45-
}
46-
47-
@GetMapping(value = "/products", params = "q")
48-
public ResponseEntity<?> getProductsByCategories(@RequestParam("q") String queryParams) {
49-
ProductInfoDTO productInfoDTO = commonDataService.getProductsByCategories(queryParams);
50-
51-
if (productInfoDTO == null) {
52-
return ResponseEntity.badRequest().body("Query has not followed the required format.");
53-
}
54-
return ResponseEntity.ok(productInfoDTO);
55-
}
56-
57-
@GetMapping(value = "/products", params = "product_id")
58-
public ResponseEntity<?> getProductsById(@RequestParam("product_id") String queryParams) {
59-
HashMap<Integer, ProductInfo> resultMap = commonDataService.getProductsById(queryParams);
60-
61-
if (resultMap == null) {
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.ok(mainScreenInfoList);
78-
}
79-
80-
81-
@GetMapping("/tabs")
82-
public ResponseEntity<?> getHomeTabsDataResponse(){
83-
HomeTabsDataResponse homeTabsDataResponse = commonDataService.getBrandsAndApparelsByGender("tabsAPI");
84-
if(homeTabsDataResponse == null)
85-
{
86-
return new ResponseEntity<Error>(HttpStatus.CONFLICT);
87-
}
88-
89-
return ResponseEntity.ok(homeTabsDataResponse);
90-
}
91-
92-
93-
@GetMapping(value = "/filter", params = "q")
94-
public ResponseEntity<?> getFilterAttributesProducts(@RequestParam("g") String queryParams) {
95-
String[] splitParams = queryParams.split("=");
96-
if (splitParams.length >= 1 && splitParams[0].equals("productname")) {
97-
queryParams = "category=all";
98-
}
99-
100-
FilterAttributesResponse result = commonDataService.getFilterAttributesByProducts(queryParams);
101-
102-
if (result == null) {
103-
return ResponseEntity.badRequest().body("Query has not followed the required format.");
104-
}
105-
106-
return ResponseEntity.ok(result);
107-
}
108-
109-
@GetMapping("/search-suggestion-list")
110-
public ResponseEntity<?> getSearchSuggestionList() {
111-
SearchSuggestionResponse searchSuggestionResponse = commonDataService.getSearchSuggestionList();
112-
if (searchSuggestionResponse == null) {
113-
return new ResponseEntity<Error>(HttpStatus.CONFLICT);
114-
}
115-
116-
return ResponseEntity.ok(searchSuggestionResponse);
117-
}
118-
}
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.HomeTabsDataResponse;
7+
//import com.urunov.model.MainScreenResponse;
8+
//import com.urunov.model.SearchSuggestionResponse;
9+
//
10+
//import com.urunov.service.interfaces.CommonDataService;
11+
//import com.urunov.service.interfaces.LoadFakeDataService;
12+
//import org.springframework.beans.factory.annotation.Autowired;
13+
//import org.springframework.core.env.Environment;
14+
//import org.springframework.http.HttpStatus;
15+
//import org.springframework.http.ResponseEntity;
16+
//import org.springframework.web.bind.annotation.GetMapping;
17+
//import org.springframework.web.bind.annotation.RequestParam;
18+
//import org.springframework.web.bind.annotation.RestController;
19+
//
20+
//import java.util.HashMap;
21+
//import java.util.Objects;
22+
//
23+
///**
24+
// * User: hamdamboy
25+
// * Project: model
26+
// * Github: @urunov
27+
// */
28+
//
29+
//@RestController
30+
//public class CommonDataController {
31+
//
32+
// @Autowired
33+
// Environment environment;
34+
//
35+
// @Autowired
36+
// CommonDataService commonDataService;
37+
//
38+
// @Autowired
39+
// LoadFakeDataService loadFakeDataService;
40+
//
41+
// public void fillWithTestDate() {
42+
// if (Objects.equals(environment.getProperty("ACTIVE_PROFILE"), "dev")) {
43+
// loadFakeDataService.loadTestData();
44+
// }
45+
// }
46+
//
47+
// @GetMapping(value = "/products", params = "q")
48+
// public ResponseEntity<?> getProductsByCategories(@RequestParam("q") String queryParams) {
49+
// ProductInfoDTO productInfoDTO = commonDataService.getProductsByCategories(queryParams);
50+
//
51+
// if (productInfoDTO == null) {
52+
// return ResponseEntity.badRequest().body("Query has not followed the required format.");
53+
// }
54+
// return ResponseEntity.ok(productInfoDTO);
55+
// }
56+
//
57+
// @GetMapping(value = "/products", params = "product_id")
58+
// public ResponseEntity<?> getProductsById(@RequestParam("product_id") String queryParams) {
59+
// HashMap<Integer, ProductInfo> resultMap = commonDataService.getProductsById(queryParams);
60+
//
61+
// if (resultMap == null) {
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.ok(mainScreenInfoList);
78+
// }
79+
//
80+
//
81+
// @GetMapping("/tabs")
82+
// public ResponseEntity<?> getHomeTabsDataResponse(){
83+
// HomeTabsDataResponse homeTabsDataResponse = commonDataService.getBrandsAndApparelsByGender("tabsAPI");
84+
// if(homeTabsDataResponse == null)
85+
// {
86+
// return new ResponseEntity<Error>(HttpStatus.CONFLICT);
87+
// }
88+
//
89+
// return ResponseEntity.ok(homeTabsDataResponse);
90+
// }
91+
//
92+
//
93+
// @GetMapping(value = "/filter", params = "q")
94+
// public ResponseEntity<?> getFilterAttributesProducts(@RequestParam("g") String queryParams) {
95+
// String[] splitParams = queryParams.split("=");
96+
// if (splitParams.length >= 1 && splitParams[0].equals("productname")) {
97+
// queryParams = "category=all";
98+
// }
99+
//
100+
// FilterAttributesResponse result = commonDataService.getFilterAttributesByProducts(queryParams);
101+
//
102+
// if (result == null) {
103+
// return ResponseEntity.badRequest().body("Query has not followed the required format.");
104+
// }
105+
//
106+
// return ResponseEntity.ok(result);
107+
// }
108+
//
109+
// @GetMapping("/search-suggestion-list")
110+
// public ResponseEntity<?> getSearchSuggestionList() {
111+
// SearchSuggestionResponse searchSuggestionResponse = commonDataService.getSearchSuggestionList();
112+
// if (searchSuggestionResponse == null) {
113+
// return new ResponseEntity<Error>(HttpStatus.CONFLICT);
114+
// }
115+
//
116+
// return ResponseEntity.ok(searchSuggestionResponse);
117+
// }
118+
//}
Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +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-
ApparelCategory findByClothesTypeAndGender(String clothesType, String Gender);
19-
20-
@Query(value = "SELECT c FROM ApparelCategory c")
21-
List<ApparelCategory> getAllData();
22-
23-
ApparelCategory findByType(String title);
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+
// ApparelCategory findByClothesTypeAndGender(String clothesType, String Gender);
19+
//
20+
// @Query(value = "SELECT c FROM ApparelCategory c")
21+
// List<ApparelCategory> getAllData();
22+
//
23+
// ApparelCategory findByType(String title);
24+
//}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /