Skip to content

Commit 051cc8d

Browse files
Merge branch 'main' into fix/telegram-app-url
2 parents fd3d365 + 26f8246 commit 051cc8d

File tree

204 files changed

+14843
-4849
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

204 files changed

+14843
-4849
lines changed

.changeset/shaggy-goats-flash.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@calcom/atoms": minor
3+
---
4+
5+
booker atom: allow toggling org and team info when booking round robin

.yarn/versions/96bd4a2c.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
undecided:
2+
- "@calcom/prisma"

apps/api/v2/README.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,15 +42,17 @@ $ yarn prisma generate
4242

4343
Copy `.env.example` to `.env` and fill values.
4444

45-
## Add license Key to deployments table in DB
45+
## Add license Key to Deployment table in DB
4646

47-
id, logo theme licenseKey agreedLicenseAt
48-
1, null, null, 'c4234812-12ab-42s6-a1e3-55bedd4a5bb7', '2023-05-15 21:39:47.611'
47+
id, logo, theme, licenseKey, agreedLicenseAt:-
48+
1, null, null, '00000000-0000-0000-0000-000000000000', '2023-05-15 21:39:47.611'
49+
50+
Replace with your actual license key.
4951

5052
your CALCOM_LICENSE_KEY env var need to contain the same value
5153

5254
.env
53-
CALCOM_LICENSE_KEY=c4234812-12ab-42s6-a1e3-55bedd4a5bb
55+
CALCOM_LICENSE_KEY=00000000-0000-0000-0000-000000000000
5456

5557
## Running the app
5658

apps/api/v2/package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
"@axiomhq/winston": "^1.2.0",
3939
"@calcom/platform-constants": "*",
4040
"@calcom/platform-enums": "*",
41-
"@calcom/platform-libraries": "npm:@calcom/platform-libraries@0.0.288",
41+
"@calcom/platform-libraries": "npm:@calcom/platform-libraries@0.0.291",
4242
"@calcom/platform-types": "*",
4343
"@calcom/platform-utils": "*",
4444
"@calcom/prisma": "*",
@@ -98,6 +98,8 @@
9898
"@types/luxon": "^3.3.7",
9999
"@types/passport-jwt": "^3.0.13",
100100
"@types/supertest": "^2.0.12",
101+
"@typescript-eslint/eslint-plugin": "^6",
102+
"@typescript-eslint/parser": "^6",
101103
"jest": "^29.7.0",
102104
"jest-date-mock": "^1.0.10",
103105
"node-mocks-http": "^1.16.2",

apps/api/v2/src/lib/modules/available-slots.module.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,13 @@ import { PrismaSelectedSlotRepository } from "@/lib/repositories/prisma-selected
88
import { PrismaTeamRepository } from "@/lib/repositories/prisma-team.repository";
99
import { PrismaUserRepository } from "@/lib/repositories/prisma-user.repository";
1010
import { AvailableSlotsService } from "@/lib/services/available-slots.service";
11+
import { BusyTimesService } from "@/lib/services/busy-times.service";
1112
import { CacheService } from "@/lib/services/cache.service";
1213
import { CheckBookingLimitsService } from "@/lib/services/check-booking-limits.service";
14+
import { UserAvailabilityService } from "@/lib/services/user-availability.service";
1315
import { PrismaModule } from "@/modules/prisma/prisma.module";
1416
import { RedisService } from "@/modules/redis/redis.service";
1517
import { Module } from "@nestjs/common";
16-
import { UserAvailabilityService } from "@/lib/services/user-availability.service";
1718

1819
@Module({
1920
imports: [PrismaModule],
@@ -31,7 +32,8 @@ import { UserAvailabilityService } from "@/lib/services/user-availability.servic
3132
CheckBookingLimitsService,
3233
CacheService,
3334
AvailableSlotsService,
34-
UserAvailabilityService
35+
UserAvailabilityService,
36+
BusyTimesService,
3537
],
3638
exports: [AvailableSlotsService],
3739
})

apps/api/v2/src/lib/services/available-slots.service.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { PrismaScheduleRepository } from "@/lib/repositories/prisma-schedule.rep
77
import { PrismaSelectedSlotRepository } from "@/lib/repositories/prisma-selected-slot.repository";
88
import { PrismaTeamRepository } from "@/lib/repositories/prisma-team.repository";
99
import { PrismaUserRepository } from "@/lib/repositories/prisma-user.repository";
10+
import { BusyTimesService } from "@/lib/services/busy-times.service";
1011
import { CacheService } from "@/lib/services/cache.service";
1112
import { CheckBookingLimitsService } from "@/lib/services/check-booking-limits.service";
1213
import { RedisService } from "@/modules/redis/redis.service";
@@ -48,6 +49,7 @@ export class AvailableSlotsService extends BaseAvailableSlotsService {
4849
eventTypeRepository,
4950
redisService
5051
),
52+
busyTimesService: new BusyTimesService(bookingRepository),
5153
});
5254
}
5355
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { PrismaBookingRepository } from "@/lib/repositories/prisma-booking.repository";
2+
import { Injectable } from "@nestjs/common";
3+
4+
import { BusyTimesService as BaseBusyTimesService } from "@calcom/platform-libraries/slots";
5+
6+
@Injectable()
7+
export class BusyTimesService extends BaseBusyTimesService {
8+
constructor(bookingRepository: PrismaBookingRepository) {
9+
super({
10+
bookingRepo: bookingRepository,
11+
});
12+
}
13+
}

apps/api/v2/src/modules/workflows/inputs/workflow-step.input.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ export const SMS_ATTENDEE = "sms_attendee";
1010
export const SMS_NUMBER = "sms_number";
1111
export const WHATSAPP_ATTENDEE = "whatsapp_attendee";
1212
export const WHATSAPP_NUMBER = "whatsapp_number";
13+
export const CAL_AI_PHONE_CALL = "cal_ai_phone_call";
1314

1415
export const STEP_ACTIONS = [
1516
EMAIL_HOST,
@@ -19,6 +20,7 @@ export const STEP_ACTIONS = [
1920
SMS_NUMBER,
2021
WHATSAPP_ATTENDEE,
2122
WHATSAPP_NUMBER,
23+
CAL_AI_PHONE_CALL,
2224
] as const;
2325

2426
export const STEP_ACTIONS_TO_ENUM = {
@@ -29,6 +31,7 @@ export const STEP_ACTIONS_TO_ENUM = {
2931
[WHATSAPP_ATTENDEE]: WorkflowActions.WHATSAPP_ATTENDEE,
3032
[WHATSAPP_NUMBER]: WorkflowActions.WHATSAPP_NUMBER,
3133
[SMS_NUMBER]: WorkflowActions.SMS_NUMBER,
34+
[CAL_AI_PHONE_CALL]: WorkflowActions.CAL_AI_PHONE_CALL,
3235
} as const;
3336

3437
export const ENUM_TO_STEP_ACTIONS = {
@@ -39,6 +42,7 @@ export const ENUM_TO_STEP_ACTIONS = {
3942
[WorkflowActions.WHATSAPP_ATTENDEE]: WHATSAPP_ATTENDEE,
4043
[WorkflowActions.WHATSAPP_NUMBER]: WHATSAPP_NUMBER,
4144
[WorkflowActions.SMS_NUMBER]: SMS_NUMBER,
45+
[WorkflowActions.CAL_AI_PHONE_CALL]: CAL_AI_PHONE_CALL,
4246
} as const;
4347

4448
export type StepAction = (typeof STEP_ACTIONS)[number];
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"use server";
22

3-
import { revalidateTag } from "next/cache";
3+
import { revalidatePath } from "next/cache";
44

5-
export async function revalidateWebhooksListGetByViewer() {
6-
revalidateTag("viewer.webhook.getByViewer");
5+
export async function revalidateWebhooksList() {
6+
revalidatePath("/settings/developer/webhooks");
77
}

apps/web/app/(use-page-wrapper)/settings/(settings-layout)/developer/webhooks/(with-loader)/page.tsx

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1+
import { createRouterCaller } from "app/_trpc/context";
12
import { _generateMetadata } from "app/_utils";
2-
import { unstable_cache } from "next/cache";
33
import { cookies, headers } from "next/headers";
44
import { redirect } from "next/navigation";
55

66
import { getServerSession } from "@calcom/features/auth/lib/getServerSession";
77
import WebhooksView from "@calcom/features/webhooks/pages/webhooks-view";
88
import { APP_NAME } from "@calcom/lib/constants";
9-
import { WebhookRepository } from "@calcom/lib/server/repository/webhook";
109
import { UserPermissionRole } from "@calcom/prisma/enums";
10+
import { webhookRouter } from "@calcom/trpc/server/routers/viewer/webhook/_router";
1111

1212
import { buildLegacyRequest } from "@lib/buildLegacyCtx";
1313

@@ -20,27 +20,15 @@ export const generateMetadata = async () =>
2020
"/settings/developer/webhooks"
2121
);
2222

23-
const getCachedWebhooksList = unstable_cache(
24-
async ({ userId, userRole }: { userId: number; userRole?: UserPermissionRole }) => {
25-
return await WebhookRepository.getAllWebhooksByUserId({
26-
userId,
27-
userRole,
28-
});
29-
},
30-
undefined,
31-
{ revalidate: 3600, tags: ["viewer.webhook.getByViewer"] }
32-
);
33-
3423
const WebhooksViewServerWrapper = async () => {
3524
const session = await getServerSession({ req: buildLegacyRequest(await headers(), await cookies()) });
3625
if (!session?.user?.id) {
3726
redirect("/auth/login");
3827
}
3928

4029
const isAdmin = session.user.role === UserPermissionRole.ADMIN;
41-
const userRole = session.user.role !== "INACTIVE_ADMIN" ? session.user.role : undefined;
42-
43-
const data = await getCachedWebhooksList({ userId: session.user.id, userRole });
30+
const caller = await createRouterCaller(webhookRouter);
31+
const data = await caller.getByViewer();
4432

4533
return <WebhooksView data={data} isAdmin={isAdmin} />;
4634
};

0 commit comments

Comments
 (0)