Skip to content

Commit

Permalink
feat(interfaces): add IRepoSearchParamsBuilder
Browse files Browse the repository at this point in the history
  • Loading branch information
unicornware committed May 13, 2021
1 parent 959b715 commit c83a43f
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/interfaces/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export type { QSMongoOptions } from './qs-mongo-options.interface'
export type { QueryOperators } from './query-operators.interface'
export type { IRepoDBConnection } from './repo-db-connection.interface'
export type { RepoOptions } from './repo-options.interface'
export type { IRepoSearchParamsBuilder } from './repo-search-params-builder.interface'
export type { RepoValidatorOptions } from './repo-validator-options.interface'
export type { IRepoValidator } from './repo-validator.interface'
export type { IRepository } from './repository.interface'
Expand Down
24 changes: 24 additions & 0 deletions src/interfaces/repo-search-params-builder.interface.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import type { EntityParsedUrlQuery, RepoSearchParams } from '@/types'
import qsm from 'qs-to-mongo'
import type { ParsedOptions } from 'qs-to-mongo/lib/query/options-to-mongo'
import type { IEntity } from './entity.interface'
import type { QSMongoParsedOptions } from './qs-mongo-options-parsed.interface'
import type { QSMongoOptions } from './qs-mongo-options.interface'

/**
* @file Interface - IRepoSearchParamsBuilder
* @module interfaces/RepoSearchParamsBuilder
*/

/**
* `RepoSearchParamsBuilder` interface.
*
* @template E - Entity
*/
export interface IRepoSearchParamsBuilder<E extends IEntity = IEntity> {
readonly builder: typeof qsm
readonly builder_options: QSMongoOptions

options(base: ParsedOptions): QSMongoParsedOptions
params(query?: EntityParsedUrlQuery<E> | string): RepoSearchParams<E>
}

0 comments on commit c83a43f

Please sign in to comment.