diff --git a/src/lib/db.ts b/src/lib/db.ts index 9e917f7..0540606 100644 --- a/src/lib/db.ts +++ b/src/lib/db.ts @@ -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 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) { insertUser.run({ id: user.id, name: user.name, - email: `${user.id}@example.com`, // Generate mock email + email: user.email, role: user.role, avatarUrl: user.avatarUrl ?? null, bio: user.bio ?? null diff --git a/src/lib/mockData.ts b/src/lib/mockData.ts index e617635..942cf2f 100644 --- a/src/lib/mockData.ts +++ b/src/lib/mockData.ts @@ -4,14 +4,14 @@ import { addDays, formatISO, subDays } from 'date-fns'; const today = new Date(); -export const rawUsers: Omit[] = [ - { 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: '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: '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: 'user4', name: 'Charlie Brown', role: 'User' }, - { id: 'user5', name: 'Diana Prince', role: 'User' }, - { id: 'user6', name: 'Edward Nigma', role: 'User' }, - { id: 'admin-main', name: 'Main Admin', role: 'Admin' }, +export const rawUsers: User[] = [ + { 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', 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', 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', email: 'user4@example.com', role: 'User' }, + { id: 'user5', name: 'Diana Prince', email: 'user5@example.com', role: 'User' }, + { id: 'user6', name: 'Edward Nigma', email: 'user6@example.com', role: 'User' }, + { id: 'admin-main', name: 'Main Admin', email: 'admin@example.com', role: 'Admin' }, ]; export const rawToys: Omit[] = [