Some checks failed
CI / Build & Test (push) Failing after 1m31s
- Add user management endpoints (list/create/get/update/delete) with pagination and search - Add dashboard stats endpoint with tenant/user/online counts and growth metrics - Add tenant resolver middleware for multi-tenant request scoping - Add i18n kernel with zh/en message files and AcceptLanguage middleware - Add WebSocket hub/handler for real-time communication - Add job scheduler kernel with cron support - Add plugin sandbox for isolated execution - Add storage kernel (local filesystem) - Add event bus kernel for pub/sub - Add cache kernel abstraction - Add database migration runner and version upgrade checker - Add rate limiting middleware with Redis backend - Add SQL migrations for rbac, audit_logs, settings, notifications, examples - Extend user repository with list/delete/count operations - Register all module routes with tenant resolver
37 lines
1.0 KiB
SQL
37 lines
1.0 KiB
SQL
-- RBAC tables
|
|
CREATE TABLE IF NOT EXISTS permissions (
|
|
id BIGSERIAL PRIMARY KEY,
|
|
code VARCHAR(128) NOT NULL UNIQUE,
|
|
name VARCHAR(128) NOT NULL,
|
|
module VARCHAR(64) NOT NULL,
|
|
description VARCHAR(256),
|
|
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
|
|
updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
|
|
);
|
|
|
|
CREATE TABLE IF NOT EXISTS roles (
|
|
id BIGSERIAL,
|
|
tenant_id UUID NOT NULL,
|
|
name VARCHAR(64) NOT NULL,
|
|
description VARCHAR(256),
|
|
is_system BOOLEAN NOT NULL DEFAULT FALSE,
|
|
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
|
|
updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
|
|
PRIMARY KEY (id, tenant_id)
|
|
);
|
|
|
|
CREATE UNIQUE INDEX IF NOT EXISTS idx_tenant_role_name ON roles(tenant_id, name);
|
|
|
|
CREATE TABLE IF NOT EXISTS role_permissions (
|
|
role_id BIGINT NOT NULL,
|
|
permission_id BIGINT NOT NULL,
|
|
PRIMARY KEY (role_id, permission_id)
|
|
);
|
|
|
|
CREATE TABLE IF NOT EXISTS user_roles (
|
|
user_id BIGINT NOT NULL,
|
|
tenant_id UUID NOT NULL,
|
|
role_id BIGINT NOT NULL,
|
|
PRIMARY KEY (user_id, tenant_id)
|
|
);
|