Files
calendar/packages/types/next-auth.d.ts
T
Anik Dhabal BabuandGitHub 3ecc9319c7 fix: Introduce a new prop in the session to extract the profile username when inside an org (#18979)
* fix: flaky test organization.spec

* fix: use profile.username

* update

* update

* update
2025-03-25 09:46:00 +05:30

75 lines
1.9 KiB
TypeScript

import type { User as PrismaUser, UserPermissionRole } from "@prisma/client";
import type { DefaultUser } from "next-auth";
import type { MembershipRole } from "@calcom/prisma/enums";
import type { UserProfile } from "./UserProfile";
declare module "next-auth" {
/**
* Returned by `useSession`, `getSession` and received as a prop on the `Provider` React Context
*/
interface Session {
hasValidLicense: boolean;
profileId?: number | null;
upId: string;
user: User;
}
interface User extends Omit<DefaultUser, "id"> {
id: PrismaUser["id"];
emailVerified?: PrismaUser["emailVerified"];
email_verified?: boolean;
impersonatedBy?: {
id: number;
role: PrismaUser["role"];
};
belongsToActiveTeam?: boolean;
org?: {
id: number;
name?: string;
slug: string;
logoUrl?: string | null;
fullDomain: string;
domainSuffix: string;
role: MembershipRole;
};
username?: PrismaUser["username"];
orgAwareUsername?: PrismaUser["username"];
avatarUrl?: PrismaUser["avatarUrl"];
role?: PrismaUser["role"] | "INACTIVE_ADMIN";
locale?: string | null;
profile?: UserProfile;
}
}
declare module "next-auth/jwt" {
interface JWT {
id?: string | number;
name?: string | null;
username?: string | null;
avatarUrl?: string | null;
email?: string | null;
upId?: string;
profileId?: number | null;
role?: UserPermissionRole | "INACTIVE_ADMIN" | null;
impersonatedBy?: {
id: number;
role: PrismaUser["role"];
};
belongsToActiveTeam?: boolean;
org?: {
id: number;
name?: string;
slug: string;
logoUrl?: string | null;
fullDomain: string;
domainSuffix: string;
role: MembershipRole;
};
orgAwareUsername?: PrismaUser["username"];
organizationId?: number | null;
locale?: string;
}
}