Files
outline/server/routes/api/searches/schema.ts
Tom Moor cf64da1050 Add score column to search_queries (#6253)
* Add score column to search_queries

* Allow user to record search score
2023-12-06 05:37:46 -08:00

24 lines
665 B
TypeScript

import isEmpty from "lodash/isEmpty";
import { z } from "zod";
import BaseSchema from "../BaseSchema";
export const SearchesDeleteSchema = BaseSchema.extend({
body: z.object({
id: z.string().uuid().optional(),
query: z.string().optional(),
}),
}).refine((req) => !(isEmpty(req.body.id) && isEmpty(req.body.query)), {
message: "id or query is required",
});
export type SearchesDeleteReq = z.infer<typeof SearchesDeleteSchema>;
export const SearchesUpdateSchema = BaseSchema.extend({
body: z.object({
id: z.string().uuid(),
score: z.number().min(-1).max(1),
}),
});
export type SearchesUpdateReq = z.infer<typeof SearchesUpdateSchema>;