File tree Expand file tree Collapse file tree 3 files changed +2
-8
lines changed
verylinkedin/groups/src/main/java/com/verylinkedin/groupchat Expand file tree Collapse file tree 3 files changed +2
-8
lines changed Original file line number Diff line number Diff line change @@ -19,7 +19,6 @@ public Object execute() {
1919 if (chat .getAdmin ().equals (request .userId ())){
2020 // Delete the chat
2121 groupRepository .delete (chat );
22-
2322 return gson .toJson (new Response (chat .toString (), HttpStatus .OK ));
2423 }
2524 return gson .toJson (new Response (chat .toString (), HttpStatus .METHOD_NOT_ALLOWED ));
Original file line number Diff line number Diff line change @@ -15,15 +15,16 @@ public Object execute() {
1515 // Query the database for GroupChats of the same ID
1616 GroupChat chat = groupRepository .findById (request .groupId ()).get (0 );
1717 if (chat .getAdmin ().equals (request .userId ())) {
18+
1819 // Change the chat details using the given data in the body
1920 chat .setParticipants (request .participants ());
2021 chat .setTitle (request .title ());
2122 chat .setAdmin (request .admin ());
2223 chat .setDescription (request .description ());
2324 chat .setGroupPhoto (request .groupPhoto ());
25+
2426 // Update the group chat in the database
2527 groupRepository .save (chat );
26-
2728 return gson .toJson (new Response (chat .toString (), HttpStatus .OK ));
2829 }
2930 return gson .toJson (new Response (chat .toString (), HttpStatus .METHOD_NOT_ALLOWED ));
Original file line number Diff line number Diff line change @@ -64,16 +64,10 @@ public Object consumer(Message requestFromQueue) {
6464 Command commandObject = (Command ) commandConstructor .newInstance (mappedRequest , groupRepository );
6565 Object response = commandObject .execute ();
6666
67- //Creating the ObjectMapper object
68- //ObjectMapper mapper = new ObjectMapper();
69- //Converting the Object to JSONString
70- //String jsonString = mapper.writeValueAsString(new ResponseEntity<String>((String) response, HttpStatus.OK));
71- //System.out.println(jsonString);
7267 log .info ("Executed the command with response {}" , response );
7368 MessageProperties messageProperties = new MessageProperties ();
7469 messageProperties .setContentType ("json" );
7570 return response ;
76- //return new Message(jsonString.getBytes(), messageProperties);
7771 }
7872 catch (Exception e ) {
7973 log .info (e .toString ());
You can’t perform that action at this time.
0 commit comments