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

TRIB-289: Refactors AttributeAPI applyPhraseToUser endpoint and all related services to use a DTO #290

Conversation

mrsbluerose
Copy link
Collaborator

  • Adds AttiributesApplyPhraseToUserDTO
  • Refactors AttributeAPI applyPhraseToUser endpoint to use new DTO
  • Refactors PhraseService applyPhraseToUser to use new DTO
  • Refactors AttributeAPI sendNotification with a third notification type for in review
  • Adds new notification type for in review
  • Updates database with new notification type

Testing:

  • updated tests with new DTO
  • added PhraseService tests for DTO builders (may not be necessary)
  • expected results returned in Postman

- refactors PhraseService.applyPhraseToUser to return AttributesApplyPhraseToUserDTO
- refactors with new return type of AttributesApplyPhraseToUserDTO
- note: fixes logic error for testApplyPhraseToUserWhenPhraseDoesNotExistInToBeReviewed which was incorrectly finding a phrase in toBeReviewed repository
- removes context="test" from changelog-202309050841.xml
- reasoning: these are notification constants
- adds constructAttributesApplyPhraseToUserDTO to PhraseService interface to be used by AttributesAPIController
- refactors AttributesAPIController applyPhraseToUser with AttributesApplyPhraseToUserDTO
- refactors sendNotification with in review notification and AttributesApplyPhraseToUserDTO
- refactors applyPhraseToUser tests with AttributeApplyPhraseToUserDTO
- refactors AttributeApplyPhraseToUserDTO isSuccess field to be true when phrase added to toBeReviewed
- fixes tests to reflect this change
- adds testConstructPhraseDTPFromPhraseInformationWhenPhraseHasAllFourWords and testConstructPhraseDTPFromPhraseInformationWhenPhraseOnlyHasVerbAndNoun
- adds testConstructAttributesApplyPhraseToUserDTO
Copy link

codecov bot commented Oct 3, 2024

Codecov Report

Attention: Patch coverage is 95.00000% with 1 line in your changes missing coverage. Please review.

Project coverage is 82.54%. Comparing base (7047102) to head (87087c5).

Files with missing lines Patch % Lines
.../tribeapp/controllers/AttributesAPIController.java 90.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@                         Coverage Diff                          @@
##             feature/review-attributes-page     #290      +/-   ##
====================================================================
- Coverage                             82.55%   82.54%   -0.01%     
- Complexity                              556      559       +3     
====================================================================
  Files                                    79       80       +1     
  Lines                                  1685     1690       +5     
  Branches                                275      276       +1     
====================================================================
+ Hits                                   1391     1395       +4     
  Misses                                  254      254              
- Partials                                 40       41       +1     

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

@@ -7,6 +7,7 @@
public class NotificationType {

public static final NotificationType ATTRIBUTE_REQUEST_APPROVED = new NotificationType(1L, "Attribute request approved", null);
public static final NotificationType ATTRIBUTE_REQUEST_IN_REVIEW = new NotificationType(1L, "Attribute request in review", null);
Copy link
Contributor

Choose a reason for hiding this comment

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

There was a bug in the previous version.. This ID should be unique, instead of 1L

- refactors PhraseService.applyPhraseToUser to return AttributesApplyPhraseToUserDTO
- refactors with new return type of AttributesApplyPhraseToUserDTO
- note: fixes logic error for testApplyPhraseToUserWhenPhraseDoesNotExistInToBeReviewed which was incorrectly finding a phrase in toBeReviewed repository
- removes context="test" from changelog-202309050841.xml
- reasoning: these are notification constants
- adds constructAttributesApplyPhraseToUserDTO to PhraseService interface to be used by AttributesAPIController
- refactors AttributesAPIController applyPhraseToUser with AttributesApplyPhraseToUserDTO
- refactors sendNotification with in review notification and AttributesApplyPhraseToUserDTO
- refactors applyPhraseToUser tests with AttributeApplyPhraseToUserDTO
- refactors AttributeApplyPhraseToUserDTO isSuccess field to be true when phrase added to toBeReviewed
- fixes tests to reflect this change
- adds testConstructPhraseDTPFromPhraseInformationWhenPhraseHasAllFourWords and testConstructPhraseDTPFromPhraseInformationWhenPhraseOnlyHasVerbAndNoun
- adds testConstructAttributesApplyPhraseToUserDTO
@mrsbluerose mrsbluerose marked this pull request as draft October 4, 2024 00:56
@mrsbluerose mrsbluerose closed this Oct 4, 2024
@mrsbluerose
Copy link
Collaborator Author

closing due to errors on local.

@mrsbluerose mrsbluerose deleted the TRIB-289 branch October 4, 2024 02:08
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.

Have AttributesAPI ApplyPhraseToUser return new DTO with success, error, approved, rejected, in review fields
2 participants