Spaces:
Runtime error
Runtime error
Download apps/server/src/modules/users/users.controller.js from moustafa7/flwo: direct link, hf CLI and curl.
- Browser
- Download file 609 Bytes
-
https://huggingface.co/spaces/moustafa7/flwo/resolve/main/apps/server/src/modules/users/users.controller.js
- Command line
-
hf download hf://spaces/moustafa7/flwo/apps/server/src/modules/users/users.controller.js
-
curl -L -o users.controller.js https://huggingface.co/spaces/moustafa7/flwo/resolve/main/apps/server/src/modules/users/users.controller.js
609 Bytes
| import { success } from '../../lib/response.js' | |
| import * as usersService from './users.service.js' | |
| import { toPublicUrl } from '../../middleware/upload.js' | |
| export async function updateProfile(req, res, next) { | |
| try { | |
| const avatarUrl = toPublicUrl(req.file?.path) || null | |
| const user = await usersService.updateProfile(req.user.id, req.validatedData, avatarUrl) | |
| success(res, { user }) | |
| } catch (err) { next(err) } | |
| } | |
| export async function getProfile(req, res, next) { | |
| try { | |
| const user = await usersService.getUserById(req.user.id) | |
| success(res, { user }) | |
| } catch (err) { next(err) } | |
| } | |