- 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>
43 lines
938 B
TypeScript
43 lines
938 B
TypeScript
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),
|
|
};
|