-
Notifications
You must be signed in to change notification settings - Fork 3
FEAT ObjectionModel #5
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?
Conversation
…re and refresh, FIX: Database Functions Upgrade: node ver. 22
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.
Pull Request Overview
This PR introduces several new features and improvements to enhance model querying and repository behavior, including the addition of the ObjectionModel interface, support for a whereNot parameter in getWhere, eager loading in firstWhere and refresh, and various database function fixes.
- Added ObjectionModel interface and updated BaseModel and repositories accordingly.
- Introduced eager loading and whereNot support in query methods.
- Updated transaction and query functions, as well as module imports, to support the changes.
Reviewed Changes
Copilot reviewed 8 out of 9 changed files in this pull request and generated 2 comments.
Show a summary per file
File | Description |
---|---|
lib/baseModel.ts | Added eager loading functionality & refined $load. |
lib/repositories/database.ts | Updated repository methods (firstWhere, getWhere, etc.) for eager loading and whereNot support. |
lib/interfaces.ts | Introduced ObjectionModel interface and updated ModelKeys. |
lib/repositories/contract.ts | Updated contract types to use ObjectionModel. |
lib/queryBuilders/softDelete.ts | Removed unused imports. |
lib/module.ts | Added DiscoveryModule to imports. |
lib/service.ts | Removed unused Logger import. |
Files not reviewed (1)
- package.json: Language not supported
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
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.
Pull Request Overview
This PR introduces the ObjectionModel feature and improves repository methods by refactoring type definitions and adding new options such as eager loading, whereNot conditions, and enhanced update flows. Key changes include:
- Refactoring repository classes and interfaces to use ObjectionModel instead of BaseModel.
- Adding new parameters for eager loading in firstWhere/refresh and whereNot clauses in getWhere.
- Updating query and type handling in repository methods and enhancing relation-loading logic in BaseModel.
Reviewed Changes
Copilot reviewed 7 out of 8 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
lib/service.ts | Removed the unused Logger import to clean up dependency imports. |
lib/repositories/database.ts | Updated repository methods to support new ObjectionModel features and refined behaviors (e.g., eager loading, delete checks, and type changes). |
lib/repositories/contract.ts | Modified interface definitions to align with updated type parameters and method signatures. |
lib/queryBuilders/softDelete.ts | Removed unused imports for cleaner module dependencies. |
lib/interfaces.ts | Updated definitions for ModelKeys and extended SortableSchema properties. |
lib/baseModel.ts | Enhanced the $load method with recursive relation loading and stricter type usage. |
Files not reviewed (1)
- package.json: Language not supported
Comments suppressed due to low confidence (2)
lib/repositories/database.ts:41
- The removal of the forUpdate logic in the all() method changes its behavior; please confirm this change is intentional as it may affect concurrency controls.
return this.query() as unknown as Promise<T[]>;
lib/baseModel.ts:41
- The recursive relation loading logic in the updated $load method is considerably more complex; please ensure that this behavior is thoroughly covered by tests.
async $load(expression: LoadRelSchema, options?: LoadRelOptions): Promise<void> {
ADD:
FIX: Database Functions
Upgrade: node ver. 22