diff --git a/asd b/asd deleted file mode 100644 index e69de29bb..000000000 diff --git a/platforms/pictique-api/src/controllers/UserController.ts b/platforms/pictique-api/src/controllers/UserController.ts index edb9b9b16..3fee4401f 100644 --- a/platforms/pictique-api/src/controllers/UserController.ts +++ b/platforms/pictique-api/src/controllers/UserController.ts @@ -52,13 +52,13 @@ export class UserController { // Parse and validate pagination parameters const pageNum = parseInt(page as string) || 1; const limitNum = Math.min(parseInt(limit as string) || 10, 50); // Cap at 50 results - + if (pageNum < 1 || limitNum < 1) { return res .status(400) .json({ error: "Invalid pagination parameters" }); } - + // Parse verified filter const verifiedOnly = verified === "true"; @@ -129,13 +129,13 @@ export class UserController { // Parse and validate pagination parameters const pageNum = parseInt(page as string) || 1; const limitNum = Math.min(parseInt(limit as string) || 10, 50); // Cap at 50 results - + if (pageNum < 1 || limitNum < 1) { return res .status(400) .json({ error: "Invalid pagination parameters" }); } - + // Parse verified filter const verifiedOnly = verified === "true"; @@ -172,18 +172,15 @@ export class UserController { updateProfile = async (req: Request, res: Response) => { try { const userId = req.user?.id; - const { handle, avatar, name } = req.body; + const { avatar, name } = req.body; if (!userId) { return res.status(401).json({ error: "Unauthorized" }); } - const user = await this.userService.findById(userId); - const updatedUser = await this.userService.updateProfile(userId, { - handle: handle ?? user?.handle, - avatarUrl: avatar ?? user?.avatarUrl, - name: name ?? user?.name, + avatarUrl: avatar, + name, }); res.json(updatedUser); diff --git a/platforms/pictique-api/src/services/UserService.ts b/platforms/pictique-api/src/services/UserService.ts index 7fa47b669..d68f1bc13 100644 --- a/platforms/pictique-api/src/services/UserService.ts +++ b/platforms/pictique-api/src/services/UserService.ts @@ -423,15 +423,14 @@ export class UserService { async updateProfile( userId: string, - data: { handle?: string; avatarUrl?: string; name?: string } + data: { avatarUrl?: string; name?: string } ): Promise { const user = await this.userRepository.findOneBy({ id: userId }); if (!user) { throw new Error("User not found"); } - // Update only the fields that are provided - if (data.handle !== undefined) user.handle = data.handle; + // Update only the fields that are provided (handle is not updatable) if (data.avatarUrl !== undefined) user.avatarUrl = data.avatarUrl; if (data.name !== undefined) user.name = data.name; diff --git a/platforms/pictique/src/routes/(protected)/settings/account/username/+page.svelte b/platforms/pictique/src/routes/(protected)/settings/account/username/+page.svelte index 05faef8cd..bb312accf 100644 --- a/platforms/pictique/src/routes/(protected)/settings/account/username/+page.svelte +++ b/platforms/pictique/src/routes/(protected)/settings/account/username/+page.svelte @@ -28,9 +28,8 @@ async function saveProfileData() { try { await apiClient.patch('/api/users/', { - handle, - avatar: profileImageDataUrl, - name + name, + avatar: profileImageDataUrl }); saved = true; setTimeout(() => { @@ -83,12 +82,12 @@
- - + +
- +