Add account hierarchy framework with migrations, RLS policies, and UI components

This commit is contained in:
T. Zehetbauer
2026-03-31 22:18:04 +02:00
parent 7e7da0b465
commit 59546ad6d2
262 changed files with 11671 additions and 3927 deletions

View File

@@ -5,10 +5,26 @@ import { z } from 'zod';
* Maps 1:1 to the cms_field_type Postgres enum.
*/
export const CmsFieldTypeEnum = z.enum([
'text', 'textarea', 'richtext', 'checkbox', 'radio', 'hidden',
'select', 'password', 'file', 'date', 'time', 'decimal',
'integer', 'email', 'phone', 'url', 'currency', 'iban',
'color', 'computed',
'text',
'textarea',
'richtext',
'checkbox',
'radio',
'hidden',
'select',
'password',
'file',
'date',
'time',
'decimal',
'integer',
'email',
'phone',
'url',
'currency',
'iban',
'color',
'computed',
]);
export type CmsFieldType = z.infer<typeof CmsFieldTypeEnum>;
@@ -16,7 +32,12 @@ export type CmsFieldType = z.infer<typeof CmsFieldTypeEnum>;
export const CmsModuleStatusEnum = z.enum(['active', 'inactive', 'archived']);
export type CmsModuleStatus = z.infer<typeof CmsModuleStatusEnum>;
export const CmsRecordStatusEnum = z.enum(['active', 'locked', 'deleted', 'archived']);
export const CmsRecordStatusEnum = z.enum([
'active',
'locked',
'deleted',
'archived',
]);
export type CmsRecordStatus = z.infer<typeof CmsRecordStatusEnum>;
/**
@@ -24,9 +45,14 @@ export type CmsRecordStatus = z.infer<typeof CmsRecordStatusEnum>;
*/
export const CreateModuleSchema = z.object({
accountId: z.string().uuid(),
name: z.string().min(1).max(64).regex(/^[a-z][a-z0-9_]*$/, {
message: 'Module name must start with a letter and contain only lowercase letters, numbers, and underscores',
}),
name: z
.string()
.min(1)
.max(64)
.regex(/^[a-z][a-z0-9_]*$/, {
message:
'Module name must start with a letter and contain only lowercase letters, numbers, and underscores',
}),
displayName: z.string().min(1).max(128),
description: z.string().max(1024).optional(),
icon: z.string().max(64).default('table'),