Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/useful_links.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@
* [Nuxt Docs](https://nuxt.com/docs/4.x/getting-started/introduction)
* [Vue Docs](https://vuejs.org/guide/introduction.html)
* [BetterAuth MagicLinks](https://better-auth.com/docs/plugins/magic-link)
* [Bruno Docs](https://docs.usebruno.com/introduction/what-is-bruno)
* [Previous Form Example](https://docs.google.com/forms/d/e/1FAIpQLSdALlePXxx2Ckgax4R0-wbpRy-Q1TBVQqpySWhT4WOvmHvQ8w/viewform)
* [Example API from past EPICS Project](https://github.com/UTDallasEPICS/xuchil/tree/102e94c99e7c052a84839e2523e3fee0034ed69a/src/app/api)
17 changes: 17 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"better-auth": "^1.4.7",
"better-sqlite3": "^12.6.2",
"dotenv": "^17.2.3",
"@faker-js/faker": "10.3.0",
"nodemailer": "^7.0.11",
"nuxt": "^4.3.1",
"pg": "^8.20.0",
Expand Down
64 changes: 55 additions & 9 deletions prisma/seed.ts
Original file line number Diff line number Diff line change
@@ -1,45 +1,91 @@
import { Param } from '@prisma/client/runtime/client'
import { prisma } from '../server/utils/prisma'
import { faker } from '@faker-js/faker'

async function main() {
console.log('Start seeding...')

// 1. Create a User with a Password (Local Auth)
// 1. Create a Parent with a Password (Local Auth) and one child
const user1 = await prisma.user.create({
data: {
name: 'Alice Developer',
email: 'alice@a.com',
name: 'Oryx',
email: 'parent1@example.com',
emailVerified: true,
accounts: {
create: {
accountId: 'alice_local_id',
accountId: 'oryx_local_id',
providerId: 'credential', // Common for email/password
password: 'hashed_password_here', // In a real app, hash this!
students: {
create: { name: 'Crota', exp: 5000, settings: { dyslexiaFont: true, fontSize: 1, language: 'en'}} },
},
},
},
},
})

// 2. Create a User with an OAuth Account (e.g., Google)
// 2. Create a Parent with an OAuth Account (e.g., Google) and multiple children
const user2 = await prisma.user.create({
data: {
name: 'Bob Tester',
email: 'bob@b.com',
name: 'Richard Watterson',
email: 'parent2@gmail.com',
emailVerified: true,
accounts: {
create: {
accountId: 'bob_google_id',
accountId: 'rich_google_id',
providerId: 'google',
accessToken: 'mock_access_token',
students: {
create: [
{ name: 'Gumball' },
{ name: 'Darwin' },
{ name: 'Anais' },
],
},
},
},
},
})

console.log({ user1, user2 })
//create a test admin user
const admin1 = await prisma.user.create({
data: {
name: 'Gary Admin',
email: 'admin1@example.com',
emailVerified: true,
accounts: {
create: {
accountId: 'gary_admin_id',
providerId: 'credential',
password: 'hashed_password_here',
admin: { create: {} },
},
},
},
})

//create a second test admin user
const admin2 = await prisma.user.create({
data: {
name: 'Admin Two',
email: 'admin2@example.com',
emailVerified: true,
accounts: {
create: {
accountId: 'admin2_local_id',
providerId: 'credential',
password: 'hashed_password_here',
admin: { create: { settings: { dyslexiaFont: true, fontSize: 1, language: 'en' } } } },
},
},
},
})

console.log({ user1, user2, admin1, admin2 })
console.log('Seeding finished.')
}


main()
.then(async () => {
await prisma.$disconnect()
Expand Down