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

View File

@ -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;

View File

@ -0,0 +1,3 @@
-- AlterTable
ALTER TABLE "users" ALTER COLUMN "firstName" DROP NOT NULL,
ALTER COLUMN "lastName" DROP NOT NULL;

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();
}

View File

@ -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