cal/packages/types/next-auth.d.ts
Leo Giovanetti ba4e717b59
chore: unify org data access (#11158)
Co-authored-by: Joe Au-Yeung <65426560+joeauyeung@users.noreply.github.com>
Co-authored-by: Peer Richelsen <peeroke@gmail.com>
Co-authored-by: Omar López <zomars@me.com>
2023-09-07 21:21:04 -03:00

52 lines
1.3 KiB
TypeScript

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