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

fix swagger docs, follow endpoint and get_user_page endpoint #389

Merged
merged 2 commits into from
Dec 16, 2024

Conversation

yusufaygun
Copy link
Contributor

@yusufaygun yusufaygun commented Dec 15, 2024

  • Added authentication headers and 401 responses to Swagger documentation for all IsAuthenticated endpoints to allow proper testing via Swagger API.
  • Updated follow/unfollow endpoint to use username instead of user_id for better client compatibility.
  • Added new fields to game bookmark entity in the response of the get_user_page endpoint for client side to handle bookmarks properly

- Added authentication headers and 401 responses to Swagger documentation for all IsAuthenticated endpoints to allow proper testing via Swagger API.
- Updated follow/unfollow endpoint to use username instead of user_id for better client compatibility.
@yusufaygun yusufaygun added the Component: Backend Issues related to server-side logic or infrastructure label Dec 15, 2024
@yusufaygun yusufaygun added this to the Milestone 3 - (Final) milestone Dec 15, 2024
@yusufaygun yusufaygun self-assigned this Dec 15, 2024
@yusufaygun yusufaygun marked this pull request as draft December 15, 2024 18:58
- Added new fields to game bookmark entity in the response of the get_user_page endpoint for client side to handle bookmarks properly
- Updated swagger doc and unit tests accordingly
@yusufaygun yusufaygun marked this pull request as ready for review December 15, 2024 19:02
@yusufaygun yusufaygun changed the title fix swagger docs and follow endpoint fix swagger docs, follow endpoint and get_user_page endpoint Dec 15, 2024
Copy link
Member

@sonerkuyar sonerkuyar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't understand why did we call the fields like with double under score,
If its not necessary, might be confusing for client apps.

self.assertIn('game__id', bookmark) self.assertIn('game__event', bookmark) self.assertIn('game__site', bookmark) self.assertIn('game__white', bookmark) self.assertIn('game__black', bookmark) self.assertIn('game__result', bookmark) self.assertIn('game__year', bookmark) self.assertIn('game__month', bookmark) self.assertIn('game__day', bookmark) self.assertIn('game__pgn', bookmark)

@yusufaygun
Copy link
Contributor Author

I didn't understand why did we call the fields like with double under score, If its not necessary, might be confusing for client apps.

self.assertIn('game__id', bookmark) self.assertIn('game__event', bookmark) self.assertIn('game__site', bookmark) self.assertIn('game__white', bookmark) self.assertIn('game__black', bookmark) self.assertIn('game__result', bookmark) self.assertIn('game__year', bookmark) self.assertIn('game__month', bookmark) self.assertIn('game__day', bookmark) self.assertIn('game__pgn', bookmark)

The reason we use double underscores (game__field_name) is that GameBookmark is related to Game via a ForeignKey. To access fields from the Game model, Django ORM requires double underscores to reference related model fields. Without double underscores, fields like id or title would refer to GameBookmark instead of Game. This is a standard Django practice for querying related model fields, therefore we called the fields like that but thanks for review!

@sonerkuyar
Copy link
Member

Okey, thanks for answering, I'm merging the PR, LGTM!

@sonerkuyar sonerkuyar merged commit d60879a into backend Dec 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Backend Issues related to server-side logic or infrastructure
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants