Close chat #169
@@ -25,6 +25,7 @@ import org.springframework.security.authentication.InternalAuthenticationService
|
||||
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
|
||||
import org.springframework.security.core.userdetails.UsernameNotFoundException;
|
||||
import org.springframework.security.crypto.password.PasswordEncoder;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
@@ -130,6 +131,7 @@ public class AuthController {
|
||||
}
|
||||
}
|
||||
|
||||
@Transactional(readOnly = true)
|
||||
@GetMapping("/me")
|
||||
public ResponseEntity<UserInfoResponse> getCurrentUser() {
|
||||
User user = getAuthenticatedUser();
|
||||
|
||||
@@ -30,7 +30,7 @@ public class Service {
|
||||
@Column(nullable = false)
|
||||
private Integer serviceDuration;
|
||||
|
||||
@ElementCollection
|
||||
@ElementCollection(fetch = FetchType.EAGER)
|
||||
@CollectionTable(name = "service_species", joinColumns = @JoinColumn(name = "serviceId"))
|
||||
@Column(name = "species", length = 50)
|
||||
private Set<String> species = new HashSet<>();
|
||||
|
||||
@@ -81,6 +81,7 @@ public class RefundService {
|
||||
return toResponse(savedRefund);
|
||||
}
|
||||
|
||||
@Transactional(readOnly = true)
|
||||
public RefundResponse getRefundById(Long id, Long customerId) {
|
||||
Refund refund = refundRepository.findById(id)
|
||||
.orElseThrow(() -> new RuntimeException("Refund not found"));
|
||||
@@ -92,6 +93,7 @@ public class RefundService {
|
||||
return toResponse(refund);
|
||||
}
|
||||
|
||||
@Transactional(readOnly = true)
|
||||
public List<RefundResponse> getAllRefunds(Long customerId) {
|
||||
List<Refund> refunds;
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@ public class ServiceService {
|
||||
this.serviceRepository = serviceRepository;
|
||||
}
|
||||
|
||||
@Transactional(readOnly = true)
|
||||
public Page<ServiceResponse> getAllServices(String query, Pageable pageable) {
|
||||
Page<com.petshop.backend.entity.Service> services;
|
||||
if (query != null && !query.trim().isEmpty()) {
|
||||
@@ -29,6 +30,7 @@ public class ServiceService {
|
||||
return services.map(this::mapToResponse);
|
||||
}
|
||||
|
||||
@Transactional(readOnly = true)
|
||||
public ServiceResponse getServiceById(Long id) {
|
||||
com.petshop.backend.entity.Service service = serviceRepository.findById(id)
|
||||
.orElseThrow(() -> new ResourceNotFoundException("Service not found with id: " + id));
|
||||
|
||||
Reference in New Issue
Block a user