Last change
on this file was 1413ee2, checked in by gjoko kostadinov <gjokokostadinov@…>, 11 months ago |
Add all bug fixes.
|
-
Property mode
set to
100644
|
File size:
1.0 KB
|
Line | |
---|
1 | package edu.gjoko.schedlr.controllers.rest;
|
---|
2 |
|
---|
3 | import edu.gjoko.schedlr.entity.Business;
|
---|
4 | import edu.gjoko.schedlr.entity.Stakeholder;
|
---|
5 | import edu.gjoko.schedlr.services.StakeholderService;
|
---|
6 | import lombok.AllArgsConstructor;
|
---|
7 | import org.springframework.web.bind.annotation.*;
|
---|
8 |
|
---|
9 | import javax.servlet.http.HttpServletRequest;
|
---|
10 | import java.util.List;
|
---|
11 |
|
---|
12 | @RestController
|
---|
13 | @RequestMapping("api/customer")
|
---|
14 | @AllArgsConstructor
|
---|
15 | public class CustomerApi {
|
---|
16 |
|
---|
17 | private final StakeholderService stakeholderService;
|
---|
18 |
|
---|
19 | @GetMapping(path = "/me")
|
---|
20 | public Stakeholder getCustomerInfo(HttpServletRequest request) {
|
---|
21 | Long customerId = (long) request.getSession(true).getAttribute("stakeholderId");
|
---|
22 | return stakeholderService.findById(customerId);
|
---|
23 | }
|
---|
24 |
|
---|
25 | @PatchMapping
|
---|
26 | public void updateCustomer(@RequestBody Stakeholder stakeholder, HttpServletRequest request) {
|
---|
27 | Long customerId = (long) request.getSession(true).getAttribute("stakeholderId");
|
---|
28 | stakeholderService.saveOrUpdateStakeholder(stakeholder, customerId);
|
---|
29 | }
|
---|
30 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.