11package opensource .bravest .domain .chatList .controller ;
22
3+ import static opensource .bravest .domain .chatList .dto .ChatListDto .ChatListCreateRequest ;
34import static opensource .bravest .domain .chatList .dto .ChatListDto .ChatListResponse ;
45import static opensource .bravest .domain .chatList .dto .ChatListDto .ChatListUpdateRequest ;
5- import static opensource .bravest .domain .chatList .dto .ChatListDto .ChatListCreateRequest ;
66
7+ import jakarta .validation .Valid ;
8+ import java .util .List ;
9+ import lombok .RequiredArgsConstructor ;
710import opensource .bravest .domain .chatList .service .ChatListService ;
811import opensource .bravest .global .apiPayload .ApiResponse ;
912import org .springframework .web .bind .annotation .DeleteMapping ;
1518import org .springframework .web .bind .annotation .RequestMapping ;
1619import org .springframework .web .bind .annotation .RestController ;
1720
18- import lombok .RequiredArgsConstructor ;
19- import org .springframework .http .HttpStatus ;
20- import org .springframework .http .ResponseEntity ;
21- import jakarta .validation .Valid ;
22- import java .util .List ;
23-
2421@ RestController
2522@ RequestMapping ("/chatlists" )
2623@ RequiredArgsConstructor
2724public class ChatListController {
2825
29- private final ChatListService chatListService ;
30-
31- @ PostMapping
32- public ApiResponse <ChatListResponse > createChatList (@ Valid @ RequestBody ChatListCreateRequest request ) {
33- ChatListResponse response = chatListService .createChatList (request );
34- return ApiResponse .onSuccess (response );
35- }
36-
37- @ GetMapping ("/room/{roomId}" )
38- public ApiResponse <List <ChatListResponse >> getChatListsByRoomId (@ PathVariable Long roomId ) {
39- List <ChatListResponse > response = chatListService .getChatListsByRoomId (roomId );
40- return ApiResponse .onSuccess (response );
41- }
42-
43- @ GetMapping ("/{id}" )
44- public ApiResponse <ChatListResponse > getChatListById (@ PathVariable Long id ) {
45- ChatListResponse response = chatListService .getChatListById (id );
46- return ApiResponse .onSuccess (response );
47- }
48-
49- @ PutMapping ("/{id}" )
50- public ApiResponse <ChatListResponse > updateChatList (@ PathVariable Long id ,
51- @ Valid @ RequestBody ChatListUpdateRequest request ) {
52- ChatListResponse response = chatListService .updateChatList (id , request );
53- return ApiResponse .onSuccess (response );
54- }
55-
56- @ DeleteMapping ("/{id}" )
57- public ApiResponse <Void > deleteChatList (@ PathVariable Long id ) {
58- chatListService .deleteChatList (id );
59- return ApiResponse .onSuccess (null );
60- }
61- }
26+ private final ChatListService chatListService ;
27+
28+ @ PostMapping
29+ public ApiResponse <ChatListResponse > createChatList (
30+ @ Valid @ RequestBody ChatListCreateRequest request ) {
31+ ChatListResponse response = chatListService .createChatList (request );
32+ return ApiResponse .onSuccess (response );
33+ }
34+
35+ @ GetMapping ("/room/{roomId}" )
36+ public ApiResponse <List <ChatListResponse >> getChatListsByRoomId (@ PathVariable Long roomId ) {
37+ List <ChatListResponse > response = chatListService .getChatListsByRoomId (roomId );
38+ return ApiResponse .onSuccess (response );
39+ }
40+
41+ @ GetMapping ("/{id}" )
42+ public ApiResponse <ChatListResponse > getChatListById (@ PathVariable Long id ) {
43+ ChatListResponse response = chatListService .getChatListById (id );
44+ return ApiResponse .onSuccess (response );
45+ }
46+
47+ @ PutMapping ("/{id}" )
48+ public ApiResponse <ChatListResponse > updateChatList (
49+ @ PathVariable Long id , @ Valid @ RequestBody ChatListUpdateRequest request ) {
50+ ChatListResponse response = chatListService .updateChatList (id , request );
51+ return ApiResponse .onSuccess (response );
52+ }
53+
54+ @ DeleteMapping ("/{id}" )
55+ public ApiResponse <Void > deleteChatList (@ PathVariable Long id ) {
56+ chatListService .deleteChatList (id );
57+ return ApiResponse .onSuccess (null );
58+ }
59+ }
0 commit comments