Template base para proyectos SaaS multi-tenant. Estructura inicial: - apps/backend (NestJS API) - apps/frontend (React/Vite) - apps/database (PostgreSQL DDL) - docs/ (Documentación) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
30 lines
1.7 KiB
TypeScript
30 lines
1.7 KiB
TypeScript
import { Repository } from 'typeorm';
|
|
import { Notification, NotificationTemplate, UserNotificationPreference } from '../entities';
|
|
import { CreateNotificationDto, SendTemplateNotificationDto, UpdatePreferencesDto } from '../dto';
|
|
export declare class NotificationsService {
|
|
private readonly notificationRepository;
|
|
private readonly templateRepository;
|
|
private readonly preferenceRepository;
|
|
constructor(notificationRepository: Repository<Notification>, templateRepository: Repository<NotificationTemplate>, preferenceRepository: Repository<UserNotificationPreference>);
|
|
create(dto: CreateNotificationDto, tenantId: string): Promise<Notification>;
|
|
sendFromTemplate(dto: SendTemplateNotificationDto, tenantId: string): Promise<Notification>;
|
|
findAllForUser(userId: string, tenantId: string, options?: {
|
|
page?: number;
|
|
limit?: number;
|
|
unreadOnly?: boolean;
|
|
}): Promise<{
|
|
data: Notification[];
|
|
total: number;
|
|
unread: number;
|
|
}>;
|
|
markAsRead(notificationId: string, userId: string, tenantId: string): Promise<Notification>;
|
|
markAllAsRead(userId: string, tenantId: string): Promise<number>;
|
|
delete(notificationId: string, userId: string, tenantId: string): Promise<void>;
|
|
getUnreadCount(userId: string, tenantId: string): Promise<number>;
|
|
findAllTemplates(): Promise<NotificationTemplate[]>;
|
|
findTemplateByCode(code: string): Promise<NotificationTemplate>;
|
|
getPreferences(userId: string, tenantId: string): Promise<UserNotificationPreference>;
|
|
updatePreferences(userId: string, tenantId: string, dto: UpdatePreferencesDto): Promise<UserNotificationPreference>;
|
|
cleanupOldNotifications(daysToKeep?: number): Promise<number>;
|
|
}
|