fix(rbac): Make role.slug NOT NULL to match DDL

- Updated role.entity.ts: slug is now required (NOT NULL)
- Updated rbac.service.ts: generate slug from code when creating roles
- Tenant entity already complete with all DDL fields (no changes needed)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Adrian Flores Cortes 2026-02-03 14:24:41 -06:00
parent e2abeaca9c
commit 9baaf4af85
2 changed files with 3 additions and 2 deletions

View File

@ -26,9 +26,9 @@ export class Role {
@Index() @Index()
code: string; code: string;
@Column({ type: 'varchar', length: 100, nullable: true }) @Column({ type: 'varchar', length: 100 })
@Index() @Index()
slug: string | null; slug: string;
@Column({ type: 'text', nullable: true }) @Column({ type: 'text', nullable: true })
description: string | null; description: string | null;

View File

@ -38,6 +38,7 @@ export class RbacService {
tenant_id: tenantId, tenant_id: tenantId,
name: dto.name, name: dto.name,
code: dto.code, code: dto.code,
slug: dto.code.toLowerCase().replace(/[^a-z0-9]+/g, '_'),
description: dto.description || null, description: dto.description || null,
is_system: false, is_system: false,
is_active: true, is_active: true,