need to change a json on a network request from the order
angular/java
want to get the user id but also the products but dunno how to do it so they don t block each other
29 Replies
⌛
This post has been reserved for your question.
Hey @timo! Please useTIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here./close
or theClose Post
button above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.

json
This message has been formatted automatically. You can disable this using
/preferences
.
so need to change the request of the controller to make sure it connects the user by the id but also has the products and displays them right in the frontend


Database-wise you can use JOIN to get both with one request. But I don't know which library you use to access the database.
I use postgressql and hibernate
Biggest problem is that the data im sending back is wrong compare to the html wanna see the products but has to be by id
I see that you don't have
userEmail
in that JSON.I do email [email protected]?
I mean, that JSON above is a request or respone?
Wait, you're returning a password there? 😱
Yeah?
Don't do that. Even though it's just a hash.
Security fears me but the code is Just wrong
Hashcat :kekw:
It is school so security doesn t matter that much
Okay, so what do you want to return?
the userid and the products wich they have ordered
id": 1,
"status": "Placed",
"products": [
]
bassically something like this but need to make sure the id is connected to the user so each order = user
This message has been formatted automatically. You can disable this using
/preferences
.Both handlers that you send above only limit results to a user that is provided by principal.
what do you mean by that sorry don t understand
Sorry, it's late 😄
for me its not im just not a native speaker
I'm talking about this code. In both cases you fetch only data related to the user that is logged in currently.
so i could reframe the controller of getorderbyid? because it should already pick up the user id?
so how should i change this?
If you want to have a different structure than you already have then probably the best way to achieve that would be creating a new class with all fields that you need and then mapping the results. Look for streams in Java.
stream =foreach() but like can t i just change this cuz prob can t do something complicated like that over text
but then i still have the customuser in the frontend in the network etc :/
you down for a call or im i too scary 😅 :boohoo:
@szatkus
I'm not afraid, but I have other things to do 😄
I'm going to sleep. I hope you'll figure this out or someone else could help you.
💤
Post marked as dormant
This post has been inactive for over 300 minutes, thus, it has been archived.
If your question was not answered yet, feel free to re-open this post or create a new one.
In case your post is not getting any attention, you can try to use /help ping
.
Warning: abusing this will result in moderative actions taken against you.