fix: add firstName and lastName to user model (#473)
* fix: add firstname and lastanme to user model * fix: avoid undefined in displayName resolve field * fix: user firstName and lastName instead of firstname lastname * fix: person table proper naming firstName lastName * fix: migrate front with firstName and lastName * fix: make front-graphql-generate not working
This commit is contained in:
@ -0,0 +1,11 @@
|
||||
/*
|
||||
Warnings:
|
||||
|
||||
- Added the required column `firstName` to the `users` table without a default value. This is not possible if the table is not empty.
|
||||
- Added the required column `lastName` to the `users` table without a default value. This is not possible if the table is not empty.
|
||||
|
||||
*/
|
||||
-- AlterTable
|
||||
ALTER TABLE "users" ADD COLUMN "firstName" TEXT NOT NULL DEFAULT '',
|
||||
ADD COLUMN "lastName" TEXT NOT NULL DEFAULT '',
|
||||
ALTER COLUMN "displayName" DROP NOT NULL;
|
||||
@ -0,0 +1,19 @@
|
||||
-- AlterTable
|
||||
ALTER TABLE "people"
|
||||
ADD COLUMN "firstName" TEXT,
|
||||
ADD COLUMN "lastName" TEXT;
|
||||
|
||||
-- Update new columns using old columns
|
||||
UPDATE "people"
|
||||
SET "firstName" = "firstname",
|
||||
"lastName" = "lastname";
|
||||
|
||||
-- Drop old columns
|
||||
ALTER TABLE "people"
|
||||
DROP COLUMN "firstname",
|
||||
DROP COLUMN "lastname";
|
||||
|
||||
-- Make new columns NOT NULL
|
||||
ALTER TABLE "people"
|
||||
ALTER COLUMN "firstName" SET NOT NULL,
|
||||
ALTER COLUMN "lastName" SET NOT NULL;
|
||||
@ -135,8 +135,14 @@ model User {
|
||||
/// @Validator.IsOptional()
|
||||
id String @id @default(uuid())
|
||||
/// @Validator.IsString()
|
||||
firstName String
|
||||
/// @Validator.IsString()
|
||||
lastName String
|
||||
// @deprecated: Use `firstName` and `lastName` instead
|
||||
/// @Validator.IsString()
|
||||
/// @Validator.IsOptional()
|
||||
displayName String
|
||||
/// @TypeGraphQL.omit(input: false, output: true)
|
||||
displayName String?
|
||||
/// @Validator.IsEmail()
|
||||
email String @unique
|
||||
/// @Validator.IsBoolean()
|
||||
@ -266,9 +272,9 @@ model Person {
|
||||
/// @Validator.IsOptional()
|
||||
id String @id @default(uuid())
|
||||
/// @Validator.IsString()
|
||||
firstname String
|
||||
firstName String
|
||||
/// @Validator.IsString()
|
||||
lastname String
|
||||
lastName String
|
||||
/// @Validator.IsEmail()
|
||||
email String
|
||||
/// @Validator.IsPhoneNumber()
|
||||
|
||||
@ -5,8 +5,8 @@ export const seedPeople = async (prisma: PrismaClient) => {
|
||||
update: {},
|
||||
create: {
|
||||
id: 'twenty-86083141-1c0e-494c-a1b6-85b1c6fefaa5',
|
||||
firstname: 'Christoph',
|
||||
lastname: 'Callisto',
|
||||
firstName: 'Christoph',
|
||||
lastName: 'Callisto',
|
||||
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
|
||||
phone: '+33789012345',
|
||||
city: 'Seattle',
|
||||
@ -20,8 +20,8 @@ export const seedPeople = async (prisma: PrismaClient) => {
|
||||
update: {},
|
||||
create: {
|
||||
id: 'twenty-0aa00beb-ac73-4797-824e-87a1f5aea9e0',
|
||||
firstname: 'Sylvie',
|
||||
lastname: 'Palmer',
|
||||
firstName: 'Sylvie',
|
||||
lastName: 'Palmer',
|
||||
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
|
||||
phone: '+33780123456',
|
||||
city: 'Los Angeles',
|
||||
@ -35,8 +35,8 @@ export const seedPeople = async (prisma: PrismaClient) => {
|
||||
update: {},
|
||||
create: {
|
||||
id: 'twenty-93c72d2e-f517-42fd-80ae-14173b3b70ae',
|
||||
firstname: 'Christopher',
|
||||
lastname: 'Gonzalez',
|
||||
firstName: 'Christopher',
|
||||
lastName: 'Gonzalez',
|
||||
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
|
||||
phone: '+33789012345',
|
||||
city: 'Seattle',
|
||||
@ -50,8 +50,8 @@ export const seedPeople = async (prisma: PrismaClient) => {
|
||||
update: {},
|
||||
create: {
|
||||
id: 'twenty-eeeacacf-eee1-4690-ad2c-8619e5b56a2e',
|
||||
firstname: 'Ashley',
|
||||
lastname: 'Parker',
|
||||
firstName: 'Ashley',
|
||||
lastName: 'Parker',
|
||||
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
|
||||
phone: '+33780123456',
|
||||
city: 'Los Angeles',
|
||||
@ -65,8 +65,8 @@ export const seedPeople = async (prisma: PrismaClient) => {
|
||||
update: {},
|
||||
create: {
|
||||
id: 'twenty-9b324a88-6784-4449-afdf-dc62cb8702f2',
|
||||
firstname: 'Nicholas',
|
||||
lastname: 'Wright',
|
||||
firstName: 'Nicholas',
|
||||
lastName: 'Wright',
|
||||
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
|
||||
phone: '+33781234567',
|
||||
city: 'Seattle',
|
||||
@ -80,8 +80,8 @@ export const seedPeople = async (prisma: PrismaClient) => {
|
||||
update: {},
|
||||
create: {
|
||||
id: 'twenty-1d151852-490f-4466-8391-733cfd66a0c8',
|
||||
firstname: 'Isabella',
|
||||
lastname: 'Scott',
|
||||
firstName: 'Isabella',
|
||||
lastName: 'Scott',
|
||||
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
|
||||
phone: '+33782345678',
|
||||
city: 'New York',
|
||||
@ -95,8 +95,8 @@ export const seedPeople = async (prisma: PrismaClient) => {
|
||||
update: {},
|
||||
create: {
|
||||
id: 'twenty-98406e26-80f1-4dff-b570-a74942528de3',
|
||||
firstname: 'Matthew',
|
||||
lastname: 'Green',
|
||||
firstName: 'Matthew',
|
||||
lastName: 'Green',
|
||||
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
|
||||
phone: '+33783456789',
|
||||
city: 'Seattle',
|
||||
@ -110,8 +110,8 @@ export const seedPeople = async (prisma: PrismaClient) => {
|
||||
update: {},
|
||||
create: {
|
||||
id: 'twenty-a2e78a5f-338b-46df-8811-fa08c7d19d35',
|
||||
firstname: 'Elizabeth',
|
||||
lastname: 'Baker',
|
||||
firstName: 'Elizabeth',
|
||||
lastName: 'Baker',
|
||||
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
|
||||
phone: '+33784567890',
|
||||
city: 'New York',
|
||||
@ -125,8 +125,8 @@ export const seedPeople = async (prisma: PrismaClient) => {
|
||||
update: {},
|
||||
create: {
|
||||
id: 'twenty-ca1f5bf3-64ad-4b0e-bbfd-e9fd795b7016',
|
||||
firstname: 'Christopher',
|
||||
lastname: 'Nelson',
|
||||
firstName: 'Christopher',
|
||||
lastName: 'Nelson',
|
||||
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
|
||||
phone: '+33785678901',
|
||||
city: 'San Francisco',
|
||||
@ -140,8 +140,8 @@ export const seedPeople = async (prisma: PrismaClient) => {
|
||||
update: {},
|
||||
create: {
|
||||
id: 'twenty-56955422-5d54-41b7-ba36-f0d20e1417ae',
|
||||
firstname: 'Avery',
|
||||
lastname: 'Carter',
|
||||
firstName: 'Avery',
|
||||
lastName: 'Carter',
|
||||
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
|
||||
phone: '+33786789012',
|
||||
city: 'New York',
|
||||
@ -155,8 +155,8 @@ export const seedPeople = async (prisma: PrismaClient) => {
|
||||
update: {},
|
||||
create: {
|
||||
id: 'twenty-755035db-623d-41fe-92e7-dd45b7c568e1',
|
||||
firstname: 'Ethan',
|
||||
lastname: 'Mitchell',
|
||||
firstName: 'Ethan',
|
||||
lastName: 'Mitchell',
|
||||
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
|
||||
phone: '+33787890123',
|
||||
city: 'Los Angeles',
|
||||
@ -170,8 +170,8 @@ export const seedPeople = async (prisma: PrismaClient) => {
|
||||
update: {},
|
||||
create: {
|
||||
id: 'twenty-240da2ec-2d40-4e49-8df4-9c6a049190ef',
|
||||
firstname: 'Madison',
|
||||
lastname: 'Perez',
|
||||
firstName: 'Madison',
|
||||
lastName: 'Perez',
|
||||
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
|
||||
phone: '+33788901234',
|
||||
city: 'Seattle',
|
||||
@ -185,8 +185,8 @@ export const seedPeople = async (prisma: PrismaClient) => {
|
||||
update: {},
|
||||
create: {
|
||||
id: 'twenty-240da2ec-2d40-4e49-8df4-9c6a049190df',
|
||||
firstname: 'Bertrand',
|
||||
lastname: 'Voulzy',
|
||||
firstName: 'Bertrand',
|
||||
lastName: 'Voulzy',
|
||||
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
|
||||
phone: '+33788901234',
|
||||
city: 'Seattle',
|
||||
@ -200,8 +200,8 @@ export const seedPeople = async (prisma: PrismaClient) => {
|
||||
update: {},
|
||||
create: {
|
||||
id: 'twenty-240da2ec-2d40-4e49-8df4-9c6a049190dg',
|
||||
firstname: 'Louis',
|
||||
lastname: 'Duss',
|
||||
firstName: 'Louis',
|
||||
lastName: 'Duss',
|
||||
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
|
||||
phone: '+33788901234',
|
||||
city: 'Seattle',
|
||||
@ -215,8 +215,8 @@ export const seedPeople = async (prisma: PrismaClient) => {
|
||||
update: {},
|
||||
create: {
|
||||
id: 'twenty-dev-240da2ec-2d40-4e49-8df4-9c6a049190dh',
|
||||
firstname: 'Lorie',
|
||||
lastname: 'Vladim',
|
||||
firstName: 'Lorie',
|
||||
lastName: 'Vladim',
|
||||
workspaceId: 'twenty-dev-7ed9d212-1c25-4d02-bf25-6aeccf7ea420',
|
||||
phone: '+33788901235',
|
||||
city: 'Seattle',
|
||||
|
||||
@ -5,7 +5,8 @@ export const seedUsers = async (prisma: PrismaClient) => {
|
||||
update: {},
|
||||
create: {
|
||||
id: 'twenty-ge256b39-3ec3-4fe3-8997-b76aa0bfc102',
|
||||
displayName: 'Tim Apple',
|
||||
firstName: 'Tim',
|
||||
lastName: 'Apple',
|
||||
email: 'tim@apple.dev',
|
||||
passwordHash:
|
||||
'$2a$10$p2Pqc80JZX6bx/PkZJkC9OA/AasSHM7PMBk7mR3PCM0XSeKwDtwNa', // applecar2025
|
||||
@ -30,7 +31,8 @@ export const seedUsers = async (prisma: PrismaClient) => {
|
||||
update: {},
|
||||
create: {
|
||||
id: 'twenty-ge256b39-3ec3-4fe3-8997-b76aa0bfa408',
|
||||
displayName: 'Jony Ive',
|
||||
firstName: 'Jony',
|
||||
lastName: 'Ive',
|
||||
email: 'jony.ive@apple.dev',
|
||||
locale: 'en',
|
||||
avatarUrl:
|
||||
@ -49,7 +51,8 @@ export const seedUsers = async (prisma: PrismaClient) => {
|
||||
update: {},
|
||||
create: {
|
||||
id: 'twenty-gk256b39-3ec3-4fe3-8997-b76aa0bfa408',
|
||||
displayName: 'Phil Schiler',
|
||||
firstName: 'Phil',
|
||||
lastName: 'Schiler',
|
||||
email: 'phil.schiler@apple.dev',
|
||||
locale: 'en',
|
||||
avatarUrl:
|
||||
@ -68,7 +71,8 @@ export const seedUsers = async (prisma: PrismaClient) => {
|
||||
update: {},
|
||||
create: {
|
||||
id: 'twenty-dev-gk256b39-3ec3-4fe3-8997-b76aa0boa408',
|
||||
displayName: 'Charles Bochet',
|
||||
firstName: 'Charles',
|
||||
lastName: 'Bochet',
|
||||
email: 'charles@twenty.dev',
|
||||
locale: 'en',
|
||||
workspaceMember: {
|
||||
|
||||
Reference in New Issue
Block a user