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 {
const result = await knex('guests')
.where(function () {
this.where(
'first_name',
'like',
`%${escape(firstName.trim())}%`
).where('last_name', 'like', `%${escape(lastName.trim())}%`);
})
.where(
knex.raw(
'LOWER("first_name") = ?',
`${escape(firstName.trim()).toLowerCase()}`
)
)
.andWhere(
knex.raw(
'LOWER("last_name") = ?',
`${escape(lastName.trim()).toLowerCase()}`
)
)
.select(
'first_name',
'last_name',

View file

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