Skip to content

Commit a4177b9

Browse files
Changing db utils
1 parent 9dfbe18 commit a4177b9

File tree

2 files changed

+3
-17
lines changed

2 files changed

+3
-17
lines changed

src/app/api/users/route.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { NextRequest, NextResponse } from 'next/server';
1+
import { NextResponse } from 'next/server';
22
import prisma from '@/prisma';
33

44
export async function GET() {

src/app/utils/databaseUtils.ts

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import prisma from '@/prisma';
2+
import { User } from '@prisma/client';
23

34
export async function createEmail(email: string) {
45
return await prisma.email.create({
@@ -24,22 +25,7 @@ export async function deleteEmail(email: string) {
2425
});
2526
}
2627

27-
export async function upsertUserFromEmail(email: { id: string; email: string }, uid: string) {
28-
return await prisma.user.upsert({
29-
where: {
30-
uid: uid,
31-
},
32-
create: {
33-
uid: uid,
34-
emailId: email.id,
35-
},
36-
update: {
37-
emailId: email.id,
38-
},
39-
});
40-
}
41-
42-
export async function getUser(uid: string) {
28+
export async function getUser(uid: string): Promise<User | null> {
4329
return await prisma.user.findUnique({
4430
where: {
4531
uid: uid,

0 commit comments

Comments
 (0)