Skip to content

Conversation

aryan-khanijo
Copy link

ADD:

  • Objection Model
  • whereNot in getWhere
  • eager Loading in firstWhere and refresh
  • new interface for Sortable Schema

FIX: Database Functions

Upgrade: node ver. 22

…re and refresh,

FIX: Database Functions

Upgrade: node ver. 22
Copy link

@Copilot Copilot AI left a 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

aryan-khanijo and others added 3 commits March 27, 2025 09:51
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@aryan-khanijo aryan-khanijo requested a review from Copilot March 27, 2025 04:37
Copy link

@Copilot Copilot AI left a 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> {

@aryan-khanijo aryan-khanijo requested review from Copilot and removed request for Copilot March 27, 2025 04:40
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.

1 participant