feat: onboarding & profile edition (#507)

* feat: wip onboarding

* fix: generate graphql front

* wip: onboarding

* feat: login/register and edit profile

* fix: unused import

* fix: test

* Use DEBUG_MODE instead of STAGE and mute typescript depth exceed errors

* Fix seeds

* Fix onboarding when coming from google

* Fix

* Fix lint

* Fix ci

* Fix tests

---------

Co-authored-by: Charles Bochet <charles@twenty.com>
This commit is contained in:
Jérémy M
2023-07-07 02:05:15 +02:00
committed by GitHub
parent 0b7a023f3d
commit 1144bd13ed
141 changed files with 2660 additions and 962 deletions
+39 -1
View File
@@ -1,6 +1,14 @@
import { INestApplication, Injectable, OnModuleInit } from '@nestjs/common';
import {
INestApplication,
Injectable,
Logger,
OnModuleInit,
} from '@nestjs/common';
import { PrismaClient } from '@prisma/client';
import { createPrismaQueryEventHandler } from 'prisma-query-log';
import { EnvironmentService } from 'src/integrations/environment/environment.service';
// TODO: Check if this is still needed
if (!global.prisma) {
global.prisma = new PrismaClient();
}
@@ -8,6 +16,36 @@ export default global.prisma;
@Injectable()
export class PrismaService extends PrismaClient implements OnModuleInit {
private readonly logger = new Logger(PrismaService.name);
constructor(private readonly environmentService: EnvironmentService) {
const debugMode = environmentService.getDebugMode();
super({
errorFormat: 'minimal',
log: debugMode
? [
{
level: 'query',
emit: 'event',
},
]
: undefined,
});
if (debugMode) {
const logHandler = createPrismaQueryEventHandler({
logger: (query: string) => {
this.logger.log(query, 'PrismaClient');
},
format: false,
colorQuery: '\u001B[96m',
colorParameter: '\u001B[90m',
});
this.$on('query' as any, logHandler);
}
}
async onModuleInit() {
await this.$connect();
}