feat(api): Add permissions to every route and permission config

This commit is contained in:
Jesse Wierzbinski 2024-06-07 18:57:29 -10:00
parent 19823d8eca
commit 4902f078a8
No known key found for this signature in database
79 changed files with 729 additions and 251 deletions

View file

@ -1,6 +1,7 @@
import type { Hono } from "hono";
import type { RouterRoute } from "hono/types";
import type { z } from "zod";
import type { RolePermissions } from "~/drizzle/schema";
export type HttpVerb = "GET" | "POST" | "PUT" | "DELETE" | "PATCH" | "OPTIONS";
export interface APIRouteMetadata {
@ -15,6 +16,12 @@ export interface APIRouteMetadata {
requiredOnMethods?: HttpVerb[];
oauthPermissions?: string[];
};
permissions?: {
required: RolePermissions[];
methodOverrides?: {
[key in HttpVerb]?: RolePermissions[];
};
};
}
export interface APIRouteExports {