Spaces:
Sleeping
Sleeping
Download src/modules/auth/application/useCases/LoginUseCase.ts from fouadkhalid123/asd: direct link, hf CLI and curl.
- Browser
- Download file 968 Bytes
-
https://huggingface.co/spaces/fouadkhalid123/asd/resolve/main/src/modules/auth/application/useCases/LoginUseCase.ts
- Command line
-
hf download hf://spaces/fouadkhalid123/asd/src/modules/auth/application/useCases/LoginUseCase.ts
-
curl -L -o LoginUseCase.ts https://huggingface.co/spaces/fouadkhalid123/asd/resolve/main/src/modules/auth/application/useCases/LoginUseCase.ts
968 Bytes
| import { AuthOrchestrator } from "../orchestrator/AuthOrchestrator"; | |
| import { UnitOfWorkFactory } from "../../../../libs/shared/infrastructure/postgres/unitOfWork/UnitOfWorkFactory"; | |
| import { IUnitOfWork } from "../../../../libs/shared/infrastructure/postgres/unitOfWork/IUnitOfWork"; | |
| export interface LoginInput { | |
| email: string; | |
| password: string; | |
| } | |
| export interface LoginOutput { | |
| token: string; | |
| user: { | |
| id: string; | |
| email: string; | |
| organizationId: string; | |
| storeId: string; | |
| role: string; | |
| }; | |
| } | |
| export class LoginUseCase { | |
| private readonly orchestrator: AuthOrchestrator; | |
| constructor(private readonly uowFactory: UnitOfWorkFactory) { | |
| this.orchestrator = new AuthOrchestrator(); | |
| } | |
| async execute(input: LoginInput): Promise<LoginOutput> { | |
| return this.uowFactory.execute(async (uow: IUnitOfWork) => { | |
| return this.orchestrator.signIn(uow, input); | |
| }); | |
| } | |
| } | |