feat: working on edit profile ticket

This commit is contained in:
Abdalhamid Alhamad
2025-08-05 17:53:38 +03:00
parent 1e2b859b92
commit 275984954e
37 changed files with 298 additions and 275 deletions

View File

@ -30,6 +30,9 @@ export class CustomerService {
this.logger.log(`Updating customer ${userId}`);
await this.validateProfilePictureForCustomer(userId, data.profilePictureId);
if (data.civilIdBackId || data.civilIdFrontId) {
await this.validateCivilIdForCustomer(userId, data.civilIdFrontId!, data.civilIdBackId!);
}
await this.customerRepository.updateCustomer(userId, data);
this.logger.log(`Customer ${userId} updated successfully`);
return this.findCustomerById(userId);
@ -52,9 +55,6 @@ export class CustomerService {
throw new BadRequestException('CUSTOMER.NOT_FOUND');
}
if (customer.profilePicture) {
customer.profilePicture.url = await this.ociService.generatePreSignedUrl(customer.profilePicture);
}
this.logger.log(`Customer ${id} found successfully`);
return customer;
}
@ -101,8 +101,6 @@ export class CustomerService {
throw new BadRequestException('CUSTOMER.ALREADY_EXISTS');
}
// await this.validateCivilIdForCustomer(userId, body.civilIdFrontId, body.civilIdBackId);
const customer = await this.customerRepository.createCustomer(userId, body, true);
this.logger.log(`customer created for user ${userId}`);
@ -215,14 +213,7 @@ export class CustomerService {
promises.push(this.ociService.generatePreSignedUrl(customer.civilIdFront));
promises.push(this.ociService.generatePreSignedUrl(customer.civilIdBack));
if (customer.profilePicture) {
promises.push(this.ociService.generatePreSignedUrl(customer.profilePicture));
}
const [civilIdFrontUrl, civilIdBackUrl, profilePictureUrl] = await Promise.all(promises);
if (customer.profilePicture) {
customer.profilePicture.url = profilePictureUrl;
}
customer.civilIdFront.url = civilIdFrontUrl;
customer.civilIdBack.url = civilIdBackUrl;