Skip to content

Commit 4941184

Browse files
committed
edit: code
1 parent ac50c26 commit 4941184

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/main/java/com/thisaster/testtask/user/controller/UserController.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,10 @@ public ResponseEntity<UserDTO> updateUser(@PathVariable Long id, @RequestBody @V
4545

4646
@PostMapping("/{id}/subscriptions")
4747
public ResponseEntity<String> addSubscription(@PathVariable Long id, @RequestBody @Validated SubscriptionDTO subscriptionDTO) {
48-
User user = userService.getUserById(id);
4948
Subscription subscription = subscriptionMapper.toEntity(subscriptionDTO);
50-
userService.subscribeUserToSub(user.getId(), subscription);
49+
userService.subscribeUserToSub(id, subscription);
5150
return ResponseEntity.ok("User with id "
52-
+ user.getId()
51+
+ id
5352
+ " subscribe to: "
5453
+ subscriptionDTO.getName());
5554
}

0 commit comments

Comments
 (0)