| 36321 |
vikas |
1 |
package com.spice.profitmandi.web.v2.controller;
|
|
|
2 |
|
| 36482 |
vikas |
3 |
import com.spice.profitmandi.service.catalog.BrandsService;
|
| 36321 |
vikas |
4 |
import com.spice.profitmandi.web.controller.BrandController;
|
|
|
5 |
import com.spice.profitmandi.web.v2.response.ApiResponse;
|
|
|
6 |
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
7 |
import org.springframework.http.ResponseEntity;
|
| 36482 |
vikas |
8 |
import org.springframework.transaction.annotation.Transactional;
|
| 36321 |
vikas |
9 |
import org.springframework.web.bind.annotation.*;
|
|
|
10 |
|
|
|
11 |
import javax.servlet.http.HttpServletRequest;
|
|
|
12 |
|
|
|
13 |
@RestController
|
|
|
14 |
@RequestMapping("/v2")
|
|
|
15 |
public class V2BrandController extends V2BaseController {
|
|
|
16 |
|
|
|
17 |
@Autowired
|
|
|
18 |
private BrandController brandController;
|
|
|
19 |
|
| 36482 |
vikas |
20 |
@Autowired
|
|
|
21 |
private BrandsService brandsService;
|
|
|
22 |
|
| 36321 |
vikas |
23 |
@GetMapping("/brand/all")
|
|
|
24 |
public ResponseEntity<ApiResponse<?>> getAll(HttpServletRequest request,
|
|
|
25 |
@RequestParam(name = "pageNumber") int pageNumber,
|
|
|
26 |
@RequestParam(name = "pageSize") int pageSize) throws Throwable {
|
|
|
27 |
return wrapResponse(brandController.getAll(request, pageNumber, pageSize));
|
|
|
28 |
}
|
|
|
29 |
|
|
|
30 |
@GetMapping("/brand/id")
|
|
|
31 |
public ResponseEntity<ApiResponse<?>> getById(HttpServletRequest request,
|
|
|
32 |
@RequestParam(name = "id") int id) throws Throwable {
|
|
|
33 |
return wrapResponse(brandController.getById(request, id));
|
|
|
34 |
}
|
| 36482 |
vikas |
35 |
|
|
|
36 |
@Transactional(readOnly = true)
|
|
|
37 |
@GetMapping("/brand/active")
|
|
|
38 |
public ResponseEntity<ApiResponse<?>> getActiveBrands() throws Throwable {
|
|
|
39 |
return ResponseEntity.ok(ApiResponse.success(brandsService.getAllActiveBrands()));
|
|
|
40 |
}
|
| 36321 |
vikas |
41 |
}
|