feat: make author clickable

This commit is contained in:
2023-08-12 18:32:56 +02:00
parent d2a02fcf34
commit 2b4173d759
27 changed files with 257 additions and 174 deletions

View File

@@ -1,6 +1,6 @@
import { BadRequestError } from "@lib/errors.ts";
import { resources } from "@lib/resources.ts";
import { ResourceStatus } from "@lib/types.ts";
import { ResourceStatus, SearchResult } from "@lib/types.ts";
import { getTypeSenseClient } from "@lib/typesense.ts";
import { extractHashTags } from "@lib/string.ts";
@@ -11,6 +11,7 @@ type SearchParams = {
type?: ResourceType;
tags?: string[];
status?: ResourceStatus;
author?: string;
query_by?: string;
};
@@ -44,7 +45,7 @@ export function parseResourceUrl(_url: string): SearchParams | undefined {
export async function searchResource(
{ q, query_by = "name,description,author,tags", tags = [], type, status }:
SearchParams,
) {
): Promise<SearchResult> {
const typesenseClient = await getTypeSenseClient();
if (!typesenseClient) {
throw new Error("Query not available");