14 lines
376 B
TypeScript
14 lines
376 B
TypeScript
import { Book } from "../types/Book";
|
|
import { getBook } from "./getBook";
|
|
|
|
export const findBook = ({
|
|
uuid,
|
|
isbn,
|
|
title,
|
|
}: Pick<Partial<Book>, "uuid" | "title" | "isbn">) => {
|
|
return !!uuid
|
|
? getBook({ uuid })
|
|
: title
|
|
? `SELECT * FROM bookData WHERE title LIKE '%${title.toLowerCase()}%';`
|
|
: `SELECT * FROM bookData WHERE isbn LIKE '%${isbn}%';`;
|
|
};
|