add seeding for manual testing

This commit is contained in:
Yisroel Baum 2026-05-03 17:25:08 +03:00
parent 2a75062514
commit e83f098280
Signed by: yisroelbaum
GPG key ID: 0FA60884F75520A9

127
data/seedMore.php Normal file
View file

@ -0,0 +1,127 @@
<?php
$texts = [
[
'id' => 0,
'name' => 'Tanach',
'userId' => 1,
],
];
$nodes = [
[
'id' => 0,
'title' => 'Tanach',
'textId' => 0,
'parentNodeId' => null,
],
[
'id' => 1,
'title' => 'Torah',
'textId' => 0,
'parentNodeId' => 0,
],
[
'id' => 2,
'title' => 'Neviim',
'textId' => 0,
'parentNodeId' => 0,
],
[
'id' => 3,
'title' => 'Kesuvim',
'textId' => 0,
'parentNodeId' => 0,
],
[
'id' => 4,
'title' => 'Bereishis',
'textId' => 0,
'parentNodeId' => 1,
],
[
'id' => 5,
'title' => 'Shmos',
'textId' => 0,
'parentNodeId' => 1,
],
[
'id' => 6,
'title' => 'Vayikra',
'textId' => 0,
'parentNodeId' => 1,
],
[
'id' => 7,
'title' => 'Bamidbar',
'textId' => 0,
'parentNodeId' => 1,
],
[
'id' => 8,
'title' => 'Devarim',
'textId' => 0,
'parentNodeId' => 1,
],
[
'id' => 9,
'title' => 'Bereishis',
'textId' => 0,
'parentNodeId' => 4,
],
[
'id' => 10,
'title' => 'Noach',
'textId' => 0,
'parentNodeId' => 4,
],
[
'id' => 11,
'title' => 'Lech Lecha',
'textId' => 0,
'parentNodeId' => 4,
],
];
// Default credentials:
// admin@example.com / admin1234 (admin)
// user@example.com / password1 (regular user)
// user2@example.com / password2 (second regular user, no texts seeded)
$users = [
[
'id' => 0,
'email' => 'admin@example.com',
'passwordHash' => password_hash('admin1234', PASSWORD_DEFAULT),
'isAdmin' => true,
],
[
'id' => 1,
'email' => 'user@example.com',
'passwordHash' => password_hash('password1', PASSWORD_DEFAULT),
'isAdmin' => false,
],
[
'id' => 2,
'email' => 'user2@example.com',
'passwordHash' => password_hash('password2', PASSWORD_DEFAULT),
'isAdmin' => false,
],
];
$plans = [];
$scheduledNodes = [];
$sessions = [];
$fileDataMap = [
'texts.json' => $texts,
'nodes.json' => $nodes,
'users.json' => $users,
'plans.json' => $plans,
'scheduledNodes.json' => $scheduledNodes,
'sessions.json' => $sessions,
];
foreach ($fileDataMap as $file => $data) {
$path = __DIR__ . "/$file";
file_put_contents($path, json_encode($data, JSON_PRETTY_PRINT));
}