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

Email transcript use case #33

Merged
merged 10 commits into from
Nov 30, 2023
Merged

Email transcript use case #33

merged 10 commits into from
Nov 30, 2023

Conversation

lucieyang1
Copy link
Member

@lucieyang1 lucieyang1 commented Nov 27, 2023

Description

  • Gets the messages from the session and formats it into a transcript string
  • Will implement clean architecture and tests later

Fixes # (issue)

  • I changed the timestamp attribute in the Message class to have the time and not the date

Type of change

  • New feature (non-breaking change which adds functionality)

How Has This Been Tested?

Manually tested. Make sure to get the associated front-end branch as well for code review.
image

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code

@lucieyang1 lucieyang1 self-assigned this Nov 27, 2023
@lucieyang1 lucieyang1 changed the title Email Transcript Use Case Email transcript use case Nov 27, 2023
Copy link
Contributor

@zjayee zjayee left a comment

Choose a reason for hiding this comment

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

I ran the code and got the email transcript successfully! Great work!

  • code is clear and easy to follow, style conventions are followed
  • some minor changes in comments
  • can we add a ticket to the project board to add testing


@Document("message")
public class Message {

@Id
private String id;
private String content;
private LocalDate timeStamp;
private LocalTime timeStamp;
Copy link
Contributor

Choose a reason for hiding this comment

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

The java LocalTime class can only store times in the 24 hour period. This means we lose information about the day/month/year of the message. I'm assuming this change is because LocalDate does not support the hour/minute information. A good solution in this case is to use the LocalDateTime class to support both,

Copy link
Member Author

Choose a reason for hiding this comment

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

I didn’t want to have the day/month/year in the transcript, because it was too repetitive, but I can see if I can use LocalDateTime, but still have the transcript only have the time.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I would suggest putting the date at the top of the email, that way it's consistent

@@ -54,6 +51,18 @@ public ResponseEntity<String> joinSession(@PathVariable String code) {
return new ResponseEntity<>(gson.toJson(responseBody), headers, HttpStatus.OK);
}

@GetMapping("/transcript/{code}")
Copy link
Contributor

Choose a reason for hiding this comment

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

Since this is a seperate use case maybe we should move this into its own class to better adhere to Clean Architecture and the single responsibility principle.

@@ -54,6 +51,18 @@ public ResponseEntity<String> joinSession(@PathVariable String code) {
return new ResponseEntity<>(gson.toJson(responseBody), headers, HttpStatus.OK);
}

@GetMapping("/transcript/{code}")
public ResponseEntity<String> getTranscript(@PathVariable String code) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we add documentation here since getTranscript is a public function

Copy link
Collaborator

@sarinali sarinali left a comment

Choose a reason for hiding this comment

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

Good work, very productive and quick. I liked your use of CA knowledge and separating everything into respective files.

Suggestions:

  • Please add error handling/try catch clauses for all endpoints. This makes debugging easier
  • Please write at least 1 test before you merge


@Document("message")
public class Message {

@Id
private String id;
private String content;
private LocalDate timeStamp;
private LocalTime timeStamp;
Copy link
Collaborator

Choose a reason for hiding this comment

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

I would suggest putting the date at the top of the email, that way it's consistent

@GetMapping("/transcript/{code}")
public ResponseEntity<String> getTranscript(@PathVariable String code) {
HttpHeaders headers = new HttpHeaders();
Session session = sessionRepository.getSessionsByActiveAndCode(true, code);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Here you check if the session exists, please add an exception in case an invalid session code was added or an error occurs. See https://github.com/Callhub-Connect/callhub-backend/blob/pdf-session-connection/src/main/java/callhub/connect/controllers/FileController.java if you want an example (at the end of the file)

@lucieyang1 lucieyang1 requested a review from zjayee November 29, 2023 22:33
Copy link
Member

@3milyfz 3milyfz left a comment

Choose a reason for hiding this comment

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

Great job!

  • Tested locally and it works fine
  • Other comments cover code review

@3milyfz 3milyfz requested review from zjayee and removed request for zjayee November 30, 2023 05:33
Copy link
Contributor

@zjayee zjayee left a comment

Choose a reason for hiding this comment

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

LGTM

@lucieyang1
Copy link
Member Author

Will refactor to clean architecture and write tests later :)

@lucieyang1 lucieyang1 merged commit 2193c13 into master Nov 30, 2023
1 check passed
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.

4 participants