Chore: Duplicate certain user fields to workspaceMember (#1514)

* Move certain user fields to workspaceMember

Co-authored-by: v1b3m <vibenjamin6@gmail.com>
Co-authored-by: chiazokam <chiazokamecheta@gmail.com>

* Merge main

Co-authored-by: v1b3m <vibenjamin6@gmail.com>
Co-authored-by: chiazokam <chiazokamecheta@gmail.com>

* Refactor according to review

Co-authored-by: v1b3m <vibenjamin6@gmail.com>
Co-authored-by: chiazokam <chiazokamecheta@gmail.com>

* Refactor according to review

Co-authored-by: v1b3m <vibenjamin6@gmail.com>
Co-authored-by: chiazokam <chiazokamecheta@gmail.com>

* Refactor according to review

Co-authored-by: v1b3m <vibenjamin6@gmail.com>
Co-authored-by: chiazokam <chiazokamecheta@gmail.com>

* Update the generated GraphQL

Co-authored-by: v1b3m <vibenjamin6@gmail.com>
Co-authored-by: chiazokam <chiazokamecheta@gmail.com>

* Update hooks

Co-authored-by: v1b3m <vibenjamin6@gmail.com>
Co-authored-by: chiazokam <chiazokamecheta@gmail.com>

* Refactor according to review

Co-authored-by: v1b3m <vibenjamin6@gmail.com>
Co-authored-by: chiazokam <chiazokamecheta@gmail.com>

* Refactor according to review

Co-authored-by: v1b3m <vibenjamin6@gmail.com>
Co-authored-by: chiazokam <chiazokamecheta@gmail.com>

* Refactor according to review

Co-authored-by: v1b3m <vibenjamin6@gmail.com>
Co-authored-by: chiazokam <chiazokamecheta@gmail.com>

* Refactor according to review

Co-authored-by: v1b3m <vibenjamin6@gmail.com>
Co-authored-by: chiazokam <chiazokamecheta@gmail.com>

* Refactor according to review

Co-authored-by: v1b3m <vibenjamin6@gmail.com>
Co-authored-by: chiazokam <chiazokamecheta@gmail.com>

* Rework typing

* Fix tests

* Remove console logs

---------

Co-authored-by: v1b3m <vibenjamin6@gmail.com>
Co-authored-by: chiazokam <chiazokamecheta@gmail.com>
Co-authored-by: Charles Bochet <charles@twenty.com>
This commit is contained in:
gitstart-twenty
2023-09-16 01:32:58 +01:00
committed by GitHub
parent 0a7a0ac6cb
commit 549335054a
23 changed files with 890 additions and 115 deletions

View File

@ -1,5 +1,13 @@
import { PrismaClient } from '@prisma/client';
export const seedUsers = async (prisma: PrismaClient) => {
await prisma.userSettings.upsert({
where: { id: 'twenty-ge256b39-3ec3-4fe3-8997-9dcb1084c109' },
update: {},
create: {
id: 'twenty-ge256b39-3ec3-4fe3-8997-9dcb1084c109',
locale: 'en',
},
});
await prisma.user.upsert({
where: { id: 'twenty-ge256b39-3ec3-4fe3-8997-b76aa0bfc102' },
update: {},
@ -11,11 +19,7 @@ export const seedUsers = async (prisma: PrismaClient) => {
locale: 'en',
passwordHash:
'$2b$10$66d.6DuQExxnrfI9rMqOg.U1XIYpagr6Lv05uoWLYbYmtK0HDIvS6', // Applecar2025
settings: {
create: {
locale: 'en',
},
},
settingsId: 'twenty-ge256b39-3ec3-4fe3-8997-9dcb1084c109',
avatarUrl: null,
workspaceMember: {
connectOrCreate: {
@ -24,12 +28,21 @@ export const seedUsers = async (prisma: PrismaClient) => {
},
create: {
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
settingsId: 'twenty-ge256b39-3ec3-4fe3-8997-9dcb1084c109',
},
},
},
},
});
await prisma.userSettings.upsert({
where: { id: 'twenty-ge256b39-3ec3-4fe3-8997-2c4a2035a215' },
update: {},
create: {
id: 'twenty-ge256b39-3ec3-4fe3-8997-2c4a2035a215',
locale: 'en',
},
});
await prisma.user.upsert({
where: { id: 'twenty-ge256b39-3ec3-4fe3-8997-b76aa0bfa408' },
update: {},
@ -39,21 +52,26 @@ export const seedUsers = async (prisma: PrismaClient) => {
lastName: 'Ive',
email: 'jony.ive@apple.dev',
locale: 'en',
settings: {
create: {
locale: 'en',
},
},
settingsId: 'twenty-ge256b39-3ec3-4fe3-8997-2c4a2035a215',
avatarUrl: null,
workspaceMember: {
create: {
id: 'twenty-7ef9d213-1c25-4d02-bf35-6aeccf7ea419',
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
settingsId: 'twenty-ge256b39-3ec3-4fe3-8997-2c4a2035a215',
},
},
},
});
await prisma.userSettings.upsert({
where: { id: 'twenty-ge256b39-3ec3-4fe3-8997-8e1f2097b328' },
update: {},
create: {
id: 'twenty-ge256b39-3ec3-4fe3-8997-8e1f2097b328',
locale: 'en',
},
});
await prisma.user.upsert({
where: { id: 'twenty-gk256b39-3ec3-4fe3-8997-b76aa0bfa408' },
update: {},
@ -63,21 +81,26 @@ export const seedUsers = async (prisma: PrismaClient) => {
lastName: 'Schiler',
email: 'phil.schiler@apple.dev',
locale: 'en',
settings: {
create: {
locale: 'en',
},
},
settingsId: 'twenty-ge256b39-3ec3-4fe3-8997-8e1f2097b328',
avatarUrl: null,
workspaceMember: {
create: {
id: 'twenty-7ed9d213-1c25-4d02-bf35-6aeccf7ea419',
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
settingsId: 'twenty-ge256b39-3ec3-4fe3-8997-8e1f2097b328',
},
},
},
});
await prisma.userSettings.upsert({
where: { id: 'twenty-ge256b39-3ec3-4fe3-8997-5e2d1049c430' },
update: {},
create: {
id: 'twenty-ge256b39-3ec3-4fe3-8997-5e2d1049c430',
locale: 'en',
},
});
await prisma.user.upsert({
where: { id: 'twenty-dev-gk256b39-3ec3-4fe3-8997-b76aa0boa408' },
update: {},
@ -87,15 +110,12 @@ export const seedUsers = async (prisma: PrismaClient) => {
lastName: 'Bochet',
email: 'charles@twenty.dev',
locale: 'en',
settings: {
create: {
locale: 'en',
},
},
settingsId: 'twenty-ge256b39-3ec3-4fe3-8997-5e2d1049c430',
workspaceMember: {
create: {
id: 'twenty-dev-7ed9d213-1c25-4d02-bf35-6aeccf7oa419',
workspaceId: 'twenty-dev-7ed9d212-1c25-4d02-bf25-6aeccf7ea420',
settingsId: 'twenty-ge256b39-3ec3-4fe3-8997-5e2d1049c430',
},
},
},