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

refactor: Change table names, replace native queries with a non-native #537

Merged
merged 2 commits into from
Jun 19, 2024

Conversation

o-kopysov
Copy link
Collaborator

Pull Request

Description

PR contains the next changes:

  • renamed tables (added "lpvs_" prefix)
  • native queries replaced with non-native queries (to avoid modification of queries in case of tables renaming)
  • unit tests updated
  • documentation update (fixed names of tables)

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Code cleanup/refactoring
  • Documentation update
  • This change requires a documentation update
  • CI system update
  • Test Coverage update

Testing

Verified on PR: https://github.sec.samsung.net/SOSHUB/LPVS-test/pull/1543#issuecomment-2729707

Checklist:

  • My code follows the style guidelines of this project
  • My code meets the required code coverage for lines (90% and above)
  • My code meets the required code coverage for branches (80% and above)
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

Signed-off-by: Oleg Kopysov <o.kopysov@samsung.com>
@o-kopysov o-kopysov added the enhancement New feature or request label Jun 17, 2024
@o-kopysov o-kopysov added this to the v1.5.2 milestone Jun 17, 2024
@o-kopysov o-kopysov self-assigned this Jun 17, 2024
@codecov-commenter
Copy link

Codecov Report

Attention: Patch coverage is 66.66667% with 2 lines in your changes missing coverage. Please review.

Project coverage is 92.54%. Comparing base (e989b32) to head (ef280cc).

Files Patch % Lines
...main/java/com/lpvs/service/LPVSLicenseService.java 0.00% 0 Missing and 1 partial ⚠️
src/main/java/com/lpvs/util/LPVSPayloadUtil.java 80.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main     #537      +/-   ##
============================================
- Coverage     92.61%   92.54%   -0.07%     
- Complexity      528      529       +1     
============================================
  Files            48       48              
  Lines          1733     1731       -2     
  Branches        208      208              
============================================
- Hits           1605     1602       -3     
  Misses           64       64              
- Partials         64       65       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

tiokim
tiokim previously approved these changes Jun 18, 2024
Copy link
Member

@tiokim tiokim left a comment

Choose a reason for hiding this comment

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

LGTM! Thank you so much for your contribution!

src/main/java/com/lpvs/util/LPVSPayloadUtil.java Outdated Show resolved Hide resolved
Signed-off-by: Oleg Kopysov <o.kopysov@samsung.com>
value =
"SELECT * FROM license_list WHERE license_list.license_spdx = :spdxId ORDER BY id DESC LIMIT 1",
nativeQuery = true)
@Query("SELECT l FROM LPVSLicense l WHERE l.spdxId = :spdxId ORDER BY l.id DESC LIMIT 1")
Copy link
Collaborator

Choose a reason for hiding this comment

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

as an option to simplify more, Repository Method Definition can be used:

eg: findTopBySpdxIdOrderByIdDesc

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We will plan such refactoring in the future. Thanks for the suggestion.

@@ -39,8 +39,8 @@ void setUp() {
pullRequestUrl,
pullRequestFilesUrl,
status,
pullRequestBase,
Copy link
Collaborator

Choose a reason for hiding this comment

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

I didn't get this change...

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Incorrect order of parameters.

Copy link
Collaborator

@m-rudyk m-rudyk left a comment

Choose a reason for hiding this comment

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

Approved, no objections.

Copy link
Collaborator

@t-naumenko t-naumenko left a comment

Choose a reason for hiding this comment

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

LGTM

@o-kopysov o-kopysov merged commit 4cd4cac into main Jun 19, 2024
10 checks passed
@o-kopysov o-kopysov deleted the update-tables branch June 19, 2024 05:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants