Skip to content

Commit

Permalink
extract advancedsearchquery type
Browse files Browse the repository at this point in the history
  • Loading branch information
charmingduchess committed Nov 25, 2024
1 parent fc3f768 commit b14e976
Showing 1 changed file with 10 additions and 24 deletions.
34 changes: 10 additions & 24 deletions src/types/searchTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,27 +30,20 @@ export interface Identifiers {
lccn?: string
}

export interface SearchParams {
export interface SearchParams extends AdvancedSearchQueryParams {
q?: string
field?: string
sortBy?: SortKey
order?: SortOrder
filters?: SearchFilters
contributor?: string
title?: string
journalTitle?: string
standard_number?: string
subject?: string
page?: number
identifiers?: Identifiers
callnumber?: string
}

export type SortKey = "relevance" | "title" | "date"
export type SortOrder = "asc" | "desc"

type SearchFormField = { value: string }

export interface SearchResultsResponse {
results?: SearchResults
aggregations?: AggregationResults
Expand Down Expand Up @@ -88,29 +81,22 @@ export interface SearchFormAction {
payload: SearchParams | SearchFilters | string | string[]
}

/* eslint-disable @typescript-eslint/naming-convention */

export interface SearchQueryParams extends Identifiers {
q?: string
export interface AdvancedSearchQueryParams {
callnumber?: string
standard_number?: string
contributor?: string
title?: string
subject?: string
}

/* eslint-disable @typescript-eslint/naming-convention */

export interface SearchQueryParams
extends Identifiers,
AdvancedSearchQueryParams {
q?: string
sort?: SortKey
sort_direction?: SortOrder
search_scope?: string
page?: string
}

export interface SearchFormEvent {
q?: SearchFormField
search_scope?: SearchFormField
title?: SearchFormField
contributor?: SearchFormField
subject?: SearchFormField
language?: SearchFormField
dateBefore?: SearchFormField
dateAfter?: SearchFormField
materialType?: SearchFormField
}

0 comments on commit b14e976

Please sign in to comment.