mirror of
https://github.com/Prominence/car-repair-site.git
synced 2026-01-09 19:56:43 +03:00
Fixed person validation. Removed unused code.
This commit is contained in:
parent
db9b92fa1a
commit
cf23b7842a
@ -1,7 +1,7 @@
|
||||
package com.github.prominence.carrepair.model;
|
||||
|
||||
import javax.persistence.*;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.Size;
|
||||
import java.util.Objects;
|
||||
|
||||
@ -12,7 +12,7 @@ abstract public class Person {
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
protected Long id;
|
||||
|
||||
@NotNull
|
||||
@NotBlank
|
||||
@Size(max = 64)
|
||||
@Column(name = "firstName")
|
||||
protected String firstName;
|
||||
@ -21,7 +21,7 @@ abstract public class Person {
|
||||
@Column(name = "middleName")
|
||||
protected String middleName;
|
||||
|
||||
@NotNull
|
||||
@NotBlank
|
||||
@Size(max = 64)
|
||||
@Column(name = "lastName")
|
||||
protected String lastName;
|
||||
|
||||
@ -11,9 +11,6 @@ import java.util.List;
|
||||
@Repository
|
||||
public interface ClientRepository extends JpaRepository<Client, Long> {
|
||||
|
||||
@Query(value = "select c.id from Client c")
|
||||
public List<Long> findAllClientIds();
|
||||
|
||||
@Query(value = "select c from Client c where c.firstName like concat('%', :query, '%') or c.middleName like concat('%', :query, '%') or c.lastName like concat('%', :query, '%')")
|
||||
public List<Client> findAllByInitials(@Param(value = "query") String query);
|
||||
}
|
||||
|
||||
@ -11,9 +11,6 @@ import java.util.List;
|
||||
@Repository
|
||||
public interface MechanicRepository extends JpaRepository<Mechanic, Long> {
|
||||
|
||||
@Query(value = "select m.id from Mechanic m")
|
||||
public List<Long> findAllMechanicIds();
|
||||
|
||||
@Query(value = "select m from Mechanic m where m.firstName like concat('%', :query, '%') or m.middleName like concat('%', :query, '%') or m.lastName like concat('%', :query, '%')")
|
||||
public List<Mechanic> findAllByInitials(@Param(value = "query") String query);
|
||||
}
|
||||
|
||||
@ -43,10 +43,6 @@ public class ClientService {
|
||||
return clientRepository.count();
|
||||
}
|
||||
|
||||
public List<Long> getAllClientIds() {
|
||||
return clientRepository.findAllClientIds();
|
||||
}
|
||||
|
||||
public List<Client> searchByInitials(String query) {
|
||||
return clientRepository.findAllByInitials(query);
|
||||
}
|
||||
|
||||
@ -63,10 +63,6 @@ public class MechanicService {
|
||||
return mechanicRepository.count();
|
||||
}
|
||||
|
||||
public List<Long> getAllMechanicIds() {
|
||||
return mechanicRepository.findAllMechanicIds();
|
||||
}
|
||||
|
||||
public List<Mechanic> searchByInitials(String query) {
|
||||
return mechanicRepository.findAllByInitials(query);
|
||||
}
|
||||
|
||||
@ -30,10 +30,6 @@ public class OrderService {
|
||||
this.orderValidator = orderValidator;
|
||||
}
|
||||
|
||||
public Page<Order> findAll(Pageable pageable) {
|
||||
return orderRepository.findAll(pageable);
|
||||
}
|
||||
|
||||
public Page<Order> findAll(Specification<Order> specification, Pageable pageable) {
|
||||
return orderRepository.findAll(specification, pageable);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user