Skip to content

Commit

Permalink
chore: seed db with users
Browse files Browse the repository at this point in the history
  • Loading branch information
seaerchin committed Jun 25, 2024
1 parent d091893 commit 4f2674c
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions apps/studio/prisma/seed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,19 @@ import {
} from '~/server/modules/resource/resource.types'
import { db } from '../src/server/modules/database'

const MOCK_PHONE_NUMBER = '123456789'

const ISOMER_ADMINS = [
'alex',
'jan',
'kishore',
'jiachin',
'sehyun',
'harish',
'zhongjun',
'hanpu',
]

const PAGE_BLOB = {
version: '0.1.0',
layout: 'homepage',
Expand Down Expand Up @@ -188,6 +201,19 @@ async function main() {
.insertInto('Resource')
.values({ blobId, name: 'Home', siteId })
.executeTakeFirstOrThrow()

await Promise.all(
ISOMER_ADMINS.map((name) => {
return db
.insertInto('User')
.values({
name,
email: `${name}@open.gov.sg`,
phone: MOCK_PHONE_NUMBER,
})
.executeTakeFirstOrThrow()
}),
)
}

main()
Expand Down

0 comments on commit 4f2674c

Please sign in to comment.