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

There is a bug with relation parameter name in URLs #168

Closed
ozziest opened this issue Apr 15, 2023 · 0 comments
Closed

There is a bug with relation parameter name in URLs #168

ozziest opened this issue Apr 15, 2023 · 0 comments
Assignees
Labels
bug Something isn't working version-patch It is just a patch for the current version. It is not a new feature, nor a breaking change.
Projects

Comments

@ozziest
Copy link
Member

ozziest commented Apr 15, 2023

Problem

  • PATCH /api/v1/customers/:id
  • PATCH /api/v1/customers/:parentId/employees/:id
  • DELETE /api/v1/customers/:parentId/employees/:id
  • POST /api/v1/customers/:parentId/employees/:parentId/children

We can't use parentId multiple times in URL. We can't find the correct parameter for the correct model.

Expectation

  • PATCH /api/v1/customers/:id
  • PATCH /api/v1/customers/:customerId/employees/:id
  • DELETE /api/v1/customers/:customerId/employees/:id
  • POST /api/v1/customers/:customerId/employees/:employeeId/children

We should use the following pattern;

  • Model name (singular version) + model primary key
  • It should be camelCase

Examples

  • User.id -> userId
  • User.uuid -> userUuid
  • UserTag.ud -> userTagId

Tech Details

  • RouteBuilder:130
  • Instread relation.foreignKey
    • relationModel.name+relationModel.primaryKey
    • Example: User.id => userId
    • Example: UserTag.uuid => userTagUuid

Addition: We should check request.params usage in the whole library.

@ozziest ozziest created this issue from a note in v1.0.0 (Backlog) Apr 15, 2023
@ozziest ozziest moved this from Backlog to Weekly in v1.0.0 Apr 15, 2023
@ozziest ozziest added bug Something isn't working version-patch It is just a patch for the current version. It is not a new feature, nor a breaking change. labels Apr 15, 2023
@ozziest ozziest moved this from Weekly to Planned in v1.0.0 Apr 15, 2023
@ozziest ozziest moved this from Planned to Weekly in v1.0.0 Apr 20, 2023
@saracalihan saracalihan mentioned this issue Jul 14, 2023
7 tasks
@ozziest ozziest assigned ozziest and unassigned saracalihan Sep 2, 2023
ozziest added a commit that referenced this issue Sep 2, 2023
@ozziest ozziest mentioned this issue Sep 2, 2023
1 task
@ozziest ozziest moved this from Weekly to Pull Request in v1.0.0 Sep 2, 2023
ozziest added a commit that referenced this issue Sep 2, 2023
@ozziest ozziest mentioned this issue Sep 2, 2023
1 task
@ozziest ozziest moved this from Pull Request to Develop in v1.0.0 Sep 2, 2023
@ozziest ozziest closed this as completed in 08d1ec3 Sep 9, 2023
v1.0.0 automation moved this from Develop to Done! Sep 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working version-patch It is just a patch for the current version. It is not a new feature, nor a breaking change.
Projects
No open projects
v1.0.0
Done!
Development

Successfully merging a pull request may close this issue.

2 participants