Class MessageService

java.lang.Object
com.nadiyar.kiwi.MessageService

@Service public class MessageService extends Object
Used to handle operations related to a Message

This class safely wraps all methods and operations possible to be done on a message for public but internal usage. This class is configured to be used with Spring DI.

Author:
Nadiyar
  • Constructor Details

  • Method Details

    • saveMessage

      public Message saveMessage(String content, String sentBy)
      Write a message to database
      Parameters:
      content -
      sentBy -
      Returns:
      Message
    • getAllMessages

      public List<Message> getAllMessages()
      Return all messages saved in the database in json
      Returns:
      a json list containing all messages
        [
           {
               "id": 1,
               "content": "hi",
               "sentBy": "Anon",
               "sentAt": "2025-07-30T19:07:34.316944Z"
           },
           ...
        ]