feat(notifications): add multi-channel notification module with Email, FCM, templates, and event listeners

- Domain: NotificationLog/NotificationPreference entities, repositories, channel value object
- Infrastructure: EmailService (nodemailer/SMTP), FcmService (firebase-admin), TemplateService (Handlebars)
- Application: SendNotification CQRS command, UserRegistered + AgentVerified event listeners
- Presentation: NotificationsController with history, preferences, and templates endpoints
- Prisma: NotificationLog and NotificationPreference models with proper indexes
- Templates: Vietnamese notification templates for user.registered, agent.verified, listing.approved, inquiry.received, password.reset

Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
Ho Ngoc Hai
2026-04-08 01:42:17 +07:00
parent 9301f44119
commit 0b29fac35e
42 changed files with 1720 additions and 6 deletions

42
apps/web/lib/auth-api.ts Normal file
View File

@@ -0,0 +1,42 @@
import { apiClient } from './api-client';
export interface TokenPair {
accessToken: string;
refreshToken: string;
expiresIn: number;
}
export interface UserProfile {
id: string;
email: string | null;
phone: string;
fullName: string;
avatarUrl: string | null;
role: string;
kycStatus: string;
isActive: boolean;
createdAt: string;
}
export interface RegisterPayload {
phone: string;
password: string;
fullName: string;
email?: string;
}
export interface LoginPayload {
phone: string;
password: string;
}
export const authApi = {
register: (data: RegisterPayload) => apiClient.post<TokenPair>('/auth/register', data),
login: (data: LoginPayload) => apiClient.post<TokenPair>('/auth/login', data),
refresh: (refreshToken: string) =>
apiClient.post<TokenPair>('/auth/refresh', { refreshToken }),
getProfile: (token: string) => apiClient.authGet<UserProfile>('/auth/profile', token),
};