Loading mobile/src/auth/infrastructure/dev/datasources/auth_datasource.ts +2 −1 Original line number Diff line number Diff line Loading @@ -2,12 +2,13 @@ import { delay } from '../../../../common/utils/delay_time'; import { AuthDataSource } from '../../../domain/datasources/auth_datasource'; import { LoginInfoEntity } from '../../../domain/entities/login_info_entity'; import { RegisterInfoEntity } from '../../../domain/entities/register_info'; import { ResetPasswordInfoEntity } from '../../../domain/entities/reset_password_entity'; import { UserInfoEntity } from '../../../domain/entities/user_info_entity'; export class AuthDataSourceDev implements AuthDataSource { getResetCode (email: string): Promise<void>{ throw new Error("Method not implemented."); } resetPassword (code: string): Promise<void> { resetPassword (resetInfo: ResetPasswordInfoEntity): Promise<void> { throw new Error("Method not implemented."); } async login(email: string, password: string): Promise<LoginInfoEntity>{ Loading mobile/src/auth/infrastructure/prod/datasources/auth_datasource.ts +21 −4 Original line number Diff line number Diff line Loading @@ -7,13 +7,30 @@ import { API_URL } from "../../../../common/constants/api"; import { LoginUserModel } from "../models/login_user_model"; import { UserInfoEntity } from "../../../domain/entities/user_info_entity"; import { RegisterResponseModel } from "../models/register_user_model"; import { ResetPasswordInfoEntity } from "../../../domain/entities/reset_password_entity"; export class AuthDatasourceProd implements AuthDataSource { getResetCode (email: string): Promise<void> { throw new Error("Method not implemented."); async getResetCode (email: string): Promise<void> { const {status} = await axios.post(`${API_URL}/user/get-reset-code`, { email }); if (status !== 201) { throw new Error("Error fetching new reset code"); } } async resetPassword (resetInfo: ResetPasswordInfoEntity): Promise<void> { const resetInfoModel = { email: resetInfo.email, resetCode: resetInfo.code, newPassword: resetInfo.newPassword } const {status} = await axios.post(`${API_URL}/user/reset-password`, resetInfoModel); if (status !== 201) { throw new Error("Error reset Password"); } resetPassword (code: string): Promise<void> { throw new Error("Method not implemented."); } login: (email: string, password: string) => Promise<LoginInfoEntity> = async (email, password) => { const loginInfo: LoginUserModel = { Loading mobile/src/auth/infrastructure/prod/repositories/auth_repository.ts +3 −2 Original line number Diff line number Diff line import { AuthDataSource } from '../../../domain/datasources/auth_datasource'; import { RegisterInfoEntity } from '../../../domain/entities/register_info'; import { ResetPasswordInfoEntity } from '../../../domain/entities/reset_password_entity'; import { UserInfoEntity } from '../../../domain/entities/user_info_entity'; import { AuthRepository } from '../../../domain/repositories/auth_repository'; export class AuthRepositoryImpl implements AuthRepository { Loading @@ -8,8 +9,8 @@ export class AuthRepositoryImpl implements AuthRepository { getResetCode (email: string) { return this.authDataSource.getResetCode(email); } resetPassword (code: string) { return this.authDataSource.resetPassword(code); resetPassword (resetInfo: ResetPasswordInfoEntity) { return this.authDataSource.resetPassword(resetInfo); } async login(email: string, password: string) { return await this.authDataSource.login(email, password); Loading Loading
mobile/src/auth/infrastructure/dev/datasources/auth_datasource.ts +2 −1 Original line number Diff line number Diff line Loading @@ -2,12 +2,13 @@ import { delay } from '../../../../common/utils/delay_time'; import { AuthDataSource } from '../../../domain/datasources/auth_datasource'; import { LoginInfoEntity } from '../../../domain/entities/login_info_entity'; import { RegisterInfoEntity } from '../../../domain/entities/register_info'; import { ResetPasswordInfoEntity } from '../../../domain/entities/reset_password_entity'; import { UserInfoEntity } from '../../../domain/entities/user_info_entity'; export class AuthDataSourceDev implements AuthDataSource { getResetCode (email: string): Promise<void>{ throw new Error("Method not implemented."); } resetPassword (code: string): Promise<void> { resetPassword (resetInfo: ResetPasswordInfoEntity): Promise<void> { throw new Error("Method not implemented."); } async login(email: string, password: string): Promise<LoginInfoEntity>{ Loading
mobile/src/auth/infrastructure/prod/datasources/auth_datasource.ts +21 −4 Original line number Diff line number Diff line Loading @@ -7,13 +7,30 @@ import { API_URL } from "../../../../common/constants/api"; import { LoginUserModel } from "../models/login_user_model"; import { UserInfoEntity } from "../../../domain/entities/user_info_entity"; import { RegisterResponseModel } from "../models/register_user_model"; import { ResetPasswordInfoEntity } from "../../../domain/entities/reset_password_entity"; export class AuthDatasourceProd implements AuthDataSource { getResetCode (email: string): Promise<void> { throw new Error("Method not implemented."); async getResetCode (email: string): Promise<void> { const {status} = await axios.post(`${API_URL}/user/get-reset-code`, { email }); if (status !== 201) { throw new Error("Error fetching new reset code"); } } async resetPassword (resetInfo: ResetPasswordInfoEntity): Promise<void> { const resetInfoModel = { email: resetInfo.email, resetCode: resetInfo.code, newPassword: resetInfo.newPassword } const {status} = await axios.post(`${API_URL}/user/reset-password`, resetInfoModel); if (status !== 201) { throw new Error("Error reset Password"); } resetPassword (code: string): Promise<void> { throw new Error("Method not implemented."); } login: (email: string, password: string) => Promise<LoginInfoEntity> = async (email, password) => { const loginInfo: LoginUserModel = { Loading
mobile/src/auth/infrastructure/prod/repositories/auth_repository.ts +3 −2 Original line number Diff line number Diff line import { AuthDataSource } from '../../../domain/datasources/auth_datasource'; import { RegisterInfoEntity } from '../../../domain/entities/register_info'; import { ResetPasswordInfoEntity } from '../../../domain/entities/reset_password_entity'; import { UserInfoEntity } from '../../../domain/entities/user_info_entity'; import { AuthRepository } from '../../../domain/repositories/auth_repository'; export class AuthRepositoryImpl implements AuthRepository { Loading @@ -8,8 +9,8 @@ export class AuthRepositoryImpl implements AuthRepository { getResetCode (email: string) { return this.authDataSource.getResetCode(email); } resetPassword (code: string) { return this.authDataSource.resetPassword(code); resetPassword (resetInfo: ResetPasswordInfoEntity) { return this.authDataSource.resetPassword(resetInfo); } async login(email: string, password: string) { return await this.authDataSource.login(email, password); Loading