Skip to content

Commit

Permalink
pr: fix $ char for endpoint with ID (#34)
Browse files Browse the repository at this point in the history
  • Loading branch information
thanhpt1110 authored Nov 22, 2024
1 parent 79a5012 commit 71021ac
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
12 changes: 6 additions & 6 deletions src/ChitChat.WebAPI/Controllers/ConversationController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public async Task<IActionResult> GetAllConversationsAsync([FromQuery] Pagination
return Ok(ApiResult<List<ConversationDto>>.Success(await _conversationService.GetAllConversationsAsync(pagination)));
}
[HttpGet]
[Route("${conversationId}")]
[Route("{conversationId}")]
public async Task<IActionResult> GetConversationsByIdAsync(Guid conversationId, [FromQuery] int messagePageIndex = 0, [FromQuery] int messagePageSize = 100)
{
return Ok(ApiResult<ConversationDetailDto>.Success(await _conversationService.GetConversationsByIdAsync(conversationId, messagePageIndex, messagePageSize)));
Expand All @@ -42,31 +42,31 @@ public async Task<IActionResult> CreateConversationAsync([FromBody] List<string>
return Ok(ApiResult<ConversationDto>.Success(await _conversationService.CreateConversationAsync(userIds)));
}
[HttpPost]
[Route("${conversationId}")]
[Route("{conversationId}")]
public async Task<IActionResult> SendMessageAsync(Guid conversationId, [FromBody] RequestSendMessageDto request)
{
return Ok(ApiResult<MessageDto>.Success(await _conversationService.SendMessageAsync(conversationId, request)));
}
[HttpPut]
[Route("${conversationId}")]
[Route("{conversationId}")]
public async Task<IActionResult> UpdateConversationAsync(Guid conversationId, [FromBody] ConversationDto request)
{
return Ok(ApiResult<ConversationDto>.Success(await _conversationService.UpdateConversationAsync(request)));
}
[HttpPut]
[Route("${conversationId}/messages/{messageId}")]
[Route("{conversationId}/messages/{messageId}")]
public async Task<IActionResult> UpdateMessageAsync(Guid conversationId, Guid messageId, [FromBody] MessageDto messageDto)
{
return Ok(ApiResult<MessageDto>.Success(await _conversationService.UpdateMessageAsync(messageDto)));
}
[HttpDelete]
[Route("${conversationId}")]
[Route("{conversationId}")]
public async Task<IActionResult> DeleteConversationAsync(Guid conversationId)
{
return Ok(ApiResult<ConversationDto>.Success(await _conversationService.DeleteConversationAsync(conversationId)));
}
[HttpDelete]
[Route("${conversationId}/messages/{messageId}")]
[Route("{conversationId}/messages/{messageId}")]
public async Task<IActionResult> DeleteConversationAsync(Guid conversationId, Guid messageId)
{
return Ok(ApiResult<MessageDto>.Success(await _conversationService.DeleteMessageAsync(messageId)));
Expand Down
4 changes: 2 additions & 2 deletions src/ChitChat.WebAPI/Controllers/ProfileController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public async Task<IActionResult> GetAllProfilesAsync([FromQuery] ProfileSearchQu
return Ok(ApiResult<List<ProfileDto>>.Success(await _profileService.GetAllProfilesAsync(query)));
}
[HttpGet]
[Route("${userId}")]
[Route("{userId}")]
public async Task<IActionResult> GetProfileByIdAsync(Guid userId)
{
return Ok(ApiResult<ProfileDto>.Success(await _profileService.GetProfileByIdAsync(userId)));
Expand All @@ -37,7 +37,7 @@ public async Task<IActionResult> CreatProfileeAsync([FromBody] ProfileRequestDto
return Ok(ApiResult<ProfileDto>.Success(await _profileService.CreatProfileAsync(request)));
}
[HttpPut]
[Route("${userId}")]
[Route("{userId}")]
[AllowAnonymous]
public async Task<IActionResult> GetProfileByIdAsync(Guid userId, [FromBody] ProfileRequestDto Profile)
{
Expand Down

0 comments on commit 71021ac

Please sign in to comment.