Fix overwriting users column when saving event types (#7445)
* Only overwrite user column when present * Clean uppull/7453/head
parent
a6cd173910
commit
7b1ced914b
|
@ -74,11 +74,33 @@ export const createUsersFixture = (page: Page, workerInfo: WorkerInfo) => {
|
|||
});
|
||||
await prisma.eventType.create({
|
||||
data: {
|
||||
owner: {
|
||||
connect: {
|
||||
id: _user.id,
|
||||
},
|
||||
},
|
||||
users: {
|
||||
connect: {
|
||||
id: _user.id,
|
||||
},
|
||||
},
|
||||
title: "30 mins",
|
||||
slug: "30-mins",
|
||||
length: 30,
|
||||
},
|
||||
});
|
||||
await prisma.eventType.create({
|
||||
data: {
|
||||
users: {
|
||||
connect: {
|
||||
id: _user.id,
|
||||
},
|
||||
},
|
||||
owner: {
|
||||
connect: {
|
||||
id: _user.id,
|
||||
},
|
||||
},
|
||||
title: "Paid",
|
||||
slug: "paid",
|
||||
length: 30,
|
||||
|
@ -92,6 +114,11 @@ export const createUsersFixture = (page: Page, workerInfo: WorkerInfo) => {
|
|||
id: _user.id,
|
||||
},
|
||||
},
|
||||
owner: {
|
||||
connect: {
|
||||
id: _user.id,
|
||||
},
|
||||
},
|
||||
title: "Opt in",
|
||||
slug: "opt-in",
|
||||
requiresConfirmation: true,
|
||||
|
@ -298,13 +325,6 @@ const createUser = async (
|
|||
},
|
||||
}
|
||||
: undefined,
|
||||
eventTypes: {
|
||||
create: {
|
||||
title: "30 min",
|
||||
slug: "30-min",
|
||||
length: 30,
|
||||
},
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
@ -604,7 +604,7 @@ export const eventTypesRouter = router({
|
|||
};
|
||||
}
|
||||
|
||||
if (users) {
|
||||
if (users.length) {
|
||||
data.users = {
|
||||
set: [],
|
||||
connect: users.map((userId: number) => ({ id: userId })),
|
||||
|
|
Loading…
Reference in New Issue