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
10 changes: 10 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,16 @@
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-webmvc-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ public PetResponse createPet(
saved.getBreed(),
saved.getDateOfBirth(),
saved.getWeightKg(),
saved.getInsuranceNumber(),
saved.getCreatedAt(),
saved.getUpdatedAt()
);
Expand Down
10 changes: 0 additions & 10 deletions src/main/java/org/example/vet1177/dto/request/pet/PetRequest.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@ public class PetRequest {
@Positive
private BigDecimal weightKg;

@Size(max = 100)
private String insuranceNumber;

public PetRequest() {
}

Expand Down Expand Up @@ -68,11 +65,4 @@ public void setWeightKg(BigDecimal weightKg) {
this.weightKg = weightKg;
}

public String getInsuranceNumber() {
return insuranceNumber;
}

public void setInsuranceNumber(String insuranceNumber) {
this.insuranceNumber = insuranceNumber;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ public class PetResponse {
private String breed;
private LocalDate dateOfBirth;
private BigDecimal weightKg;
private String insuranceNumber;
private Instant createdAt;
private Instant updatedAt;

Expand All @@ -23,15 +22,14 @@ public PetResponse() {

public PetResponse(UUID id, UUID ownerId, String name, String species,
String breed, LocalDate dateOfBirth, BigDecimal weightKg,
String insuranceNumber, Instant createdAt, Instant updatedAt) {
Instant createdAt, Instant updatedAt) {
this.id = id;
this.ownerId = ownerId;
this.name = name;
this.species = species;
this.breed = breed;
this.dateOfBirth = dateOfBirth;
this.weightKg = weightKg;
this.insuranceNumber = insuranceNumber;
this.createdAt = createdAt;
this.updatedAt = updatedAt;
}
Expand Down Expand Up @@ -64,10 +62,6 @@ public BigDecimal getWeightKg() {
return weightKg;
}

public String getInsuranceNumber() {
return insuranceNumber;
}

public Instant getCreatedAt() {
return createdAt;
}
Expand Down
11 changes: 5 additions & 6 deletions src/main/java/org/example/vet1177/services/PetService.java
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,11 @@ public Pet updatePet(UUID currentUserId, UUID petId, PetRequest request) {
throw new RuntimeException("Du saknar behörighet för att uppdatera info om djuret");
}

existingPet.setName(updatedPet.getName());
existingPet.setSpecies(updatedPet.getSpecies());
existingPet.setBreed(updatedPet.getBreed());
existingPet.setDateOfBirth(updatedPet.getDateOfBirth());
existingPet.setWeightKg(updatedPet.getWeightKg());
existingPet.setName(request.getName());
existingPet.setSpecies(request.getSpecies());
existingPet.setBreed(request.getBreed());
existingPet.setDateOfBirth(request.getDateOfBirth());
existingPet.setWeightKg(request.getWeightKg());


return petRepository.save(existingPet);
Expand Down Expand Up @@ -152,7 +152,6 @@ private void applyPetRequest(Pet target, PetRequest request) {
target.setBreed(request.getBreed());
target.setDateOfBirth(request.getDateOfBirth());
target.setWeightKg(request.getWeightKg());
target.setInsuranceNumber(request.getInsuranceNumber());
}

}
Loading