diff --git a/src/ChitChat.Application/Services/Interface/IProfileService.cs b/src/ChitChat.Application/Services/Interface/IProfileService.cs index ed0ded6..d851f1f 100644 --- a/src/ChitChat.Application/Services/Interface/IProfileService.cs +++ b/src/ChitChat.Application/Services/Interface/IProfileService.cs @@ -7,7 +7,7 @@ public interface IProfileService Task> GetAllProfilesAsync(ProfileSearchQueryDto query); Task GetProfileByIdAsync(Guid userId); Task CreatProfileAsync(ProfileRequestDto request); - Task UpdateProfileAsync(Guid userId, ProfileDto request); + Task UpdateProfileAsync(Guid userId, ProfileRequestDto request); } } diff --git a/src/ChitChat.Application/Services/ProfileService.cs b/src/ChitChat.Application/Services/ProfileService.cs index dc12eaf..5513f13 100644 --- a/src/ChitChat.Application/Services/ProfileService.cs +++ b/src/ChitChat.Application/Services/ProfileService.cs @@ -62,7 +62,7 @@ public async Task CreatProfileAsync(ProfileRequestDto request) _mapper.Map(userApplication, response); return response; } - public async Task UpdateProfileAsync(Guid userId, ProfileDto request) + public async Task UpdateProfileAsync(Guid userId, ProfileRequestDto request) { if (userId.ToString() != _claimService.GetUserId()) { @@ -79,7 +79,9 @@ public async Task UpdateProfileAsync(Guid userId, ProfileDto request userProfile.SearchData = this.GenerateSearchData(request.DisplayName, userApplication.Email ?? "", userId.ToString()); await _profileRepository.UpdateAsync(userProfile); await _userRepository.UpdateAsync(userApplication); - return request; + var response = _mapper.Map(userProfile); + _mapper.Map(userApplication, response); + return response; } private string GenerateSearchData(string displayName, string email, string userId) { diff --git a/src/ChitChat.WebAPI/Controllers/ProfileController.cs b/src/ChitChat.WebAPI/Controllers/ProfileController.cs index 2fb7ebc..5484f33 100644 --- a/src/ChitChat.WebAPI/Controllers/ProfileController.cs +++ b/src/ChitChat.WebAPI/Controllers/ProfileController.cs @@ -39,7 +39,7 @@ public async Task CreatProfileeAsync([FromBody] ProfileRequestDto [HttpPut] [Route("${userId}")] [AllowAnonymous] - public async Task GetProfileByIdAsync(Guid userId, [FromBody] ProfileDto Profile) + public async Task GetProfileByIdAsync(Guid userId, [FromBody] ProfileRequestDto Profile) { return Ok(ApiResult.Success(await _profileService.UpdateProfileAsync(userId, Profile))); }