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: update entry services refactoring #190

Closed
wants to merge 7 commits into from

Conversation

davidzlu
Copy link
Collaborator

@davidzlu davidzlu commented Nov 8, 2024

This PR refactors update operations in controllers/entry into separate functions and moves them to a new file /models/services/entry/entry.ts. It also adds unit tests for the update service functions.

This PR also refactors EntryAnalysis.getAnalysisContent and EntryChat.getChatContent by moving them from their model files and into a new service file, /models/services/CdGpt.ts, which will act as the interface with the LLM. Unit tests were moved from the models into a new test file for /models/services/CdGpt.ts.

Moved code for udpating Entry into entry service module.
Refactored Journal check into reusable function in entry controller.
Added unit tests for updateEntry.
Create and update Entry service functions had lots of repeated code, so I
refactored them to share more in common and reduce repetition.
Created new service module for CdGpt and moved entryAnalysis.getAnalysisCompletion
into it. Refactored unit tests and dependencies on entryAnalysis.getAnalysisCompletion
Moved entryConversation.getChatContent into service layer and
refactored code and unit tests depending on it.
@davidzlu davidzlu added refactor Code refactoring test Add or improve testing labels Nov 8, 2024
@davidzlu davidzlu self-assigned this Nov 8, 2024
@davidzlu davidzlu requested a review from hiyaryan November 8, 2024 22:26
@davidzlu davidzlu closed this Nov 12, 2024
@davidzlu
Copy link
Collaborator Author

Will be rebasing this branch onto 139-ts-migration after #187 and #185 merged into it

@davidzlu davidzlu deleted the 139-update-entry-services branch November 12, 2024 20:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
refactor Code refactoring test Add or improve testing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant