Page 464 - MDP2022-3
P. 464

@RestController
             @RequestMapping("/api")
             public  class  FriendMatchController  {
                     final  FriendMatchService  friendMatchService;


                     public  FriendMatchController(FriendMatchService  friendMatchService){
                             this.friendMatchService  =  friendMatchService;
                     }


                     @PostMapping("/{postFriendNickname}/friendMatch")
                     public                                          ResponseEntity<FriendMatchResponse>
             friendMatch(@PathVariable("postFriendNickname")  String  postFriendNickname,
                                                                                                                                   @RequestBody  FriendMatchRequest
             friendMatchRequest)  {
                             HttpHeaders  resHeaders  =  new  HttpHeaders();
                             resHeaders.add("Content-Type",  "application/json;charset=UTF-8");
                             FriendMatchResponse  friendMatchResponse  =  new  FriendMatchResponse();
                             try  {
                                     friendMatchResponse  =  friendMatchService.FriendMatchSave(postFriendNickname,
             friendMatchRequest);
                             }catch  (Exception  e){
                                     return   new   ResponseEntity<>(new   FriendMatchResponse(),   resHeaders,
             HttpStatus.OK);
                             }
                             return  new  ResponseEntity<>(friendMatchResponse,  resHeaders,  HttpStatus.OK);
                     }


                     @PostMapping("/{userNickname}/friendPrintAll")
                     public  ResponseEntity<List<FriendMatch>>  friendList(@PathVariable("userNickname")  String
             userNickname){
                             List<FriendMatch>  friendMatchList;
                             HttpHeaders  resHeaders  =  new  HttpHeaders();
                             resHeaders.add("Content-Type",  "application/json;charset=UTF-8");
                             friendMatchList  =  friendMatchService.FriendList(userNickname);
                             log.debug(String.valueOf(friendMatchList));
                             return  new  ResponseEntity<>(friendMatchList,resHeaders,HttpStatus.OK);
                     }






                     @DeleteMapping("/{departStatus}/{postFriendNickname}/friendDelete")
                     public   ResponseEntity<Boolean>   friendDelete(@PathVariable("departStatus")   String
             departStatus,
                                                                                                             @PathVariable("postFriendNickname")   String
             postFriendNickname,
   459   460   461   462   463   464   465   466   467   468   469