Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ public String extractJwtFromRequest(HttpServletRequest request) {
// }

} else {
// return null;
throw new StoneInscriptionException("Invalid Token Request Bearer not found ", HttpStatus.BAD_REQUEST);

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,21 @@ public ResponseEntity<?> deleteImagesFromPost(HttpServletRequest request,
// return postService.deleteImagesFromPost(email, postId, deletedImageIds);
// }

// @PostMapping("/test/addPoastDiscription/{email}")
// public ResponseEntity<?> addPoastDiscriptionForTest(
// @PathVariable String email,
// @RequestParam String postId,
// @RequestParam String discription) {

// return postService.addPoastDiscription(email, postId, discription);
// }

// @PostMapping("/test/getPostDiscription")
// public ResponseEntity<?> getPostDiscriptionForTest(@RequestParam String postId) {

// return postService.getPostDiscription(postId);
// }

// @PostMapping("/test/postDelete/{email}")
// public ResponseEntity<?> postDeleteForTest(
// @PathVariable String email,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package com.cadac.stone_inscription.post.service;

import java.util.List;

import org.springframework.core.io.InputStreamResource;
import org.springframework.http.ResponseEntity;
import org.springframework.web.multipart.MultipartFile;
package com.cadac.stone_inscription.post.service;
import java.util.List;
import org.springframework.core.io.InputStreamResource;
import org.springframework.http.ResponseEntity;
import org.springframework.web.multipart.MultipartFile;

import com.cadac.stone_inscription.post.dto.InscriptionPostDto;

Expand Down Expand Up @@ -37,16 +37,16 @@ ResponseEntity<?> addPostWithFile(InscriptionPostDto inscriptionPostDto, Multipa

ResponseEntity<?> postDelete(String usernameFromToken, String postId);

ResponseEntity<?> descriptionDelete(String usernameFromToken, String descriptionId);

ResponseEntity<?> updatePost(String usernameFromToken, InscriptionPostDto inscriptionPostDto, String postId,
List<String> deletedImageIds, MultipartFile[] files);

ResponseEntity<?> addImagesToPost(String usernameFromToken, String postId, MultipartFile[] files);

ResponseEntity<?> deleteImagesFromPost(String usernameFromToken, String postId, List<String> deletedImageIds);

ResponseEntity<?> getCommentByUser(String usernameFromToken);
ResponseEntity<?> descriptionDelete(String usernameFromToken, String descriptionId);
ResponseEntity<?> updatePost(String usernameFromToken, InscriptionPostDto inscriptionPostDto, String postId,
List<String> deletedImageIds, MultipartFile[] files);
ResponseEntity<?> addImagesToPost(String usernameFromToken, String postId, MultipartFile[] files);
ResponseEntity<?> deleteImagesFromPost(String usernameFromToken, String postId, List<String> deletedImageIds);
ResponseEntity<?> getCommentByUser(String usernameFromToken);

ResponseEntity<?> getDashboardCounts();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,8 @@ public ResponseEntity<?> userProfile(String usernameFromToken) {
public ResponseEntity<?> postDelete(String usernameFromToken, String postId) {
User user = userRepository.findByEmail(usernameFromToken);

Optional<InscriptionPost> postDelete = inscriptionPostRepo.findById(new ObjectId(postId));
ObjectId objectId = new ObjectId(postId);
Optional<InscriptionPost> postDelete = inscriptionPostRepo.findById(objectId);

if (postDelete.isEmpty()) {
throw new StoneInscriptionException("Unprocesable request", HttpStatus.BAD_REQUEST);
Expand All @@ -338,8 +339,8 @@ public ResponseEntity<?> postDelete(String usernameFromToken, String postId) {
adjustUserImagesUploaded(user, -deletedImageCount);
userRepository.save(user);

publicPostDescriptionRepo.deleteAllByPostId(postId);
inscriptionPostRepo.deleteById(new ObjectId(postId));
publicPostDescriptionRepo.deleteAllByPostId(objectId);
inscriptionPostRepo.deleteById(objectId);
return UserResponse.responseHandler("post deleted", HttpStatus.OK, true);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public interface PublicPostDescriptionRepo extends MongoRepository<PublicPostDes

List<PublicPostDescription> findByPostId(ObjectId postId);

void deleteAllByPostId(String postId);
void deleteAllByPostId(ObjectId postId);

List<PublicPostDescription> findAllByUserId(ObjectId id);

Expand Down
Loading