UNPKG

@mamoorali295/rbac

Version:

Complete RBAC (Role-Based Access Control) system for Node.js with Express middleware, NestJS integration, GraphQL support, MongoDB & PostgreSQL support, modern admin dashboard, TypeScript support, and dynamic permission management

43 lines (42 loc) 1.22 kB
import { Pool } from 'pg'; export interface IPostgresUser { id?: string; user_id: string; name: string; email: string; role_id?: string; created_at?: Date; updated_at?: Date; } export interface IPostgresUserWithRole extends IPostgresUser { role?: { id: string; name: string; description: string; features?: { feature: { id: string; name: string; description: string; }; permissions: { id: string; name: string; description: string; }[]; }[]; }; } export declare class PostgresUser { private pool; constructor(pool: Pool); create(userData: IPostgresUser): Promise<IPostgresUser>; findByUserId(user_id: string): Promise<IPostgresUser | null>; findByUserIdWithRole(user_id: string): Promise<IPostgresUserWithRole | null>; update(user_id: string, updates: Partial<IPostgresUser>): Promise<void>; delete(user_id: string): Promise<void>; getAll(limit?: number, offset?: number, search?: string): Promise<{ users: IPostgresUser[]; total: number; }>; }