fix tests and silent failures
This commit is contained in:
@@ -410,6 +410,7 @@ public class AuthController {
|
||||
try {
|
||||
avatarStorageService.deleteAvatar(user);
|
||||
} catch (IOException e) {
|
||||
log.warn("Failed to delete avatar for user {}: {}", user.getId(), e.getMessage());
|
||||
}
|
||||
user.setAvatarUrl(null);
|
||||
userRepository.save(user);
|
||||
|
||||
@@ -326,17 +326,25 @@ public class AppointmentService {
|
||||
|
||||
AppointmentResponse response = new AppointmentResponse();
|
||||
response.setAppointmentId(appointment.getAppointmentId());
|
||||
response.setCustomerId(appointment.getCustomer().getId());
|
||||
response.setCustomerName(appointment.getCustomer().getFirstName() + " " + appointment.getCustomer().getLastName());
|
||||
response.setStoreId(appointment.getStore().getStoreId());
|
||||
response.setStoreName(appointment.getStore().getStoreName());
|
||||
response.setServiceId(appointment.getService().getServiceId());
|
||||
response.setServiceName(appointment.getService().getServiceName());
|
||||
if (appointment.getCustomer() != null) {
|
||||
response.setCustomerId(appointment.getCustomer().getId());
|
||||
response.setCustomerName(appointment.getCustomer().getFirstName() + " " + appointment.getCustomer().getLastName());
|
||||
}
|
||||
if (appointment.getStore() != null) {
|
||||
response.setStoreId(appointment.getStore().getStoreId());
|
||||
response.setStoreName(appointment.getStore().getStoreName());
|
||||
}
|
||||
if (appointment.getService() != null) {
|
||||
response.setServiceId(appointment.getService().getServiceId());
|
||||
response.setServiceName(appointment.getService().getServiceName());
|
||||
}
|
||||
response.setAppointmentDate(appointment.getAppointmentDate());
|
||||
response.setAppointmentTime(appointment.getAppointmentTime());
|
||||
response.setAppointmentStatus(appointment.getAppointmentStatus());
|
||||
response.setEmployeeId(appointment.getEmployee().getId());
|
||||
response.setEmployeeName(appointment.getEmployee().getFirstName() + " " + appointment.getEmployee().getLastName());
|
||||
if (appointment.getEmployee() != null) {
|
||||
response.setEmployeeId(appointment.getEmployee().getId());
|
||||
response.setEmployeeName(appointment.getEmployee().getFirstName() + " " + appointment.getEmployee().getLastName());
|
||||
}
|
||||
response.setPetName(pet != null ? pet.getPetName() : null);
|
||||
response.setPetId(pet != null ? pet.getPetId() : null);
|
||||
response.setCreatedAt(appointment.getCreatedAt());
|
||||
|
||||
@@ -12,7 +12,7 @@ import com.stripe.exception.StripeException;
|
||||
import com.stripe.model.PaymentIntent;
|
||||
import com.stripe.param.PaymentIntentCreateParams;
|
||||
import jakarta.annotation.PostConstruct;
|
||||
import jakarta.transaction.Transactional;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
|
||||
@@ -9,6 +9,8 @@ import com.petshop.backend.exception.BusinessException;
|
||||
import com.petshop.backend.exception.ResourceNotFoundException;
|
||||
import com.petshop.backend.repository.CategoryRepository;
|
||||
import com.petshop.backend.repository.ProductRepository;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.core.io.Resource;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.data.domain.Page;
|
||||
@@ -23,6 +25,8 @@ import java.util.Locale;
|
||||
@Service
|
||||
public class ProductService {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(ProductService.class);
|
||||
|
||||
private final ProductRepository productRepository;
|
||||
private final CategoryRepository categoryRepository;
|
||||
private final CatalogImageStorageService catalogImageStorageService;
|
||||
@@ -152,7 +156,8 @@ public class ProductService {
|
||||
}
|
||||
try {
|
||||
catalogImageStorageService.deleteProductImage(storedImagePath);
|
||||
} catch (IOException | IllegalArgumentException ignored) {
|
||||
} catch (IOException | IllegalArgumentException e) {
|
||||
log.warn("Failed to delete stored image {}: {}", storedImagePath, e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -367,8 +367,11 @@ public class SaleService {
|
||||
SaleResponse response = new SaleResponse();
|
||||
response.setSaleId(sale.getSaleId());
|
||||
response.setSaleDate(sale.getSaleDate());
|
||||
response.setEmployeeId(sale.getEmployee().getId());
|
||||
response.setEmployeeName(sale.getEmployee().getFirstName() + " " + sale.getEmployee().getLastName());
|
||||
|
||||
if (sale.getEmployee() != null) {
|
||||
response.setEmployeeId(sale.getEmployee().getId());
|
||||
response.setEmployeeName(sale.getEmployee().getFirstName() + " " + sale.getEmployee().getLastName());
|
||||
}
|
||||
|
||||
if (sale.getStore() != null) {
|
||||
response.setStoreId(sale.getStore().getStoreId());
|
||||
|
||||
Reference in New Issue
Block a user