-
Notifications
You must be signed in to change notification settings - Fork 655
refactored tryPost #1121
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
base: main
Are you sure you want to change the base?
refactored tryPost #1121
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR does an excellent job of refactoring the tryPost
functionality into a more modular, service-based architecture. The separation of concerns is well-implemented, making the code more maintainable and testable. I've identified a few minor improvements that could enhance the robustness of the implementation.
…re reliable with cloning before saving
This comment was marked as resolved.
This comment was marked as resolved.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good to me
This comment was marked as resolved.
This comment was marked as resolved.
Important PR Review SkippedPR review skipped as per the configuration setting. Run a manually review by commenting /matter review 💡Tips to use Matter AICommand List
|
Important PR Review SkippedPR review skipped as per the configuration setting. Run a manually review by commenting /matter review 💡Tips to use Matter AICommand List
|
return this; | ||
} | ||
|
||
private isComplete(obj: unknown): obj is LogObject { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This feels pretty redundant. We are first doing typeof checks for all the fields and then we are also running zod schema validation. Can we remove this isComplete method?
import { Context } from 'hono'; | ||
import { RequestContext } from './requestContext'; | ||
|
||
export class PreRequestValidatorService { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey, this also feels redundant. preRequestValidator is something that we accept in the context and it can be set in other middleware.
Creating a class which internally is just making a function call is redundant because I cannot think of any scope of extra functionalities that we will be able to abstract in future with this.
import { RequestContext } from './requestContext'; | ||
import { AllHookResults } from '../../middlewares/hooks/types'; | ||
|
||
export class HooksService { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't it better to just add the new methods to the existing class itself? areSyncHooksAvailable, hasResults and hasFailedHooks can be first class citizens instead of this new class taking the decisions.
Important PR Review SkippedPR review skipped as per the configuration setting. Run a manually review by commenting /matter review 💡Tips to use Matter AICommand List
|
Description
Cleaning up handlerUtils in preparation to add more features here.
Type of Change
How Has This Been Tested?
Checklist