feat: add validation for search modal

This commit is contained in:
Sonny
2024-05-25 17:18:33 +02:00
committed by Sonny
parent 56c05f1bf6
commit 09700a1916
12 changed files with 306 additions and 64 deletions

View File

@@ -1,18 +1,18 @@
import type Link from '#models/link';
type SearchResultCommon = {
id: number;
name: string;
matched_part?: string;
rank?: number;
};
export type SearchResult =
| {
id: string;
type: 'collection';
name: string;
matched_part?: string;
rank?: number;
}
| {
id: string;
type: 'link';
name: string;
matched_part?: string;
rank?: number;
collection_id: number;
};
export type SearchResultCollection = SearchResultCommon & {
type: 'collection';
};
export type SearchResultLink = SearchResultCommon & {
type: 'link';
collection_id: number;
url: string;
};
export type SearchResult = SearchResultCollection | SearchResultLink;