WellNuo Lite architecture: - Simplified navigation flow with NavigationController - Profile editing with API sync (/auth/profile endpoint) - OTP verification improvements - ESP WiFi provisioning setup (espProvisioning.ts) - E2E testing infrastructure (Playwright) - Speech recognition hooks (web/native) - Backend auth enhancements This is the stable version submitted to App Store. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
64 lines
1.9 KiB
JavaScript
64 lines
1.9 KiB
JavaScript
const { Client } = require('pg');
|
|
|
|
const client = new Client({
|
|
user: 'sergei',
|
|
host: 'eluxnetworks.net',
|
|
database: 'wellnuo_app',
|
|
password: 'W31153Rg31',
|
|
port: 5432,
|
|
ssl: {
|
|
rejectUnauthorized: false
|
|
}
|
|
});
|
|
|
|
const TEST_EMAIL = 'test@test.com';
|
|
const TEST_CODE = '123456';
|
|
|
|
async function run() {
|
|
try {
|
|
await client.connect();
|
|
console.log('Connected to database');
|
|
|
|
// 1. Check if user exists
|
|
const userRes = await client.query('SELECT * FROM public.users WHERE email = $1', [TEST_EMAIL]);
|
|
|
|
let userId;
|
|
if (userRes.rows.length > 0) {
|
|
console.log('User already exists:', userRes.rows[0]);
|
|
userId = userRes.rows[0].id;
|
|
} else {
|
|
// 2. Create user (assuming id is serial)
|
|
console.log('Creating new user...');
|
|
const insertRes = await client.query(`
|
|
INSERT INTO public.users (email, name, role, is_active, created_at, updated_at)
|
|
VALUES ($1, $2, $3, $4, NOW(), NOW())
|
|
RETURNING id;
|
|
`, [TEST_EMAIL, 'Test User', 'user', true]);
|
|
userId = insertRes.rows[0].id;
|
|
console.log('User created with ID:', userId);
|
|
}
|
|
|
|
// 3. Create OTP code
|
|
// Delete old codes first
|
|
await client.query('DELETE FROM public.otp_codes WHERE email = $1', [TEST_EMAIL]);
|
|
|
|
const expiresAt = new Date();
|
|
expiresAt.setHours(expiresAt.getHours() + 24); // Valid for 24 hours
|
|
|
|
await client.query(`
|
|
INSERT INTO public.otp_codes (email, code, expires_at, created_at)
|
|
VALUES ($1, $2, $3, NOW())
|
|
`, [TEST_EMAIL, TEST_CODE, expiresAt]);
|
|
|
|
console.log(`OTP code ${TEST_CODE} created for ${TEST_EMAIL}`);
|
|
console.log('You can now log in with this email and OTP.');
|
|
|
|
} catch (err) {
|
|
console.error('Database error:', err);
|
|
} finally {
|
|
await client.end();
|
|
}
|
|
}
|
|
|
|
run();
|