Class EventPostAddService

java.lang.Object
io.github.navjotsrakhra.eventmanager.service.EventPostAddService

@Service public class EventPostAddService extends Object
The EventPostAddService class provides methods for adding new EventPost entities to the repository.
  • Constructor Details

    • EventPostAddService

      public EventPostAddService(EventPostRepository repository)
      Constructor for the EventPostAddService class.
      Parameters:
      repository - The EventPostRepository used for storing event posts.
  • Method Details

    • addEvent

      public org.springframework.http.ResponseEntity<?> addEvent(@Valid @Valid EventPost event, Principal principal)
      Add a new event post to the repository. The postedBy field is set to the username of the currently logged-in user.
      Parameters:
      event - The EventPost object to be added, validated using the @Valid annotation.
      principal - The Principal object containing the username of the user making the request.
      Returns:
      ResponseEntity indicating the result of the operation.