Website components. Update chart component.

This commit is contained in:
Mike Cao 2020-07-28 01:17:45 -07:00
parent d81ee3932d
commit bdcdcd9d13
9 changed files with 165 additions and 43 deletions

View file

@ -1,13 +1,27 @@
import { PrismaClient } from '@prisma/client';
export const prisma = new PrismaClient({
const options = {
log: [
{
emit: 'event',
level: 'query',
},
],
});
};
let prisma;
if (process.env.NODE_ENV === 'production') {
prisma = new PrismaClient(options);
} else {
if (!global.prisma) {
global.prisma = new PrismaClient(options);
}
prisma = global.prisma;
}
export default prisma;
prisma.on('query', e => {
if (process.env.LOG_QUERY) {