Download src/modules/auth/auth.controller.js from moustafa7/gymco: direct link, hf CLI and curl.
- Browser
- Download file 1.59 kB
-
https://huggingface.co/spaces/moustafa7/gymco/resolve/main/src/modules/auth/auth.controller.js
- Command line
-
hf download hf://spaces/moustafa7/gymco/src/modules/auth/auth.controller.js
-
curl -L -o auth.controller.js https://huggingface.co/spaces/moustafa7/gymco/resolve/main/src/modules/auth/auth.controller.js
1.59 kB
| import { asyncHandler } from '../../common/middleware/asyncHandler.js'; | |
| import { created, ok } from '../../common/utils/response.js'; | |
| import { authService } from './auth.service.js'; | |
| export const authController = { | |
| register: asyncHandler(async (req, res) => { | |
| created(res, await authService.register(req.body), 'Gym owner registered'); | |
| }), | |
| login: asyncHandler(async (req, res) => { | |
| ok(res, await authService.login(req.body), 'Login successful'); | |
| }), | |
| checkEmail: asyncHandler(async (req, res) => { | |
| ok(res, await authService.checkEmail(req.validatedQuery.email), 'Email availability'); | |
| }), | |
| refresh: asyncHandler(async (req, res) => { | |
| ok(res, await authService.refresh(req.body.refreshToken), 'Token refreshed'); | |
| }), | |
| me: asyncHandler(async (req, res) => { | |
| ok(res, await authService.me(req.user.sub), 'Authenticated user'); | |
| }), | |
| loginAccounts: asyncHandler(async (req, res) => { | |
| ok(res, await authService.loginAccounts(), 'Available login accounts'); | |
| }), | |
| forgotPassword: asyncHandler(async (req, res) => { | |
| ok(res, await authService.forgotPassword(req.body.email), 'Password reset requested'); | |
| }), | |
| verifyOtp: asyncHandler(async (req, res) => { | |
| ok(res, await authService.verifyOtp(req.body), 'Verification code is valid'); | |
| }), | |
| resetPassword: asyncHandler(async (req, res) => { | |
| ok(res, await authService.resetPassword(req.body), 'Password reset complete'); | |
| }), | |
| changePassword: asyncHandler(async (req, res) => { | |
| ok(res, await authService.changePassword(req.user.sub, req.body), 'Password changed'); | |
| }), | |
| }; | |