mirror of
https://github.com/HamzaSha1/zod-backend.git
synced 2025-08-25 13:49:40 +00:00
feat: working on edit profile ticket
This commit is contained in:
@ -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;
|
||||
|
Reference in New Issue
Block a user