Project first commit

This commit is contained in:
ilyin 2024-07-18 18:01:54 +03:00
commit b3e4f6cffe
205 changed files with 39437 additions and 0 deletions

View file

@ -0,0 +1,34 @@
package controller;
import dto.jivoprofile.JivoProfileDto;
import org.hsqldb.lib.StringUtil;
import org.springframework.web.bind.annotation.*;
import ru.cg.webbpm.modules.security.api.model.User;
import ru.cg.webbpm.modules.security.api.service.UserService;
@RestController
public class ProfileController {
private UserService userService;
public ProfileController(UserService userService) {
this.userService = userService;
}
@RequestMapping(value = "/profile/jivo/{userId}", method = RequestMethod.GET)
public JivoProfileDto profile(@PathVariable("userId") String userId) {
if (StringUtil.isEmpty(userId)) {
return new JivoProfileDto();
}
User user = userService.get(userId);
JivoProfileDto profileDto = new JivoProfileDto();
profileDto.setUsername(user.firstName());
profileDto.setEmail(user.email());
profileDto.setPhone(user.phone());
return profileDto;
}
}