From bc1d5fe19819f41711735442930c52b2671e310d Mon Sep 17 00:00:00 2001 From: behnamrhp Date: Mon, 22 May 2023 17:37:36 +0300 Subject: [PATCH] [FEAT]: add driven login auth --- .../auth-admin-login/authAdminLogin.ts | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 src/driven/adapters/auth-admin-login/authAdminLogin.ts diff --git a/src/driven/adapters/auth-admin-login/authAdminLogin.ts b/src/driven/adapters/auth-admin-login/authAdminLogin.ts new file mode 100644 index 0000000..e18f8d3 --- /dev/null +++ b/src/driven/adapters/auth-admin-login/authAdminLogin.ts @@ -0,0 +1,27 @@ +import { apiUrls } from '~/driven/utils/configs/appConfig'; +import { HttpOptionsType } from '~/driven/boundaries/http-boundary/protocols'; +import { HTTPPovider } from '~/driven/boundaries/http-boundary/httpBoundary'; +import { IOtpAuthDrivenPort } from '~/business-logic/generic/admin-user/authentication/otp-auth/port'; +import { OtpAuthResponse } from '~/business-logic/generic/admin-user/authentication/otp-auth/data/reponse-object/otpAuthRO'; +import { OtpAuthDTOReturnType } from '~/business-logic/generic/admin-user/authentication/otp-auth/data/dto/otpAuthDto'; + +const authAdminLogin = (): IOtpAuthDrivenPort => { + const httpProvider = new HTTPPovider(); + const httpHandler = (data: OtpAuthDTOReturnType): Promise => { + const url = apiUrls.generic.authLogin; + const options: HttpOptionsType = { + url, + headers: { + 'Content-Type': 'application/json', + }, + data, + }; + return httpProvider.request(options); + }; + + return { + httpHandler, + }; +}; + +export default authAdminLogin;