Skip to content

Commit

Permalink
✨ feat: 그룹 생성 API presentation (#23)
Browse files Browse the repository at this point in the history
  • Loading branch information
loveysuby committed Jul 12, 2024
1 parent f03a297 commit 168681e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package slvtwn.khu.toyouserver.dto;

public record GroupCreateRequest(String name) {
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,25 @@
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import slvtwn.khu.toyouserver.application.GroupService;
import slvtwn.khu.toyouserver.dto.GroupCreateRequest;
import slvtwn.khu.toyouserver.dto.GroupResponse;

@RequiredArgsConstructor
@RestController
public class GroupController {

private final GroupService groupService;
private final GroupService groupService;

@PostMapping("/groups/{groupId}/members")
public GroupResponse registerMember(@PathVariable long groupId) {
return groupService.registerUser(groupId, 1L); // TODO: user -> argumentResolver 등록 필요
}
@PostMapping("/groups/create")
public GroupResponse createGroup(@RequestBody GroupCreateRequest request) {
return groupService.create(request.name());
}

@PostMapping("/groups/{groupId}/members")
public GroupResponse registerMember(@PathVariable long groupId) {
return groupService.registerUser(groupId, 1L); // TODO: user -> argumentResolver 등록 필요
}
}

0 comments on commit 168681e

Please sign in to comment.