Spaces:
Sleeping
Sleeping
Download src/modules/n8n/application/useCases/AttachPhoneNumberUseCase.ts from fouadkhalid123/asd: direct link, hf CLI and curl.
- Browser
- Download file 699 Bytes
-
https://huggingface.co/spaces/fouadkhalid123/asd/resolve/main/src/modules/n8n/application/useCases/AttachPhoneNumberUseCase.ts
- Command line
-
hf download hf://spaces/fouadkhalid123/asd/src/modules/n8n/application/useCases/AttachPhoneNumberUseCase.ts
-
curl -L -o AttachPhoneNumberUseCase.ts https://huggingface.co/spaces/fouadkhalid123/asd/resolve/main/src/modules/n8n/application/useCases/AttachPhoneNumberUseCase.ts
699 Bytes
| import { UnitOfWorkFactory } from "src/libs/shared/infrastructure/postgres/unitOfWork/UnitOfWorkFactory"; | |
| export class AttachPhoneNumberUseCase { | |
| constructor(private readonly uowFactory: UnitOfWorkFactory) { } | |
| async execute(storeId: string, phoneNumberId: string): Promise<void> { | |
| await this.uowFactory.execute(async (uow) => { | |
| const cred = await uow.credentials.findByStoreId(storeId); | |
| if (!cred) { | |
| throw new Error("Credentials not found for store"); | |
| } | |
| await uow.credentials.upsert({ | |
| ...cred, | |
| phoneNumberId, | |
| updatedAt: new Date(), | |
| }); | |
| }); | |
| } | |
| } | |