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

Feature #46 CAPTURE_DURATION_OF_STAY #202

Closed
wants to merge 13 commits into from
Closed

Feature #46 CAPTURE_DURATION_OF_STAY #202

wants to merge 13 commits into from

Conversation

Giluerre
Copy link

@Giluerre Giluerre commented Oct 23, 2020

🚀 Description

Feature adds

  • HouseHistory entity

  • Two new Endpoints:
    POST: /houses/member/captureStay
    add stay of duration
    GET /houses/{houseId}/houseHistory
    find all records where houseId is same, Query param memberId is optional.

  • New methods in Housecontroller are migrated to openAPI

📄 Motivation and Context

close #46

🧪 How Has This Been Tested?

Feature was tested by sending requests via Postman.

📷 Screenshots (if appropriate)

📦 Types of changes

  • 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)

✅ Checklist

  • My code follows the code style of this project(Do your best to follow code styles. If none apply just skip this).
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.

@codecov
Copy link

codecov bot commented Oct 23, 2020

Codecov Report

Merging #202 (a785a1e) into master (91ff17c) will increase coverage by 0.29%.
The diff coverage is 80.95%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master     #202      +/-   ##
============================================
+ Coverage     69.01%   69.31%   +0.29%     
- Complexity      198      202       +4     
============================================
  Files            32       32              
  Lines           823      844      +21     
  Branches         37       38       +1     
============================================
+ Hits            568      585      +17     
- Misses          244      248       +4     
  Partials         11       11              
Impacted Files Coverage Δ Complexity Δ
...home/services/springdatajpa/HouseSDJpaService.java 77.77% <0.00%> (-7.59%) 11.00 <0.00> (ø)
...n/java/com/myhome/controllers/HouseController.java 98.18% <100.00%> (+0.81%) 14.00 <4.00> (+4.00)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 610a129...a785a1e. Read the comment docs.

@mslowiak mslowiak added the awaiting-review Pull requests is waiting for review label Oct 31, 2020
@jmprathab
Copy link
Owner

@Giluerre Can you please refactor it to use the new endpoints as described in #46 (comment)?

Current implementation is not so RESTFul.

Copy link
Owner

@jmprathab jmprathab left a comment

Choose a reason for hiding this comment

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

Please make the changes as per the newly updated issue description.

@mslowiak mslowiak added awaiting-review-changes Awaiting for PR owner to make changes and removed awaiting-review Pull requests is waiting for review labels Nov 3, 2020
@Giluerre
Copy link
Author

Giluerre commented Nov 6, 2020

@jmprathab Yes, I can. I apologize for the inactivity.

Copy link
Collaborator

@mslowiak mslowiak left a comment

Choose a reason for hiding this comment

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

The whole code needs the correct formatting.
There are many comments, please read them and feel free to raise a new PR with proper code, thanks!

/houses/{houseId}/rentals:
post:
tags:
- house-controller
Copy link
Collaborator

Choose a reason for hiding this comment

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

Rentals

tags:
- house-controller
description: Add the duration of stay to house history.
operationId: captureStay
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can this method be more meaningful?

description: If parameters are invalid
get:
tags:
- house-controller
Copy link
Collaborator

Choose a reason for hiding this comment

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

Rentals

get:
tags:
- house-controller
operationId: getHouseHistory
Copy link
Collaborator

Choose a reason for hiding this comment

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

getHouseHistory?
Maybe it would be better to name it like getRentalHistoryForHouse?

required: false
responses:
'200':
description: "if history is present"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Quotes can be omitted. Start the sentence with uppercase

@OneToOne
@JoinColumn(name = "Id")
private CommunityHouse communityHouse;

Copy link
Collaborator

Choose a reason for hiding this comment

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

blank lines

@Repository
public interface HouseHistoryRepository extends PagingAndSortingRepository<HouseHistory,Long> {

List<HouseHistory> findByHouseId(String houseId);
Copy link
Collaborator

Choose a reason for hiding this comment

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

(1, 'f71ea3a1-fe94-4f73-9d5d-6e830df42c5e', '2020-10-10 10:30', '2020-10-10 11:00', 0, 1);

Copy link
Collaborator

Choose a reason for hiding this comment

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

not needed I guess

@@ -115,4 +121,16 @@ public boolean deleteMemberFromHouse(String houseId, String memberId) {
houseMemberRepository.findAllByCommunityHouse_Community_Admins_UserId(userId, pageable)
);
}

@Override public Optional<List<HouseHistory>> getHouseHistory(String memberId, String houseId) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Put override in new line, please.

@@ -16,6 +19,7 @@
import java.util.UUID;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import javax.rmi.CORBA.Util;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why this import is there?

@mslowiak
Copy link
Collaborator

Closing - too many code issues.
Feel free to raise a new PR with fixed code @Giluerre.

@mslowiak mslowiak closed this Feb 18, 2021
@mslowiak mslowiak removed the awaiting-review-changes Awaiting for PR owner to make changes label Feb 18, 2021
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.

Capture duration of stay for each house member
3 participants