Subversion Repositories SmartDukaan

Rev

Rev 36321 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

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