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

[feature request] User documents list in user API endpoint #262

Open
r-xyz opened this issue Nov 26, 2024 · 2 comments · Fixed by #263
Open

[feature request] User documents list in user API endpoint #262

r-xyz opened this issue Nov 26, 2024 · 2 comments · Fixed by #263

Comments

@r-xyz
Copy link
Contributor

r-xyz commented Nov 26, 2024

Hi,
It would be interesting being able to have user document to show up as list of filenames in user API endpoint.

On the one hand, I had been looking into implementing it, and I managed to add a new user_documents API endpoint which works as expected.
On the other hand, I am struggling to map it to user endpoint so a list can be shown for users having documents associated with.

Any suggestions?

@rptmat57
Copy link
Contributor

rptmat57 commented Dec 6, 2024

You should be able to create a UserDocumentSerializer, then add to UserSerializer something like documents = UserDocumentSerializer(many=True, read_only=True) and add it to the UserSerializer's expandable fields as well.

Then you should see the list of ids of UserDocuments and if you use ?expand=documents you will have the full list of UserDocuments including filenames.

I have not tested it, so you might have to tweak a few things

r-xyz added a commit to r-xyz/NEMO that referenced this issue Dec 9, 2024
rptmat57 pushed a commit that referenced this issue Dec 11, 2024
@rptmat57
Copy link
Contributor

just a note here that there is now also a way to serve those login-protected media files using NEMO's API (so files can be retrieved using API token authentication)

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

Successfully merging a pull request may close this issue.

2 participants