Restructure backend into modular API layers with admin/organizador/invitados routes, add role-based middleware, flatten module models, and update build scripts

This commit is contained in:
mberlin
2026-03-19 09:15:22 -03:00
parent 989b19d338
commit 996c6e9241
285 changed files with 6551 additions and 2914 deletions

View File

@@ -0,0 +1,29 @@
import { EntitySchema } from '@mikro-orm/core';
import { BaseEntity } from './base.entity';
export class NotificationRule extends BaseEntity {
module!: string; // e.g. 'guest', 'gift', 'todo'
event!: string; // e.g. 'guest.invited', 'todo.completed'
channels!: Array<'email' | 'whatsapp' | 'sms' | 'custom'>;
conditions?: Record<string, any>;
}
export const NotificationRuleSchema = new EntitySchema<NotificationRule>({
class: NotificationRule,
tableName: 'notification_rules',
properties: {
id: { primary: true, type: 'uuid', defaultRaw: 'uuid_generate_v4()' },
tenantId: { type: 'string' },
metadata: { type: 'json', nullable: true },
createdAt: { type: 'date', defaultRaw: 'now()' },
updatedAt: { type: 'date', defaultRaw: 'now()' },
module: { type: 'string' },
event: { type: 'string' },
channels: { type: 'json' },
conditions: { type: 'json', nullable: true },
},
});