mirror of
https://github.com/versia-pub/server.git
synced 2026-03-13 05:49:16 +01:00
feat(api): ✨ Add permissions to every route and permission config
This commit is contained in:
parent
19823d8eca
commit
4902f078a8
79 changed files with 729 additions and 251 deletions
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue