refactor: Cal.diy (#28903)
* feat: Cal.diy — community-driven MIT-licensed fork of Cal.com This squashed commit contains all Cal.diy changes applied on top of calcom/cal.com main: - Rebrand Cal.com to Cal.diy across the entire codebase - Remove Enterprise Edition (EE) features, license checks, and AGPL restrictions - Switch license from AGPL-3.0 to MIT - Remove docs/ directory (migrated to Nextra at cal.diy) - Remove dead code: org tests, EE tips, platform nav, premium username, SAML/SSO, etc. - Clean up .env.example for self-hosted Cal.diy - Update Docker image references to calcom/cal.diy - Update README, CONTRIBUTING.md, and issue templates for Cal.diy community fork - Add PR welcome bot for Cal.diy contributors - Fix API v2 breaking changes oasdiff ignore entries - Replace Blacksmith CI runners with default GitHub Actions 3893 files changed, 20789 insertions(+), 411020 deletions(-) Co-Authored-By: [email protected] <[email protected]> * refactor: remove org-specific /organizations/:orgId endpoints from API v2 atoms controllers (#1701) Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> * fix: revert Cal.diy Inc to Cal.com, Inc. in license files, copyright notices, and package metadata (#1702) Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> * rip out org related comments in api v2 --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
1 parent
a17f28e9ab
commit
ab21c7f805
4080 files changed
+14403
-404922
No files matched your search
@@ -1,7 +1,6 @@
|
||||
import { enrichHostsWithDelegationCredentials } from "@calcom/app-store/delegationCredential";
|
||||
import getOrgIdFromMemberOrTeamId from "@calcom/lib/getOrgIdFromMemberOrTeamId";
|
||||
import logger from "@calcom/lib/logger";
|
||||
import type { AttributesQueryValue } from "@calcom/lib/raqb/types";
|
||||
import { safeStringify } from "@calcom/lib/safeStringify";
|
||||
import type { RRResetInterval } from "@calcom/prisma/client";
|
||||
import type { RRTimestampBasis } from "@calcom/prisma/enums";
|
||||
@@ -36,37 +35,6 @@ export const getRoutedUsersWithContactOwnerAndFixedUsers = <
|
||||
);
|
||||
};
|
||||
|
||||
async function findMatchingTeamMembersIdsForEventRRSegment(eventType: EventType) {
|
||||
if (!eventType) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const isSegmentationDisabled = !eventType.assignAllTeamMembers || !eventType.assignRRMembersUsingSegment;
|
||||
|
||||
if (isSegmentationDisabled) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!eventType.team || !eventType.team.parentId) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// Dynamic import to avoid loading react-awesome-query-builder at module evaluation time
|
||||
const { findTeamMembersMatchingAttributeLogic } = await import(
|
||||
"@calcom/features/routing-forms/lib/findTeamMembersMatchingAttributeLogic"
|
||||
);
|
||||
|
||||
const { teamMembersMatchingAttributeLogic } = await findTeamMembersMatchingAttributeLogic({
|
||||
attributesQueryValue: eventType.rrSegmentQueryValue ?? null,
|
||||
teamId: eventType.team.id,
|
||||
orgId: eventType.team.parentId,
|
||||
});
|
||||
if (!teamMembersMatchingAttributeLogic) {
|
||||
return teamMembersMatchingAttributeLogic;
|
||||
}
|
||||
return teamMembersMatchingAttributeLogic.map((member) => member.userId);
|
||||
}
|
||||
|
||||
type BaseUser = {
|
||||
id: number;
|
||||
uuid: string;
|
||||
@@ -86,7 +54,7 @@ type BaseHost<User extends BaseUser> = {
|
||||
export type EventType = {
|
||||
assignAllTeamMembers: boolean;
|
||||
assignRRMembersUsingSegment: boolean;
|
||||
rrSegmentQueryValue: AttributesQueryValue | null | undefined;
|
||||
rrSegmentQueryValue: Record<string, unknown> | null | undefined;
|
||||
team: {
|
||||
id: number;
|
||||
parentId: number | null;
|
||||
@@ -131,7 +99,9 @@ export function getNormalizedHosts<User extends BaseUser, Host extends BaseHost<
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
type BaseUserWithCredentialPayload = BaseUser & { credentials: CredentialPayload[] };
|
||||
|
||||
export async function getNormalizedHostsWithDelegationCredentials<
|
||||
User extends BaseUserWithCredentialPayload,
|
||||
Host extends BaseHost<User>,
|
||||
@@ -192,8 +162,7 @@ export async function getNormalizedHostsWithDelegationCredentials<
|
||||
}
|
||||
}
|
||||
|
||||
// We don't allow fixed hosts when segment matching is enabled
|
||||
// If this ever changes, we need to update this function and return fixed hosts
|
||||
// Routing forms feature removed - segment matching always returns all hosts
|
||||
export async function findMatchingHostsWithEventSegment<User extends BaseUser>({
|
||||
eventType,
|
||||
hosts,
|
||||
@@ -208,13 +177,5 @@ export async function findMatchingHostsWithEventSegment<User extends BaseUser>({
|
||||
groupId: string | null;
|
||||
}[];
|
||||
}) {
|
||||
const matchingRRTeamMembers = await findMatchingTeamMembersIdsForEventRRSegment({
|
||||
...eventType,
|
||||
rrSegmentQueryValue: eventType.rrSegmentQueryValue ?? null,
|
||||
});
|
||||
const segmentedRoundRobinHosts = hosts.filter((host) => {
|
||||
if (!matchingRRTeamMembers) return true;
|
||||
return matchingRRTeamMembers.includes(host.user.id);
|
||||
});
|
||||
return segmentedRoundRobinHosts;
|
||||
return hosts;
|
||||
}
|
||||
@@ -1,5 +1,3 @@
|
||||
import { whereClauseForOrgWithSlugOrRequestedSlug } from "@calcom/ee/organizations/lib/orgDomains";
|
||||
import { getParsedTeam } from "@calcom/features/ee/teams/lib/getParsedTeam";
|
||||
import { ProfileRepository } from "@calcom/features/profile/repositories/ProfileRepository";
|
||||
import { getTranslation } from "@calcom/i18n/server";
|
||||
import { DEFAULT_SCHEDULE, getAvailabilityFromSchedule } from "@calcom/lib/availability";
|
||||
@@ -19,6 +17,9 @@ import { userMetadata } from "@calcom/prisma/zod-utils";
|
||||
import type { UpId, UserProfile } from "@calcom/types/UserProfile";
|
||||
import type { z } from "zod";
|
||||
|
||||
const whereClauseForOrgWithSlugOrRequestedSlug = (..._args: unknown[]) => ({});
|
||||
const getParsedTeam = <T>(team: T): T => team;
|
||||
|
||||
export type { UserWithLegacySelectedCalendars } from "@calcom/lib/server/withSelectedCalendars";
|
||||
export { withSelectedCalendars };
|
||||
export type UserAdminTeams = number[];
|
||||
@@ -42,7 +43,6 @@ export type SessionUser = {
|
||||
createdDate: Date;
|
||||
hideBranding: boolean;
|
||||
twoFactorEnabled: boolean;
|
||||
disableImpersonation: boolean;
|
||||
identityProvider: string | null;
|
||||
identityProviderId: string | null;
|
||||
brandColor: string | null;
|
||||
@@ -110,7 +110,6 @@ const userSelect = {
|
||||
receiveMonthlyDigestEmail: true,
|
||||
requiresBookerEmailVerification: true,
|
||||
verified: true,
|
||||
disableImpersonation: true,
|
||||
locked: true,
|
||||
movedToProfileId: true,
|
||||
metadata: true,
|
||||
@@ -719,7 +718,7 @@ export class UserRepository {
|
||||
if (!profileMap.has(profile.userId)) {
|
||||
profileMap.set(profile.userId, []);
|
||||
}
|
||||
profileMap.get(profile.userId)!.push(profile);
|
||||
profileMap.get(profile.userId)?.push(profile);
|
||||
});
|
||||
|
||||
// Precompute personal profiles for all users
|
||||
@@ -1180,7 +1179,6 @@ export class UserRepository {
|
||||
createdDate: true,
|
||||
hideBranding: true,
|
||||
twoFactorEnabled: true,
|
||||
disableImpersonation: true,
|
||||
identityProvider: true,
|
||||
identityProviderId: true,
|
||||
brandColor: true,
|
||||
@@ -1294,13 +1292,6 @@ export class UserRepository {
|
||||
});
|
||||
}
|
||||
|
||||
async updateWhitelistWorkflows({ id, whitelistWorkflows }: { id: number; whitelistWorkflows: boolean }) {
|
||||
return this.prismaClient.user.update({
|
||||
where: { id },
|
||||
data: { whitelistWorkflows },
|
||||
});
|
||||
}
|
||||
|
||||
async findManyUsersForDynamicEventType({
|
||||
currentOrgDomain,
|
||||
usernameList,
|
||||
|
||||
Reference in new issue
Block a user