Skip to content

Commit a060f81

Browse files
committed
Backend Shopping Mall
1 parent 5682950 commit a060f81

File tree

4 files changed

+111
-117
lines changed

4 files changed

+111
-117
lines changed

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -112,11 +112,11 @@
112112
<artifactId>spring-boot-starter-cache</artifactId>
113113
</dependency>
114114
<!-- &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>
115+
<!-- <dependency>-->
116+
<!-- <groupId>org.springframework</groupId>-->
117+
<!-- <artifactId>spring-jdbc</artifactId>-->
118+
<!-- <version>5.2.12.RELEASE</version>-->
119+
<!-- </dependency>-->
120120

121121
<dependency>
122122
<groupId>io.springfox</groupId>
Original file line numberDiff line numberDiff line change
@@ -1,55 +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-
//}
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+
}

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

Lines changed: 26 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,26 @@
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-
//
1+
package com.urunov.controller;
2+
3+
import com.urunov.dto.ProductInfoDTO;
4+
import org.springframework.http.ResponseEntity;
5+
import org.springframework.web.bind.annotation.GetMapping;
6+
import org.springframework.web.bind.annotation.RestController;
7+
8+
/**
9+
* User: hamdamboy
10+
* Project: model
11+
* Github: @urunov
12+
*/
13+
14+
@RestController
15+
public class CommonDataController {
16+
17+
private ProductInfoDTO productInfoDTO;
18+
19+
@GetMapping("/result")
20+
public ResponseEntity<?> getResult(){
21+
return (ResponseEntity<?>) productInfoDTO.getProducts();
22+
}
23+
3224
// @Autowired
3325
// Environment environment;
3426
//
@@ -115,4 +107,6 @@
115107
//
116108
// return ResponseEntity.ok(searchSuggestionResponse);
117109
// }
118-
//}
110+
111+
112+
}
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
1-
//package com.urunov.dto;
2-
//
3-
//import com.urunov.entity.elements.info.ProductInfo;
4-
//import lombok.*;
5-
//
6-
//import java.io.Serializable;
7-
//import java.util.List;
8-
//
9-
///**
10-
// * User: hamdamboy
11-
// * Project: model
12-
// * Github: @urunov
13-
// */
14-
//
15-
//@Data
16-
//@Getter
17-
//@Setter
18-
//@NoArgsConstructor
19-
//@AllArgsConstructor
20-
//@ToString
21-
//public class ProductInfoDTO implements Serializable {
22-
//
23-
// private Long totalCount;
24-
// private List<ProductInfo> products;
25-
//}
1+
package com.urunov.dto;
2+
3+
import com.urunov.entity.elements.info.ProductInfo;
4+
import lombok.*;
5+
6+
import java.io.Serializable;
7+
import java.util.List;
8+
9+
/**
10+
* User: hamdamboy
11+
* Project: model
12+
* Github: @urunov
13+
*/
14+
15+
@Data
16+
@Getter
17+
@Setter
18+
@NoArgsConstructor
19+
@AllArgsConstructor
20+
@ToString
21+
public class ProductInfoDTO implements Serializable {
22+
23+
private Long totalCount;
24+
private List<ProductInfo> products;
25+
}

0 commit comments

Comments
 (0)