mirror of
https://github.com/SrIzan10/starters.git
synced 2026-05-01 11:05:16 +00:00
19 lines
466 B
TypeScript
19 lines
466 B
TypeScript
import { DefaultCtx, SessionContext, SimpleRolesIsAuthorized } from "blitz"
|
|
import { User } from "db"
|
|
|
|
// Note: You should switch to Postgres and then use a DB enum for role type
|
|
export type Role = "ADMIN" | "USER"
|
|
|
|
declare module "blitz" {
|
|
export interface Ctx extends DefaultCtx {
|
|
session: SessionContext
|
|
}
|
|
export interface Session {
|
|
isAuthorized: SimpleRolesIsAuthorized<Role>
|
|
PublicData: {
|
|
userId: User["id"]
|
|
role: Role
|
|
}
|
|
}
|
|
}
|