Skip to content

Commit

Permalink
refactor: remove client option from db providers
Browse files Browse the repository at this point in the history
  • Loading branch information
thetutlage committed Oct 23, 2023
1 parent 929e6f4 commit 317601f
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 28 deletions.
8 changes: 2 additions & 6 deletions src/core/token_providers/database.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,19 +59,15 @@ export abstract class DatabaseTokenProvider<Token> implements TokenProviderContr
* Returns an instance of the query builder
*/
protected getQueryBuilder() {
return this.options.client
? this.options.client.query<DatabaseTokenRow>()
: this.db.connection(this.options.connection).query<DatabaseTokenRow>()
return this.db.connection(this.options.connection).query<DatabaseTokenRow>()
}

/**
* Returns an instance of the query builder for insert
* queries
*/
protected getInsertQueryBuilder() {
return this.options.client
? this.options.client.insertQuery()
: this.db.connection(this.options.connection).insertQuery()
return this.db.connection(this.options.connection).insertQuery()
}

/**
Expand Down
20 changes: 1 addition & 19 deletions src/core/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import type { QueryClientContract } from '@adonisjs/lucid/types/database'

import type { GuardUser } from './guard_user.js'
import type { PROVIDER_REAL_USER } from '../symbols.js'
import { LucidModel, LucidRow } from '@adonisjs/lucid/types/model'
import type { LucidModel, LucidRow } from '@adonisjs/lucid/types/model'

/**
* A token represents an opaque token issued to a client
Expand Down Expand Up @@ -171,15 +171,6 @@ export type DatabaseUserProviderOptions<RealUser extends Record<string, any>> =
*/
connection?: string

/**
* Optionally define the query client instance to use for making
* database queries.
*
* When both "connection" and "client" are defined, the client will
* be given the preference.
*/
client?: QueryClientContract

/**
* Database table to query to find the user
*/
Expand Down Expand Up @@ -212,15 +203,6 @@ export type DatabaseTokenProviderOptions = {
*/
connection?: string

/**
* Optionally define the query client instance to use for making
* database queries.
*
* When both "connection" and "client" are defined, the client will
* be given the preference.
*/
client?: QueryClientContract

/**
* Database table to query to find the user
*/
Expand Down
4 changes: 1 addition & 3 deletions src/core/user_providers/database.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,7 @@ export abstract class DatabaseUserProvider<RealUser extends Record<string, any>>
* Returns an instance of the query builder
*/
protected getQueryBuilder() {
return this.options.client
? this.options.client.query()
: this.db.connection(this.options.connection).query()
return this.db.connection(this.options.connection).query()
}

/**
Expand Down

0 comments on commit 317601f

Please sign in to comment.