Fixed POST /room (Git merge I will avenge you)
This commit is contained in:
parent
bff433e954
commit
3dfcd30f4e
1 changed files with 2 additions and 2 deletions
|
@ -9,7 +9,6 @@ import java.util.*;
|
|||
import javax.validation.Valid;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.*;
|
||||
import org.springframework.security.core.userdetails.UserDetails;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@RestController
|
||||
|
@ -36,12 +35,13 @@ public class RoomController {
|
|||
private Room save(final RoomSaveRequest r, final Principal principal, boolean setWhenNull) {
|
||||
Room newRoom = new Room();
|
||||
|
||||
final String username = ((UserDetails) principal).getUsername();
|
||||
final String username = principal.getName();
|
||||
final Long userId = userRepository.findByUsername(username).getId();
|
||||
final String img = r.getImage();
|
||||
final String icon = r.getIcon();
|
||||
|
||||
newRoom.setUserId(userId);
|
||||
newRoom.setName(r.getName());
|
||||
if (img != null) {
|
||||
newRoom.setImage(img.getBytes());
|
||||
} else if (setWhenNull) {
|
||||
|
|
Loading…
Reference in a new issue