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

Snapshots: Do not return internal database ids #77672

Merged
merged 4 commits into from
Nov 6, 2023

Conversation

ryantxu
Copy link
Member

@ryantxu ryantxu commented Nov 4, 2023

The snapshots API currently returns three internal database ids that are not needed or used by clients:

  • id (the internal database id)
  • org_id (it is required from the request user, and externally is irrelevant anyway)
  • user_id (not used, and externally irrelevant)

Limiting usage of internal database ids greatly simplifies any multi-tenant migration efforts. Since they are not required here, lets just remove them. See #77667

@ryantxu ryantxu added add to changelog no-backport Skip backport of PR labels Nov 4, 2023
@ryantxu ryantxu added this to the 10.3.x milestone Nov 4, 2023
@ryantxu ryantxu marked this pull request as ready for review November 4, 2023 16:06
@ryantxu ryantxu requested review from a team as code owners November 4, 2023 16:06
@ryantxu ryantxu requested review from juanicabanas, AgnesToulet, undef1nd, suntala, yangkb09, dprokop and ivanortegaalba and removed request for a team November 4, 2023 16:06
Copy link
Contributor

@juanicabanas juanicabanas left a comment

Choose a reason for hiding this comment

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

LGTM

@@ -29,11 +29,11 @@ type DashboardSnapshot struct {

// DashboardSnapshotDTO without dashboard map
type DashboardSnapshotDTO struct {
ID int64 `json:"id" xorm:"id"`
ID int64 `json:"-" xorm:"id"`
Copy link
Contributor

Choose a reason for hiding this comment

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

The entire purpose of this DashboardSnapshotDTO seems to be returning the search response, we could remove those fields instead of changing the JSON name field

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes -- but i am reluctant to make too big of change without a concrete destination :). With this minimal change, we keep all internal logic the same but do not leak the the database ids over the public api

@ryantxu ryantxu merged commit 5e7f6e8 into main Nov 6, 2023
18 checks passed
@ryantxu ryantxu deleted the hide-dashboard-snapshot-internal-id branch November 6, 2023 14:53
@aangelisc aangelisc modified the milestones: 10.3.x, 10.2.3 Dec 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

None yet

4 participants