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

AS-3208 - error codes endpoints with tokenID #419

Open
wants to merge 13 commits into
base: main
Choose a base branch
from

Conversation

mateuszpohl
Copy link

@mateuszpohl mateuszpohl commented Dec 10, 2024

Proposed Changes

  • user_device_token_id in error_code_queries (migration, model changes)
  • new /error-codes/* endpoints using tokenID instead of userDeviceID
  • /clear endpoint status codes aligned with the spec (404/429)
  • unit tests, new helper

Note

For now this new field is nullable, since we still may have some devices without a tokenID. Making it not-nullable also breaks other parts (e.g. old version, that we will remove in the future) and older unit tests.

Copy link

linear bot commented Dec 10, 2024

@mateuszpohl mateuszpohl marked this pull request as ready for review December 10, 2024 16:07
@mateuszpohl mateuszpohl changed the title [WIP] AS-3208 - error codes endpoints with tokenID AS-3208 - error codes endpoints with tokenID Dec 10, 2024
@JamesReate
Copy link
Member

Ah the user_device_token_id we are normally calling vehicle_token_id. I know may be pain to change but probably good for consistency...

@mateuszpohl
Copy link
Author

Ah the user_device_token_id we are normally calling vehicle_token_id. I know may be pain to change but probably good for consistency...

changed

// @Failure 404 {object} helpers.ErrorRes "Vehicle not found"
// @Security BearerAuth
// @Router /user/vehicle/{tokenID}/error-codes [post]
func (udc *UserDevicesController) QueryDeviceErrorCodesByTokenID(c *fiber.Ctx) error {
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this the same function as QueryDeviceErrorCodes other than the ud lookup? If so we can just use a function instead of duplicating the code.

Copy link
Author

Choose a reason for hiding this comment

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

These are new ones using vehicle tokenID instead of legacy device ID, the old ones will be removed in future releases, we'll also drop the user_device_id column from error_code_queries table at that point.

Copy link
Contributor

Choose a reason for hiding this comment

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

Let's mark those as deprecated then

Copy link
Author

Choose a reason for hiding this comment

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

Added deprecation info

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 this pull request may close these issues.

3 participants