fix: availability unlockedFields initialisation for team-managed event types (#25666)
* Fix: availability unlockedFields initialisation for team-managed event types 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]> * chore: init managed event type for local atoms testing * chore: add changeset file * chore: add tests * fix: restore eslint-disable comments in managed-user.ts Addresses review feedback from @anikdhabal to fix the eslint comment issues where comments were accidentally replaced with whitespace. Co-authored-by: gusdudey2k <[email protected]> Co-Authored-By: unknown <> --------- Co-authored-by: Claude Opus 4.5 <[email protected]> Co-authored-by: supalarry <[email protected]> Co-authored-by: Anik Dhabal Babu <[email protected]> Co-authored-by: Rajiv Sahal <[email protected]> Co-authored-by: Ryukemeister <[email protected]> Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
4 files changed
+603
-4
No files matched your search
@@ -130,6 +130,13 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse<
|
||||
managedUserResponseFour.user.id,
|
||||
]);
|
||||
|
||||
await createManagedEventType(+organizationId, team.id, [
|
||||
managedUserResponseOne.user.id,
|
||||
managedUserResponseTwo.user.id,
|
||||
managedUserResponseThree.user.id,
|
||||
managedUserResponseFour.user.id,
|
||||
]);
|
||||
|
||||
await createOrgMembershipAdmin(+organizationId, managedUserResponseFive.user.id);
|
||||
|
||||
return res.status(200).json({
|
||||
@@ -261,6 +268,31 @@ async function createRoundRobinEventType(orgId: number, teamId: number, userIds:
|
||||
);
|
||||
}
|
||||
|
||||
async function createManagedEventType(orgId: number, teamId: number, userIds: number[]) {
|
||||
await fetch(
|
||||
// eslint-disable-next-line turbo/no-undeclared-env-vars
|
||||
`${process.env.NEXT_PUBLIC_CALCOM_API_URL ?? ""}/organizations/${orgId}/teams/${teamId}/event-types`,
|
||||
{
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
// eslint-disable-next-line turbo/no-undeclared-env-vars
|
||||
[X_CAL_SECRET_KEY]: process.env.X_CAL_SECRET_KEY ?? "",
|
||||
// eslint-disable-next-line turbo/no-undeclared-env-vars
|
||||
[X_CAL_CLIENT_ID]: process.env.NEXT_PUBLIC_X_CAL_ID ?? "",
|
||||
origin: "http://localhost:4321",
|
||||
},
|
||||
body: JSON.stringify({
|
||||
lengthInMinutes: 60,
|
||||
title: "Platform example managed",
|
||||
slug: "platform-example-managed",
|
||||
schedulingType: "managed",
|
||||
hosts: userIds.map((userId) => ({ userId })),
|
||||
}),
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
async function createDefaultSchedule(accessToken: string) {
|
||||
const name = "Default Schedule";
|
||||
const timeZone = "Europe/London";
|
||||
@@ -273,7 +305,6 @@ async function createDefaultSchedule(accessToken: string) {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
// eslint-disable-next-line turbo/no-undeclared-env-vars
|
||||
Authorization: `Bearer ${accessToken}`,
|
||||
},
|
||||
body: JSON.stringify({
|
||||
|
||||
Reference in new issue
Block a user