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