Add transformation to build 64 and lower case search the DB.

This commit is contained in:
Bradley Shellnut 2022-02-01 22:11:07 -08:00
parent 197db9135b
commit c79ad4995f
2 changed files with 15 additions and 8 deletions

View file

@ -26,13 +26,18 @@ export default withSession(async (req, res) => {
try { try {
const result = await knex('guests') const result = await knex('guests')
.where(function () { .where(
this.where( knex.raw(
'first_name', 'LOWER("first_name") = ?',
'like', `${escape(firstName.trim()).toLowerCase()}`
`%${escape(firstName.trim())}%` )
).where('last_name', 'like', `%${escape(lastName.trim())}%`); )
}) .andWhere(
knex.raw(
'LOWER("last_name") = ?',
`${escape(lastName.trim()).toLowerCase()}`
)
)
.select( .select(
'first_name', 'first_name',
'last_name', 'last_name',

View file

@ -4,7 +4,8 @@ import { buildUrl } from 'cloudinary-build-url';
export default async function buildBase64Data( export default async function buildBase64Data(
imageName, imageName,
alt, alt,
additionalProps = {} additionalProps = {},
transformations = {}
) { ) {
const folderName = process.env.PUBLIC_FOLDER_NAME; const folderName = process.env.PUBLIC_FOLDER_NAME;
const cloudName = process.env.PUBLIC_CLOUD_NAME; const cloudName = process.env.PUBLIC_CLOUD_NAME;
@ -15,6 +16,7 @@ export default async function buildBase64Data(
cloud: { cloud: {
cloudName, cloudName,
}, },
transformations,
}); });
} }