/** * /user/delete/person?id=[id] -> delete the person user having the passed id. * * @param id The id for the person to delete * @return A string describing if the person is succesfully deleted or not. */ @RequestMapping("/user/delete/person") @ResponseBody public String deletePerson(long id) { try { personRepository.delete(new Person(id)); } catch (Exception ex) { return "Error deleting the user:" + ex.toString(); } return "User succesfully deleted!"; }
/** * /user/create/person?email=[email]&firstName=[firstName] -> create a new * person user and save it in the database. * * @param email The person's email * @param firstName The person's first name * @return a string describing if the person is succesfully created or not. */ @RequestMapping("/user/create/person") @ResponseBody public String createPerson(String email, String firstName) { try { Person person = new Person(); person.setEmail(email); person.setFirstName(firstName); personRepository.save(person); } catch (Exception ex) { return "Error creating the person: " + ex.toString(); } return "Person succesfully created!"; }