MalteMagnussen / CA2-FrontEnd

FrontEnd repo for Course Assignment 2. Hold Krykke.
https://holdkrykke.surge.sh
0 stars 2 forks source link

Multi hobbies & phones #56

Open MrHardcode opened 4 years ago

MrHardcode commented 4 years ago

Make it possible to add multiple hobbies and phones when adding a person with everything

MalteMagnussen commented 4 years ago

Yeah. Having a facade method like: "addHobbyToPerson" might've been nice (and probably easy to code), but hindsight is 20/20.

MalteMagnussen commented 4 years ago

Something like (no errorhandling, no proper returnvalue etc, just the idea)

public void addHobbyToPerson(HobbyDTO_IN hobby, PersonDTO_IN person) {
// Guards
// Transform DTO into entity
// Check if hobby exists in database | em.find
// If it doesn't, persist it. 
// If it does exist, make sure person doesn't have the hobby already.
// Put hobby on persons hobbylist
// Merge person
}