Skip to content

expose aliases in the REST API #5

New issue

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

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

Already on GitHub? # to your account

Open
macolo opened this issue Jun 12, 2024 · 5 comments · May be fixed by #14
Open

expose aliases in the REST API #5

macolo opened this issue Jun 12, 2024 · 5 comments · May be fixed by #14

Comments

@macolo
Copy link

macolo commented Jun 12, 2024

  • aliases endpoint
@macolo macolo changed the title expose aliases expose aliases in the REST API Jun 12, 2024
@fsbraun
Copy link
Member

fsbraun commented Nov 19, 2024

@sourcery-ai review

Copy link

sourcery-ai bot commented Nov 19, 2024

I'm sorry, I don't understand the command @sourcery-ai review.

Please use:

  • @sourcery-ai plan to generate an implementation plan for this issue.
  • @sourcery-ai develop to request a PR for this issue.

@fsbraun
Copy link
Member

fsbraun commented Nov 19, 2024

@sourcery-ai plan

Copy link

sourcery-ai bot commented Nov 19, 2024

Objectives

  • Create a new API endpoint to expose page aliases
  • Implement an AliasSerializer to handle alias data representation
  • Add URL routing for the aliases endpoint in djangocms_rest/urls.py
  • Create an AliasList view class to handle alias listing and retrieval
  • Add documentation for the new aliases endpoint
  • Write tests to verify alias endpoint functionality

Setup commands

File changes

djangocms_rest/serializers/aliasserializer.py

  • Create new AliasSerializer class that inherits from serializers.Serializer
  • Add fields for alias data: url, redirect_to, language, is_active
  • Implement to_representation method to convert alias data to JSON format

djangocms_rest/views.py

  • Import Alias model from django CMS
  • Create new AliasList view class inheriting from APIView
  • Implement get method to return list of aliases for a given language
  • Add permission checks to ensure user has access to view aliases

djangocms_rest/urls.py

  • Add new URL pattern for aliases endpoint using <slug:language>/aliases/
  • Map URL to AliasList.as_view() with name cms-alias-list

tests/test_rendering.py

  • Add new test class AliasAPITestCase inheriting from RESTTestCase
  • Add test method to verify alias list endpoint returns correct data
  • Add test method to verify alias endpoint handles language filtering
  • Add test method to verify permission checks for alias access

Verify commands

  • python -m pytest tests/test_rendering.py -v - ❌

This plan was automatically generated.
Please review the plan carefully and make any necessary adjustments.

@fsbraun
Copy link
Member

fsbraun commented Nov 19, 2024

@sourcery-ai develop

sourcery-ai bot added a commit that referenced this issue Nov 19, 2024
Add a new API endpoint for page aliases with corresponding serializer, view, and URL routing. Include tests and documentation for the new functionality.

New Features:
- Introduce a new API endpoint to expose page aliases, allowing users to retrieve alias information based on language.

Enhancements:
- Implement an AliasSerializer to handle the representation of alias data, including fields for URL, redirect target, language, and active status.

Documentation:
- Add documentation for the new aliases endpoint, detailing its usage and functionality.

Tests:
- Add tests for the alias endpoint, including checks for correct data retrieval, language filtering, and permission handling.

Resolves #5
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants