fix fuzzy search result - to be array as well
This commit is contained in:
@ -1,7 +1,12 @@
|
|||||||
NODE_TLS_REJECT_UNAUTHORIZED=0
|
NODE_TLS_REJECT_UNAUTHORIZED=0
|
||||||
# NODE_EXTRA_CA_CERTS=C:\\Users\\popov\\AppData\\Local\\mkcert
|
# NODE_EXTRA_CA_CERTS=C:\\Users\\popov\\AppData\\Local\\mkcert
|
||||||
|
|
||||||
|
NEXT_PUBLIC_PROTOCOL=http
|
||||||
|
NEXT_PUBLIC_HOST=localhost
|
||||||
|
NEXT_PUBLIC_PORT=3003
|
||||||
|
NEXTAUTH_URL=http://localhost:3003
|
||||||
|
|
||||||
SSL_ENABLED=true
|
SSL_ENABLED=true
|
||||||
NEXT_PUBLIC_PORT=3004
|
|
||||||
SSL_KEY=./certificates/localhost-key.pem
|
SSL_KEY=./certificates/localhost-key.pem
|
||||||
SSL_CERT=./certificates/localhost.pem
|
SSL_CERT=./certificates/localhost.pem
|
||||||
|
|
||||||
|
1
.gitignore
vendored
1
.gitignore
vendored
@ -25,3 +25,4 @@ next-cart-app.zip
|
|||||||
!public/uploads/thumb/
|
!public/uploads/thumb/
|
||||||
certificates
|
certificates
|
||||||
content/output/*
|
content/output/*
|
||||||
|
baseUrl.txt
|
||||||
|
16
server.js
16
server.js
@ -79,14 +79,14 @@ app
|
|||||||
}
|
}
|
||||||
next();
|
next();
|
||||||
});
|
});
|
||||||
}
|
if (process.env.SSL_KEY && process.env.SSL_CERT) {
|
||||||
if (process.env.SSL_KEY && process.env.SSL_CERT) {
|
const options = {
|
||||||
const options = {
|
key: fs.readFileSync(process.env.SSL_KEY),
|
||||||
key: fs.readFileSync(process.env.SSL_KEY),
|
cert: fs.readFileSync(process.env.SSL_CERT),
|
||||||
cert: fs.readFileSync(process.env.SSL_CERT),
|
secureProtocol: 'TLSv1_2_method', // Example: Force TLS 1.2
|
||||||
secureProtocol: 'TLSv1_2_method', // Example: Force TLS 1.2
|
};
|
||||||
};
|
https.createServer(options, server).listen(PORT);
|
||||||
https.createServer(options, server).listen(PORT);
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add the middleware to set 'x-forwarded-host' header
|
// Add the middleware to set 'x-forwarded-host' header
|
||||||
|
@ -118,7 +118,7 @@ exports.getPrismaClient = function getPrismaClient() {
|
|||||||
logger.debug("getPrismaClient: process.env.DATABASE_URL = ", process.env.DATABASE_URL);
|
logger.debug("getPrismaClient: process.env.DATABASE_URL = ", process.env.DATABASE_URL);
|
||||||
prisma = new PrismaClient({
|
prisma = new PrismaClient({
|
||||||
// Optional: Enable logging
|
// Optional: Enable logging
|
||||||
// log: ['query', 'info', 'warn', 'error'],
|
log: ['query', 'info', 'warn', 'error'],
|
||||||
datasources: { db: { url: process.env.DATABASE_URL } },
|
datasources: { db: { url: process.env.DATABASE_URL } },
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -66,7 +66,7 @@ async function findPublisher(names, email, select, getAll = false) {
|
|||||||
if (result.length === 0 && names) {
|
if (result.length === 0 && names) {
|
||||||
console.log("No publisher found, trying fuzzy search for '" + names + "'- email: '" + email + "'");
|
console.log("No publisher found, trying fuzzy search for '" + names + "'- email: '" + email + "'");
|
||||||
const publishers = await prisma.publisher.findMany();
|
const publishers = await prisma.publisher.findMany();
|
||||||
result = await common.fuzzySearch(publishers, names, 0.90);
|
result = [await common.fuzzySearch(publishers, names, 0.90)];
|
||||||
console.log("Fuzzy search result: " + result?.firstName + " " + result?.lastName + " - " + result?.email);
|
console.log("Fuzzy search result: " + result?.firstName + " " + result?.lastName + " - " + result?.email);
|
||||||
}
|
}
|
||||||
//always return an array
|
//always return an array
|
||||||
|
Reference in New Issue
Block a user