MCPcopy Create free account
hub / github.com/WebDevSimplified/course-platform / updateUser

Function updateUser

src/features/users/db/users.ts:22–36  ·  view source on GitHub ↗
(
  { clerkUserId }: { clerkUserId: string },
  data: Partial<typeof UserTable.$inferInsert>
)

Source from the content-addressed store, hash-verified

20}
21
22export async function updateUser(
23 { clerkUserId }: { clerkUserId: string },
24 data: Partial<typeof UserTable.$inferInsert>
25) {
26 const [updatedUser] = await db
27 .update(UserTable)
28 .set(data)
29 .where(eq(UserTable.clerkUserId, clerkUserId))
30 .returning()
31
32 if (updatedUser == null) throw new Error("Failed to update user")
33 revalidateUserCache(updatedUser.id)
34
35 return updatedUser
36}
37
38export async function deleteUser({ clerkUserId }: { clerkUserId: string }) {
39 const [deletedUser] = await db

Callers 1

POSTFunction · 0.90

Calls 1

revalidateUserCacheFunction · 0.90

Tested by

no test coverage detected