diff --git a/server.ts b/server.ts index 831d7f3..455cb8d 100644 --- a/server.ts +++ b/server.ts @@ -117,7 +117,11 @@ app.post('/api/auth/register', async (req: Request, res: Response) => { name: newUser.name, email: newUser.email, role: newUser.role, - subscriptionStatus: newUser.subscriptionStatus + subscriptionStatus: newUser.subscriptionStatus, + cpf: newUser.cpf, + whatsapp: newUser.whatsapp, + birthDate: newUser.birthDate, + createdAt: newUser.createdAt } }); } catch (err: any) { @@ -162,7 +166,11 @@ app.post('/api/auth/login', (req: Request, res: Response) => { email: user.email, role: user.role, subscriptionStatus: user.subscriptionStatus, - unlockedCourses: user.unlockedCourses || [] + unlockedCourses: user.unlockedCourses || [], + cpf: user.cpf, + whatsapp: user.whatsapp, + birthDate: user.birthDate, + createdAt: user.createdAt } }); }); @@ -188,7 +196,11 @@ app.get('/api/auth/me', authenticateToken, (req: AuthenticatedRequest, res: Resp email: user.email, role: user.role, subscriptionStatus: user.subscriptionStatus, - unlockedCourses: user.unlockedCourses || [] + unlockedCourses: user.unlockedCourses || [], + cpf: user.cpf, + whatsapp: user.whatsapp, + birthDate: user.birthDate, + createdAt: user.createdAt }); }); diff --git a/src/components/ProfileView.tsx b/src/components/ProfileView.tsx index 96fbbb9..1bfe7eb 100644 --- a/src/components/ProfileView.tsx +++ b/src/components/ProfileView.tsx @@ -90,7 +90,7 @@ export default function ProfileView({ user, onBack }: ProfileViewProps) {

Membro desde

- {new Date(user.createdAt).toLocaleDateString('pt-BR')} + {user.createdAt ? new Date(user.createdAt).toLocaleDateString('pt-BR') : 'Não disponível'}

diff --git a/src/db/db.ts b/src/db/db.ts index 182f2d7..4195bcf 100644 --- a/src/db/db.ts +++ b/src/db/db.ts @@ -87,6 +87,8 @@ function createInitialDb(): DatabaseSchema { subscriptionStatus: 'ACTIVE', asaasCustomerId: null, cpf: '691.238.910-40', + whatsapp: '11999999999', + birthDate: '1989-05-15', unlockedCourses: [], createdAt: now }, @@ -99,6 +101,8 @@ function createInitialDb(): DatabaseSchema { subscriptionStatus: 'ACTIVE', asaasCustomerId: 'cus_00001', cpf: '691.238.910-40', + whatsapp: '11999999999', + birthDate: '1989-05-15', unlockedCourses: ['crs_excel'], // Excel starts unlocked for Joao createdAt: new Date(Date.now() - 30 * 24 * 3600 * 1000).toISOString() }, @@ -111,6 +115,8 @@ function createInitialDb(): DatabaseSchema { subscriptionStatus: 'ACTIVE', asaasCustomerId: 'cus_00002', cpf: '691.238.910-40', + whatsapp: '11999999999', + birthDate: '1989-05-15', unlockedCourses: [], createdAt: new Date(Date.now() - 15 * 24 * 3600 * 1000).toISOString() }, @@ -123,6 +129,8 @@ function createInitialDb(): DatabaseSchema { subscriptionStatus: 'OVERDUE', asaasCustomerId: 'cus_00003', cpf: '691.238.910-40', + whatsapp: '11999999999', + birthDate: '1989-05-15', unlockedCourses: [], createdAt: new Date(Date.now() - 45 * 24 * 3600 * 1000).toISOString() }, @@ -135,6 +143,8 @@ function createInitialDb(): DatabaseSchema { subscriptionStatus: 'CANCELED', asaasCustomerId: 'cus_00004', cpf: '691.238.910-40', + whatsapp: '11999999999', + birthDate: '1989-05-15', unlockedCourses: [], createdAt: new Date(Date.now() - 60 * 24 * 3600 * 1000).toISOString() }, @@ -147,6 +157,8 @@ function createInitialDb(): DatabaseSchema { subscriptionStatus: 'ACTIVE', asaasCustomerId: 'cus_test', cpf: '691.238.910-40', + whatsapp: '11999999999', + birthDate: '1989-05-15', unlockedCourses: [], // Starts with only the free courses unlocked createdAt: now }