Skip to content

Commit 626eae2

Browse files
fixing prepopulate script
1 parent e503cbc commit 626eae2

2 files changed

Lines changed: 12 additions & 17 deletions

File tree

scripts/prepopulateEmails.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,23 @@
11
import { PrismaClient } from '@prisma/client';
2-
import { upsertAppDevUser } from '../src/app/utils/databaseUtils';
32

43
const prisma = new PrismaClient();
54

65
const appDevEmails = ['a@cornell.edu', 'b@cornell.edu', 'c@cornell.edu'];
76

87
async function main() {
98
for (const email of appDevEmails) {
10-
await upsertAppDevUser(email);
9+
await prisma.user.upsert({
10+
where: {
11+
email: email,
12+
},
13+
update: {
14+
isAppDev: true,
15+
},
16+
create: {
17+
email: email,
18+
isAppDev: true,
19+
},
20+
});
1121
}
1222
}
1323

src/app/utils/databaseUtils.ts

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,6 @@ export async function getUserByEmail(email: string): Promise<User | null> {
99
});
1010
}
1111

12-
export async function upsertAppDevUser(email: string): Promise<User | null> {
13-
return await prisma.user.upsert({
14-
where: {
15-
email: email,
16-
},
17-
update: {
18-
isAppDev: true,
19-
},
20-
create: {
21-
email: email,
22-
isAppDev: true,
23-
},
24-
});
25-
}
26-
2712
export async function upsertUser(email: string): Promise<User | null> {
2813
return await prisma.user.upsert({
2914
where: {

0 commit comments

Comments
 (0)