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:
@ -0,0 +1,6 @@
|
||||
-- DropIndex
|
||||
DROP INDEX "workspaces_domainName_key";
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE "workspaces" ALTER COLUMN "domainName" DROP NOT NULL,
|
||||
ALTER COLUMN "displayName" DROP NOT NULL;
|
||||
@ -0,0 +1,3 @@
|
||||
-- AlterTable
|
||||
ALTER TABLE "users" ALTER COLUMN "firstName" DROP NOT NULL,
|
||||
ALTER COLUMN "lastName" DROP NOT NULL;
|
||||
@ -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();
|
||||
}
|
||||
|
||||
@ -135,9 +135,11 @@ model User {
|
||||
/// @Validator.IsOptional()
|
||||
id String @id @default(uuid())
|
||||
/// @Validator.IsString()
|
||||
firstName String
|
||||
/// @Validator.IsOptional()
|
||||
firstName String?
|
||||
/// @Validator.IsString()
|
||||
lastName String
|
||||
/// @Validator.IsOptional()
|
||||
lastName String?
|
||||
/// @Validator.IsEmail()
|
||||
email String @unique
|
||||
/// @Validator.IsBoolean()
|
||||
@ -185,9 +187,11 @@ model Workspace {
|
||||
/// @Validator.IsOptional()
|
||||
id String @id @default(uuid())
|
||||
/// @Validator.IsString()
|
||||
domainName String @unique
|
||||
/// @Validator.IsOptional()
|
||||
domainName String?
|
||||
/// @Validator.IsString()
|
||||
displayName String
|
||||
/// @Validator.IsOptional()
|
||||
displayName String?
|
||||
/// @Validator.IsString()
|
||||
/// @Validator.IsOptional()
|
||||
logo String?
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user