source: src/main/java/edu/gjoko/schedlr/controllers/rest/NomenclatureApi.java

Last change on this file was 53765dd, checked in by gjoko kostadinov <gjokokostadinov@…>, 11 months ago

Fix bugs.

  • Property mode set to 100755
File size: 1.1 KB
Line 
1package edu.gjoko.schedlr.controllers.rest;
2
3import edu.gjoko.schedlr.entity.BusinessType;
4import edu.gjoko.schedlr.entity.ServiceType;
5import edu.gjoko.schedlr.services.NomenclaturesService;
6import lombok.AllArgsConstructor;
7import org.springframework.web.bind.annotation.GetMapping;
8import org.springframework.web.bind.annotation.PathVariable;
9import org.springframework.web.bind.annotation.RequestMapping;
10import org.springframework.web.bind.annotation.RestController;
11
12import javax.servlet.http.HttpServletRequest;
13import java.util.List;
14
15@RestController
16@RequestMapping("api/nomenclature")
17@AllArgsConstructor
18public class NomenclatureApi {
19
20 private final NomenclaturesService nomenclaturesService;
21 @GetMapping( "/businessTypes")
22 public List<BusinessType> getBusinessTypes() {
23 return nomenclaturesService.getBusinessTypes();
24 }
25
26 @GetMapping( "/serviceTypes/me")
27 public List<ServiceType> getServiceTypesForBusinessType( HttpServletRequest request) {
28 Long ownerId = (long) request.getSession(true).getAttribute("stakeholderId");
29 return nomenclaturesService.findAppropriateBusinessTypesForBusinessByOwnerId(ownerId);
30 }
31}
Note: See TracBrowser for help on using the repository browser.