Enhance Prisma schema and documentation for dashboard features

- Added new models for DashboardAccessRule and DashboardAuditLog to the Prisma schema, improving access control and logging capabilities.
- Updated GuildSettings model to include timezone support.
- Revised PHASE-TRACKING.md to reflect the completion of Phase 5 and outline upcoming Phase 6 features, including dashboard layout and settings framework.
- Exported new phase 6 features in shared index for better modularity.
This commit is contained in:
smueller
2026-07-22 13:50:14 +02:00
parent 6f3da6bb15
commit 7bc1684566
22 changed files with 645 additions and 15 deletions

View File

@@ -0,0 +1,43 @@
import { describe, expect, it } from 'vitest';
import {
GuildGeneralSettingsPatchSchema,
ModulesUpdateSchema,
hasManageGuildPermission,
DashboardAccessRulesUpdateSchema
} from './phase6.js';
describe('phase6 schemas', () => {
it('accepts general settings patches', () => {
const parsed = GuildGeneralSettingsPatchSchema.parse({
locale: 'en',
timezone: 'UTC'
});
expect(parsed.locale).toBe('en');
expect(parsed.timezone).toBe('UTC');
});
it('rejects empty general settings patches', () => {
expect(() => GuildGeneralSettingsPatchSchema.parse({})).toThrow();
});
it('validates module updates', () => {
const parsed = ModulesUpdateSchema.parse({
modules: { moderation: true, automod: false }
});
expect(parsed.modules.moderation).toBe(true);
expect(parsed.modules.automod).toBe(false);
});
it('detects manage guild permission', () => {
expect(hasManageGuildPermission('32')).toBe(true);
expect(hasManageGuildPermission('0')).toBe(false);
expect(hasManageGuildPermission(String(32n | 8n))).toBe(true);
});
it('validates access rules', () => {
const parsed = DashboardAccessRulesUpdateSchema.parse({
rules: [{ roleId: '123456789012345678', modules: 'all' }]
});
expect(parsed.rules).toHaveLength(1);
});
});