|
1 | 1 | package com.hoangtien2k3.ticketbookingapi.controller;
|
2 | 2 |
|
3 | 3 | import com.hoangtien2k3.ticketbookingapi.entity.User;
|
4 |
| -import com.hoangtien2k3.ticketbookingapi.model.UserNameProfile; |
| 4 | +import com.hoangtien2k3.ticketbookingapi.dao.UserNameProfile; |
5 | 5 | import com.hoangtien2k3.ticketbookingapi.service.UserService;
|
6 | 6 | import io.swagger.annotations.Api;
|
7 | 7 | import io.swagger.annotations.ApiOperation;
|
|
14 | 14 | import java.text.ParseException;
|
15 | 15 | import java.util.HashMap;
|
16 | 16 |
|
17 |
| -@Api(value = "API User") |
18 | 17 | @RestController
|
19 |
| -@RequestMapping("/users") |
| 18 | +@Api(value = "API User") |
| 19 | +@RequestMapping("/user") |
20 | 20 | public class UserController {
|
21 | 21 | @Autowired
|
22 |
| - private UserService userService; |
| 22 | + UserService userService; |
23 | 23 |
|
24 |
| - @ApiOperation(value = "User Register") // annotation mô tả của swagger |
| 24 | + @ApiOperation(value = "User Register") |
25 | 25 | @PostMapping("/register")
|
26 |
| - public ResponseEntity<?> registerUser(@Valid @RequestBody User user) { |
| 26 | + public ResponseEntity<?> registerUser(@Valid @RequestBody User user){ |
27 | 27 | return ResponseEntity.ok(userService.registerUser(user));
|
28 | 28 | }
|
29 | 29 |
|
30 |
| - |
31 |
| - @ApiOperation(value = "update later") |
| 30 | + @ApiOperation(value = "Update later") |
32 | 31 | @PostMapping("/update")
|
33 |
| - public ResponseEntity<?> loginUser(Authentication authentication, @Valid @RequestBody UserNameProfile user) throws ParseException { |
| 32 | + public ResponseEntity<?> updateUser(Authentication authentication, @Valid @RequestBody UserNameProfile user) throws ParseException { |
34 | 33 | return ResponseEntity.ok(userService.updateUser(authentication, user));
|
35 | 34 | }
|
36 | 35 |
|
37 |
| - |
38 | 36 | @ApiOperation(value = "Login - Get Token Login")
|
39 | 37 | @PostMapping("/login")
|
40 |
| - public ResponseEntity<?> loginUser(@Valid @RequestBody HashMap<String, String> request) { |
| 38 | + public ResponseEntity<?> loginUser(@Valid @RequestBody HashMap<String, String> request){ |
41 | 39 | return ResponseEntity.ok(userService.loginUser(request.get("username"), request.get("password")));
|
42 | 40 | }
|
43 | 41 |
|
44 |
| - |
45 | 42 | @GetMapping("/info")
|
46 |
| - public ResponseEntity<?> getInfo(Authentication authentication) { |
| 43 | + public ResponseEntity<?> getInfo(Authentication authentication){ |
47 | 44 | return ResponseEntity.ok(userService.getInfo(authentication));
|
48 | 45 | }
|
49 |
| - |
50 | 46 | }
|
0 commit comments