Skip to content

Query history store renaming#2308

Merged
charisk merged 9 commits intomainfrom
charisk/query-history-store-naming
Apr 13, 2023
Merged

Query history store renaming#2308
charisk merged 9 commits intomainfrom
charisk/query-history-store-naming

Conversation

@charisk
Copy link
Copy Markdown
Contributor

@charisk charisk commented Apr 13, 2023

Reviewed names used in the query history store, models (data/domain) and mappers, and updated them to match conventions agreed.

  • Renamed data types to be referred to as DTOs.
  • Renamed mapping functions to use the DTO term but also to follow the same naming patterns.
  • Renamed files to include query-history e.g. query-history-domain-mapper.
  • Moved ALLOWED_QUERY_HISTORY_VERSIONS to store.
  • Introduced an index file for the query history store.
  • Tidied up code comments.

This PR looks fairly big but the changes are pretty small and straight forward. Please review commit by commit to see the differences.

Checklist

N/A:

  • CHANGELOG.md has been updated to incorporate all user visible changes made by this pull request.
  • Issues have been created for any UI or other user-facing changes made by this pull request.
  • [Maintainers only] If this pull request makes user-facing changes that require documentation changes, open a corresponding docs pull request in the github/codeql repo and add the ready-for-doc-review label there.

@charisk charisk added the secexp label Apr 13, 2023
@charisk charisk requested a review from robertbrignull April 13, 2023 07:46
@charisk charisk requested a review from a team as a code owner April 13, 2023 07:46
Copy link
Copy Markdown
Contributor

@robertbrignull robertbrignull left a comment

Choose a reason for hiding this comment

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

LGTM but I have one question where I'm confused about the code diff and commit message.

function mapCompletedQueryInfoDataToDomainModel(
completedQuery: CompletedQueryInfoDto,
): CompletedQueryInfo {
const sortState =
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Not that this mapper looks wrong, but why does renaming the SortDirectionDto type mean we now have to provide a mapper? The type itself hasn't changed but just its name. It doesn't seem like we were accidentally using a DTO type where we shouldn't have been, or accidentally referencing a domain type from the DTO type.

Is this some crazy enum magic, where you can cast them to each other if they are defined in separate files but have the same name?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Ah yeah sorry I meant to link to microsoft/TypeScript#35138. It seems like before it just happened to work because of the quirk described in that issue.

@charisk charisk merged commit 7308984 into main Apr 13, 2023
@charisk charisk deleted the charisk/query-history-store-naming branch April 13, 2023 11:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants