2021-07-31 15:57:43 +00:00
|
|
|
import { DefaultCtx, SessionContext, SimpleRolesIsAuthorized } from "blitz";
|
2021-07-31 14:33:18 +00:00
|
|
|
|
2021-08-05 17:07:15 +00:00
|
|
|
import { Organization, User, GlobalRole, MembershipRole } from "./db";
|
|
|
|
|
|
|
|
type Role = GlobalRole | MembershipRole;
|
2021-07-31 14:33:18 +00:00
|
|
|
|
|
|
|
declare module "blitz" {
|
|
|
|
export interface Ctx extends DefaultCtx {
|
2021-07-31 15:57:43 +00:00
|
|
|
session: SessionContext;
|
2021-07-31 14:33:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
export interface Session {
|
2021-07-31 15:57:43 +00:00
|
|
|
isAuthorized: SimpleRolesIsAuthorized<Role>;
|
2021-07-31 14:33:18 +00:00
|
|
|
PublicData: {
|
2021-07-31 15:57:43 +00:00
|
|
|
userId: User["id"];
|
2021-08-05 17:07:15 +00:00
|
|
|
roles: Role[];
|
|
|
|
orgId: Organization["id"];
|
2021-08-01 14:01:51 +00:00
|
|
|
hasCompletedOnboarding?: true;
|
2021-07-31 15:57:43 +00:00
|
|
|
};
|
2021-07-31 14:33:18 +00:00
|
|
|
}
|
|
|
|
}
|