Skip to content

Commit

Permalink
update customer profile (#12)
Browse files Browse the repository at this point in the history
Co-authored-by: NHT <[email protected]>
  • Loading branch information
nfesta2023 and hoangtuan910 authored Apr 14, 2024
1 parent 887d657 commit edfcd03
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions src/dependency/nuti-expert/nuti-expert.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,11 @@ export class NutiExpertService {
},
data: data,
};
console.log(config);
// console.log(config);
const request = this.httpService.request(config);

const result = await lastValueFrom(request);
console.log(result.data);
// console.log(result.data);
return {
bmi: result.data.result.chiSoBMI.result.bmi,
recommended_dietary_allowance_kcal:
Expand Down
16 changes: 8 additions & 8 deletions src/feature/customer/customer.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,13 +188,7 @@ export class CustomerService {
const healthInfo = await this.healthInfoRepo.findOneBy({
health_info_id: customer.health_info.health_info_id,
});
healthInfo.height_m = height_m;
healthInfo.weight_kg = weight_kg;
healthInfo.physical_activity_level = physical_activity_level;
healthInfo.current_diet = current_diet;
healthInfo.allergic_food = allergic_food;
healthInfo.chronic_disease = chronic_disease;
healthInfo.expected_diet = expected_diet;

/*
//Recalculate BMI & Recommended dietary allowance kcal
//Only if there is an update in:
Expand All @@ -219,6 +213,13 @@ export class CustomerService {
healthInfo.recommended_dietary_allowance_kcal =
recommended_dietary_allowance_kcal;
}
healthInfo.height_m = height_m;
healthInfo.weight_kg = weight_kg;
healthInfo.physical_activity_level = physical_activity_level;
healthInfo.current_diet = current_diet;
healthInfo.allergic_food = allergic_food;
healthInfo.chronic_disease = chronic_disease;
healthInfo.expected_diet = expected_diet;
const newHealthInfo = await this.healthInfoRepo.save(healthInfo);
customer.health_info = newHealthInfo;
}
Expand Down Expand Up @@ -267,7 +268,6 @@ export class CustomerService {
});

const data = await upload.done();
console.log('respose upload data', data);
if (data) {
return data;
} else {
Expand Down

0 comments on commit edfcd03

Please sign in to comment.