fix: align backend APIs and upload flow
This commit is contained in:
@@ -37,11 +37,24 @@ namespace MessageService.WebApi.Controllers.Message
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public async Task<IActionResult> GetMessages([FromQuery]Guid conversationId, long? cursor, int direction, int limit)
|
||||
public async Task<IActionResult> GetMessages([FromQuery]Guid conversationId, long? cursor, int direction, int limit, CancellationToken cancellationToken)
|
||||
{
|
||||
var userId = User.FindFirstValue(ClaimTypes.NameIdentifier);
|
||||
var command = new GetMessageCommand(conversationId, Guid.Parse(userId), cursor, direction, limit);
|
||||
return Ok(await service.GetMessagesAsync(command));
|
||||
return Ok(await service.GetMessagesAsync(command, cancellationToken));
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public async Task<IActionResult> Search(
|
||||
[FromQuery] Guid conversationId,
|
||||
[FromQuery] string keyword,
|
||||
long? cursor,
|
||||
int limit = 30,
|
||||
CancellationToken cancellationToken = default)
|
||||
{
|
||||
var userId = User.FindFirstValue(ClaimTypes.NameIdentifier);
|
||||
var command = new SearchMessageCommand(conversationId, Guid.Parse(userId!), keyword, cursor, limit);
|
||||
return Ok(await service.SearchMessagesAsync(command, cancellationToken));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user