I have link accessible data in my JSON files now. I have Account.class (Account.java, resource, assembler, controller, embeddable etc..) and same for Post.class. However, I would like to embed the author of the post in the database record for that post. Right now I have this:
"embeddeds": null,
"content": "New content",
"time": "18.00",
"gender": null,
"age": null,
"_links": {
"self": {
"href": "http://localhost:8080/posts/570faae01bdbea94f8c79307"
}
}
I want to have something like this:
"content": "New content",
"time": "18.00",
"gender": null,
"age": null,
"id": "570faae01bdbea94f8c79307",
"_links": {
"self": {
"href": "http://localhost:8080/posts/570faae01bdbea94f8c79307"
},
"post": {
"href": "http://localhost:8080/posts/570faae01bdbea94f8c79307"
}
"madeBy": {
"href": "http://localhost:8080/accounts/someId"
}
How do I implement this? I need to embed the link of the account that made this post into the post itself. Do I have to include the account in the POST controller or do I have to adjust something in the embeddables? I don't know where to start.