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:
42
apps/web/lib/auth-api.ts
Normal file
42
apps/web/lib/auth-api.ts
Normal 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),
|
||||
};
|
||||
Reference in New Issue
Block a user