added card on post and feed
This commit is contained in:
@@ -33,6 +33,7 @@ public class PostService {
|
||||
private final PostRepository repository;
|
||||
private final PostMapper mapper;
|
||||
private final ImageRepository imageRepository;
|
||||
private final NominatimService nominatimService;
|
||||
|
||||
@CacheEvict(value = "posts", allEntries = true)
|
||||
public PostRequest create(PostRequest request, MultipartFile image) {
|
||||
@@ -95,6 +96,14 @@ public class PostService {
|
||||
post.setCategory(request.getCategory());
|
||||
post.setPhone(request.getPhone());
|
||||
post.setType(request.getType());
|
||||
if (request.getLatitude() != null && request.getLongitude() != null){
|
||||
post.setLatitude(request.getLatitude());
|
||||
post.setLongitude(request.getLongitude());
|
||||
String address = nominatimService.getAddress(request.getLatitude().toString(), request.getLongitude().toString());
|
||||
post.setCity(address);
|
||||
} else {
|
||||
post.setCity(request.getAddress());
|
||||
}
|
||||
|
||||
if (image != null && !image.isEmpty()) {
|
||||
// удаляем старые картинки с диска
|
||||
|
||||
Reference in New Issue
Block a user