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