forked from semaphoreci-demos/semaphore-demo-java-spring
-
Notifications
You must be signed in to change notification settings - Fork 0
/
UserController.java
31 lines (24 loc) · 957 Bytes
/
UserController.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package com.example.springpipelinedemo.controller;
import com.example.springpipelinedemo.controller.forms.SignupForm;
import com.example.springpipelinedemo.dto.UserDto;
import com.example.springpipelinedemo.service.UserService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.validation.Valid;
/**
* Created by Rimantas Jacikevičius on 19.2.14.
*/
@RestController
@RequestMapping("/users")
public class UserController {
private final UserService userService;
public UserController(UserService userService) {
this.userService = userService;
}
@PostMapping
public UserDto signup(@RequestBody @Valid SignupForm signupForm) {
return userService.createUser(signupForm.email, signupForm.password);
}
}