Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

what is the best way to add current user information related to GetCollection request #2685

Open
SakhriHoussem opened this issue Apr 8, 2024 · 5 comments

Comments

@SakhriHoussem
Copy link

what is the best way to add current user information related to GetCollection request without losing pagination and filters

example
request for a list of articles and I want to add the current user information if this article is saved or not

@javaDeveloperKid
Copy link

javaDeveloperKid commented Apr 8, 2024

I would add a new field to the response. I haven't been using apiplatform for a while but I believe this can be achieved via custom normalizer that get a user from the token and adds new field with expected data.

P.S. This is not an issue but a discussion.

@SakhriHoussem
Copy link
Author

@javaDeveloperKid have you thought about how many items I would have to go through to fill this new field?

@javaDeveloperKid
Copy link

What do you mean by "how many items I would have to go through"? The collection for the resource is added by another normalizer.

@mrossard
Copy link

mrossard commented Apr 8, 2024

That seems like a simple custom state provider to me...?

@SakhriHoussem
Copy link
Author

@mrossard what if your provider gives you a Paginator? how do you change this custom field

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants