mirror of
https://github.com/Myxelium/Bridge-Multi.git
synced 2026-07-07 10:35:09 +00:00
Add api source
This commit is contained in:
@@ -205,6 +205,7 @@ export class SearchBarComponent implements OnInit, AfterViewInit {
|
|||||||
this.searchService.advancedSearch({
|
this.searchService.advancedSearch({
|
||||||
instrument: this.instrument,
|
instrument: this.instrument,
|
||||||
difficulty: this.difficulty,
|
difficulty: this.difficulty,
|
||||||
|
source: 'bridge' as const,
|
||||||
...this.advancedSearchForm.getRawValue(),
|
...this.advancedSearchForm.getRawValue(),
|
||||||
}).subscribe()
|
}).subscribe()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -86,6 +86,7 @@ export class SearchService {
|
|||||||
page: this.currentPage,
|
page: this.currentPage,
|
||||||
instrument: this.instrument.value,
|
instrument: this.instrument.value,
|
||||||
difficulty: this.difficulty.value,
|
difficulty: this.difficulty.value,
|
||||||
|
source: 'bridge',
|
||||||
}).pipe(
|
}).pipe(
|
||||||
catchError((err, caught) => {
|
catchError((err, caught) => {
|
||||||
if (err.status === 400 || retries-- <= 0) {
|
if (err.status === 400 || retries-- <= 0) {
|
||||||
|
|||||||
@@ -3,11 +3,14 @@ import { z } from 'zod'
|
|||||||
|
|
||||||
import { difficulties, instruments, Overwrite } from '../UtilFunctions'
|
import { difficulties, instruments, Overwrite } from '../UtilFunctions'
|
||||||
|
|
||||||
|
export const sources = ['website', 'bridge'] as const
|
||||||
|
|
||||||
export const GeneralSearchSchema = z.object({
|
export const GeneralSearchSchema = z.object({
|
||||||
search: z.string(),
|
search: z.string(),
|
||||||
page: z.number().positive(),
|
page: z.number().positive(),
|
||||||
instrument: z.enum(instruments).nullable(),
|
instrument: z.enum(instruments).nullable(),
|
||||||
difficulty: z.enum(difficulties).nullable(),
|
difficulty: z.enum(difficulties).nullable(),
|
||||||
|
source: z.enum(sources).optional(),
|
||||||
})
|
})
|
||||||
export type GeneralSearch = z.infer<typeof GeneralSearchSchema>
|
export type GeneralSearch = z.infer<typeof GeneralSearchSchema>
|
||||||
|
|
||||||
@@ -22,6 +25,7 @@ export const AdvancedSearchSchema = z.object({
|
|||||||
return true
|
return true
|
||||||
}, { message: 'Invalid instrument list' }).nullable(),
|
}, { message: 'Invalid instrument list' }).nullable(),
|
||||||
difficulty: z.enum(difficulties).nullable(),
|
difficulty: z.enum(difficulties).nullable(),
|
||||||
|
source: z.enum(sources).optional(),
|
||||||
name: z.object({ value: z.string(), exact: z.boolean(), exclude: z.boolean() }),
|
name: z.object({ value: z.string(), exact: z.boolean(), exclude: z.boolean() }),
|
||||||
artist: z.object({ value: z.string(), exact: z.boolean(), exclude: z.boolean() }),
|
artist: z.object({ value: z.string(), exact: z.boolean(), exclude: z.boolean() }),
|
||||||
album: z.object({ value: z.string(), exact: z.boolean(), exclude: z.boolean() }),
|
album: z.object({ value: z.string(), exact: z.boolean(), exclude: z.boolean() }),
|
||||||
|
|||||||
Reference in New Issue
Block a user