Class EventPostEditService

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

@Service public class EventPostEditService extends Object
The EventPostEditService class is a Spring service responsible for updating event posts.
Version:
1.0
Author:
Navjot Singh Rakhra
  • Constructor Details

  • Method Details

    • updatePostById

      public org.springframework.http.ResponseEntity<?> updatePostById(Long ID, @Valid @Valid EventPost newEventPostData)
      Updates an existing event post with the specified ID.
      Parameters:
      ID - The ID of the event post to update.
      newEventPostData - The updated event post data.
      Returns:
      A ResponseEntity containing the updated event post information if the update is successful. If unsuccessful, returns a 404 Not Found status code.
    • deletePostById

      public org.springframework.http.ResponseEntity<?> deletePostById(Long ID)
      Deletes an existing event post with the specified ID.
      Parameters:
      ID - The ID of the event post to delete.
      Returns:
      A ResponseEntity containing no content if the deletion is successful. If unsuccessful, returns a 404 Not Found status code.
    • updatePostById

      public org.springframework.http.ResponseEntity<?> updatePostById(Long id, @Valid @Valid EventPost postRecord, Principal principal)
      Updates an existing event post with the specified ID and checks if the user is authorized to edit the post.
      Parameters:
      id - The ID of the event post to update.
      postRecord - The updated event post data.
      principal - The Principal object containing the username of the user making the request.
      Returns:
      A ResponseEntity containing the updated event post information if the update is successful. If unsuccessful, returns a 404 Not Found or 403 Forbidden status code.
    • deletePostById

      public org.springframework.http.ResponseEntity<?> deletePostById(Long id, Principal principal)
      Deletes an existing event post with the specified ID and checks if the user is authorized to delete the post.
      Parameters:
      id - The ID of the event post to delete.
      principal - The Principal object containing the username of the user making the request.
      Returns:
      A ResponseEntity containing no content if the deletion is successful. If unsuccessful, returns a 404 Not Found or 403 Forbidden status code.