MCPcopy
hub / github.com/Dokploy/dokploy / updateUser

Function updateUser

packages/server/src/services/user.ts:486–510  ·  view source on GitHub ↗
(userId: string, userData: Partial<User>)

Source from the content-addressed store, hash-verified

484};
485
486export const updateUser = async (userId: string, userData: Partial<User>) => {
487 // Validate email if it's being updated
488 if (userData.email !== undefined) {
489 if (!userData.email || userData.email.trim() === "") {
490 throw new Error("Email is required and cannot be empty");
491 }
492
493 // Basic email format validation
494 const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
495 if (!emailRegex.test(userData.email)) {
496 throw new Error("Please enter a valid email address");
497 }
498 }
499
500 const userResult = await db
501 .update(user)
502 .set({
503 ...userData,
504 })
505 .where(eq(user.id, userId))
506 .returning()
507 .then((res) => res[0]);
508
509 return userResult;
510};
511
512export const createApiKey = async (
513 userId: string,

Callers 2

user.tsFile · 0.90
stripe.tsFile · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected