- Introduced email configuration for both development and production environments in `.env.dev.example` and `.env.production.example`. - Added SendGrid API key and email settings to support password reset and welcome emails. - Implemented password reset and request password reset endpoints in the AuthController. - Enhanced signup form to include additional fields such as Customer Number, address, nationality, date of birth, and gender. - Updated various services and controllers to integrate email functionality and handle new user data. - Refactored logging and error handling for improved clarity and maintainability. - Adjusted Docker configuration for production deployment.
89 lines
1.8 KiB
TypeScript
89 lines
1.8 KiB
TypeScript
// User and authentication types
|
|
|
|
export interface User {
|
|
id: string;
|
|
email: string;
|
|
firstName?: string;
|
|
lastName?: string;
|
|
company?: string;
|
|
phone?: string;
|
|
address?: UserAddress;
|
|
createdAt: string; // ISO
|
|
updatedAt: string; // ISO
|
|
mfaEnabled: boolean;
|
|
emailVerified: boolean;
|
|
}
|
|
|
|
export interface UserAddress {
|
|
line1: string;
|
|
line2?: string;
|
|
city: string;
|
|
state: string;
|
|
postalCode: string;
|
|
country: string;
|
|
}
|
|
|
|
export interface UserSummary {
|
|
user: User;
|
|
stats: {
|
|
activeSubscriptions: number;
|
|
unpaidInvoices: number;
|
|
openCases: number;
|
|
totalSpent: number;
|
|
currency: string;
|
|
};
|
|
nextInvoice?: {
|
|
id: number;
|
|
dueDate: string;
|
|
amount: number;
|
|
currency: string;
|
|
};
|
|
recentActivity: Activity[];
|
|
}
|
|
|
|
export interface Activity {
|
|
id: string;
|
|
type: "invoice_created" | "invoice_paid" | "service_activated" | "case_created" | "case_closed";
|
|
title: string;
|
|
description?: string;
|
|
date: string; // ISO
|
|
relatedId?: number; // ID of related invoice, subscription, etc.
|
|
metadata?: Record<string, unknown>;
|
|
}
|
|
|
|
export interface AuthTokens {
|
|
accessToken: string;
|
|
refreshToken?: string;
|
|
expiresAt: string; // ISO
|
|
}
|
|
|
|
export interface LoginRequest {
|
|
email: string;
|
|
password: string;
|
|
mfaCode?: string;
|
|
}
|
|
|
|
export interface SignupRequest {
|
|
email: string;
|
|
password: string;
|
|
firstName: string;
|
|
lastName: string;
|
|
company?: string;
|
|
phone?: string;
|
|
sfNumber: string; // Customer Number
|
|
address?: UserAddress;
|
|
nationality?: string;
|
|
dateOfBirth?: string; // ISO or locale string per frontend validation
|
|
gender?: "male" | "female" | "other";
|
|
}
|
|
|
|
export interface LinkWhmcsRequest {
|
|
email: string;
|
|
whmcsToken?: string; // From OIDC or ValidateLogin
|
|
}
|
|
|
|
export interface SetPasswordRequest {
|
|
password: string;
|
|
confirmPassword: string;
|
|
}
|