Subversion Repositories SmartDukaan

Rev

Blame | Last modification | View Log | RSS feed

package com.spice.profitmandi.web.v2.controller;

import com.spice.profitmandi.web.controller.BrandController;
import com.spice.profitmandi.web.v2.response.ApiResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;

@RestController
@RequestMapping("/v2")
public class V2BrandController extends V2BaseController {

    @Autowired
    private BrandController brandController;

    @GetMapping("/brand/all")
    public ResponseEntity<ApiResponse<?>> getAll(HttpServletRequest request,
                                                 @RequestParam(name = "pageNumber") int pageNumber,
                                                 @RequestParam(name = "pageSize") int pageSize) throws Throwable {
        return wrapResponse(brandController.getAll(request, pageNumber, pageSize));
    }

    @GetMapping("/brand/id")
    public ResponseEntity<ApiResponse<?>> getById(HttpServletRequest request,
                                                  @RequestParam(name = "id") int id) throws Throwable {
        return wrapResponse(brandController.getById(request, id));
    }
}