add user@example.com account and admin@example.com to sqlite database
This commit is contained in:
parent
a5e472498e
commit
e7d9db0cd6
|
|
@ -58,12 +58,12 @@ function initDb() {
|
||||||
const insertUser = db.prepare('INSERT INTO users (id, name, email, role, avatarUrl, bio) VALUES (@id, @name, @email, @role, @avatarUrl, @bio)');
|
const insertUser = db.prepare('INSERT INTO users (id, name, email, role, avatarUrl, bio) VALUES (@id, @name, @email, @role, @avatarUrl, @bio)');
|
||||||
const insertToy = db.prepare('INSERT INTO toys (id, name, description, category, images, unavailableRanges, ownerId, pricePerDay, location) VALUES (@id, @name, @description, @category, @images, @unavailableRanges, @ownerId, @pricePerDay, @location)');
|
const insertToy = db.prepare('INSERT INTO toys (id, name, description, category, images, unavailableRanges, ownerId, pricePerDay, location) VALUES (@id, @name, @description, @category, @images, @unavailableRanges, @ownerId, @pricePerDay, @location)');
|
||||||
|
|
||||||
const insertManyUsers = db.transaction((users) => {
|
const insertManyUsers = db.transaction((users: User[]) => {
|
||||||
for (const user of users) {
|
for (const user of users) {
|
||||||
insertUser.run({
|
insertUser.run({
|
||||||
id: user.id,
|
id: user.id,
|
||||||
name: user.name,
|
name: user.name,
|
||||||
email: `${user.id}@example.com`, // Generate mock email
|
email: user.email,
|
||||||
role: user.role,
|
role: user.role,
|
||||||
avatarUrl: user.avatarUrl ?? null,
|
avatarUrl: user.avatarUrl ?? null,
|
||||||
bio: user.bio ?? null
|
bio: user.bio ?? null
|
||||||
|
|
|
||||||
|
|
@ -4,14 +4,14 @@ import { addDays, formatISO, subDays } from 'date-fns';
|
||||||
|
|
||||||
const today = new Date();
|
const today = new Date();
|
||||||
|
|
||||||
export const rawUsers: Omit<User, 'email'>[] = [
|
export const rawUsers: User[] = [
|
||||||
{ id: 'user1', name: 'Alice Wonderland', role: 'Admin', avatarUrl: 'https://placehold.co/100x100.png?text=AW', bio: "Lover of imaginative play and sharing joy. I have a collection of classic storybooks and dress-up costumes that my kids have outgrown but still have lots of life left in them!" },
|
{ id: 'user1', name: 'Alice Wonderland', email: 'user@example.com', role: 'Admin', avatarUrl: 'https://placehold.co/100x100.png?text=AW', bio: "Lover of imaginative play and sharing joy. I have a collection of classic storybooks and dress-up costumes that my kids have outgrown but still have lots of life left in them!" },
|
||||||
{ id: 'user2', name: 'Bob The Builder', role: 'User', avatarUrl: 'https://placehold.co/100x100.png?text=BT', bio: "Can we fix it? Yes, we can! Sharing my collection of construction toys, tools, and playsets. Always happy to help another budding builder." },
|
{ id: 'user2', name: 'Bob The Builder', email: 'user2@example.com', role: 'User', avatarUrl: 'https://placehold.co/100x100.png?text=BT', bio: "Can we fix it? Yes, we can! Sharing my collection of construction toys, tools, and playsets. Always happy to help another budding builder." },
|
||||||
{ id: 'user3', name: 'Carol Danvers', role: 'User', avatarUrl: 'https://placehold.co/100x100.png?text=CD', bio: "Higher, further, faster. Sharing toys that inspire adventure, courage, and exploration. My collection includes superhero action figures and space-themed playsets." },
|
{ id: 'user3', name: 'Carol Danvers', email: 'user3@example.com', role: 'User', avatarUrl: 'https://placehold.co/100x100.png?text=CD', bio: "Higher, further, faster. Sharing toys that inspire adventure, courage, and exploration. My collection includes superhero action figures and space-themed playsets." },
|
||||||
{ id: 'user4', name: 'Charlie Brown', role: 'User' },
|
{ id: 'user4', name: 'Charlie Brown', email: 'user4@example.com', role: 'User' },
|
||||||
{ id: 'user5', name: 'Diana Prince', role: 'User' },
|
{ id: 'user5', name: 'Diana Prince', email: 'user5@example.com', role: 'User' },
|
||||||
{ id: 'user6', name: 'Edward Nigma', role: 'User' },
|
{ id: 'user6', name: 'Edward Nigma', email: 'user6@example.com', role: 'User' },
|
||||||
{ id: 'admin-main', name: 'Main Admin', role: 'Admin' },
|
{ id: 'admin-main', name: 'Main Admin', email: 'admin@example.com', role: 'Admin' },
|
||||||
];
|
];
|
||||||
|
|
||||||
export const rawToys: Omit<Toy, 'ownerName' | 'dataAiHint'>[] = [
|
export const rawToys: Omit<Toy, 'ownerName' | 'dataAiHint'>[] = [
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue