Skip to content

Commit

Permalink
Merge pull request #72 from UdL-EPS-SoftArch/crud-Favourite
Browse files Browse the repository at this point in the history
crud-Favourite
  • Loading branch information
rogargon authored Apr 6, 2024
2 parents 3401676 + 5b79590 commit 48a290e
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 5 deletions.
6 changes: 6 additions & 0 deletions EntitiesModel.puml
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,11 @@ class MedicalRecord {
date : Date
}

class FavouritedPets {
id : Long
petId : Long
}


Pet "1" -- "*" MedicalRecord : has >

Expand All @@ -104,4 +109,5 @@ Client "*" -> "*" Shelter : donate >
Adoption "*" -> "1" Pet :adopted >
Adoption "*" -> "1" User :adopt <
ShelterVolunteer "1.*" -> "*" Shelter : works >
User "1" -> "*" FavouritedPets : hasFavourited >
@enduml
18 changes: 18 additions & 0 deletions src/main/java/cat/udl/eps/softarch/demo/domain/FavouritedPets.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package cat.udl.eps.softarch.demo.domain;

import jakarta.persistence.Entity;
import jakarta.persistence.Id;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import lombok.EqualsAndHashCode;

@EqualsAndHashCode(callSuper = true)
@Entity
@Data
public class FavouritedPets extends UriEntity<Long> {
@Id
@NotNull
Long id;

Long petId;
}
8 changes: 3 additions & 5 deletions src/main/java/cat/udl/eps/softarch/demo/domain/User.java
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
package cat.udl.eps.softarch.demo.domain;

import com.fasterxml.jackson.annotation.JsonProperty;

import com.fasterxml.jackson.annotation.JsonValue;
import jakarta.persistence.*;
import jakarta.validation.constraints.Email;
import jakarta.validation.constraints.NotBlank;

import com.fasterxml.jackson.annotation.JsonValue;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.validator.constraints.Length;
Expand Down Expand Up @@ -77,7 +75,7 @@ public boolean isEnabled() {
return true;
}

@ManyToMany
public List<Pet> favouritedPets;
@OneToMany(fetch = FetchType.EAGER)
public List<FavouritedPets> favouritedPets;

}

0 comments on commit 48a290e

Please sign in to comment.