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

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

Fix bugs.

  • Property mode set to 100755
File size: 1.1 KB
RevLine 
[a436340]1package edu.gjoko.schedlr.controllers.rest;
2
3import edu.gjoko.schedlr.entity.BusinessType;
[53765dd]4import edu.gjoko.schedlr.entity.ServiceType;
[a436340]5import edu.gjoko.schedlr.services.NomenclaturesService;
6import lombok.AllArgsConstructor;
7import org.springframework.web.bind.annotation.GetMapping;
[53765dd]8import org.springframework.web.bind.annotation.PathVariable;
[a436340]9import org.springframework.web.bind.annotation.RequestMapping;
10import org.springframework.web.bind.annotation.RestController;
11
[53765dd]12import javax.servlet.http.HttpServletRequest;
[a436340]13import java.util.List;
14
15@RestController
[53765dd]16@RequestMapping("api/nomenclature")
[a436340]17@AllArgsConstructor
[77205be]18public class NomenclatureApi {
[a436340]19
20 private final NomenclaturesService nomenclaturesService;
21 @GetMapping( "/businessTypes")
22 public List<BusinessType> getBusinessTypes() {
23 return nomenclaturesService.getBusinessTypes();
24 }
[53765dd]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 }
[a436340]31}
Note: See TracBrowser for help on using the repository browser.