前端:
1、完善创建群聊逻辑 后端: 1、完善群聊相关接口
This commit is contained in:
@@ -32,12 +32,40 @@ namespace IM_API.Controllers
|
||||
|
||||
[HttpPost]
|
||||
[ProducesResponseType(typeof(BaseResponse<GroupInfoDto>), StatusCodes.Status200OK)]
|
||||
public async Task<ActionResult> CreateGroup([FromBody]GroupCreateDto groupCreateDto)
|
||||
public async Task<IActionResult> CreateGroup([FromBody]GroupCreateDto groupCreateDto)
|
||||
{
|
||||
var userIdStr = User.FindFirstValue(ClaimTypes.NameIdentifier);
|
||||
var groupInfo = await _groupService.CreateGroupAsync(int.Parse(userIdStr), groupCreateDto);
|
||||
var res = new BaseResponse<GroupInfoDto>(groupInfo);
|
||||
return Ok(res);
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
[ProducesResponseType(typeof(BaseResponse<object?>), StatusCodes.Status200OK)]
|
||||
public async Task<IActionResult> HandleGroupInvite([FromBody]HandleGroupInviteDto dto)
|
||||
{
|
||||
string userIdStr = User.FindFirstValue(ClaimTypes.NameIdentifier)!;
|
||||
await _groupService.HandleGroupInviteAsync(int.Parse(userIdStr), dto);
|
||||
var res = new BaseResponse<object?>();
|
||||
return Ok(res);
|
||||
}
|
||||
[HttpPost]
|
||||
[ProducesResponseType(typeof(BaseResponse<object?>), StatusCodes.Status200OK)]
|
||||
public async Task<IActionResult> HandleGroupRequest([FromBody]HandleGroupRequestDto dto)
|
||||
{
|
||||
string userIdStr = User.FindFirstValue(ClaimTypes.NameIdentifier);
|
||||
await _groupService.HandleGroupRequestAsync(int.Parse(userIdStr),dto);
|
||||
var res = new BaseResponse<object?>();
|
||||
return Ok(res);
|
||||
}
|
||||
[HttpPost]
|
||||
[ProducesResponseType(typeof(BaseResponse<object?>), StatusCodes.Status200OK)]
|
||||
public async Task<IActionResult> InviteUser([FromBody]GroupInviteUserDto dto)
|
||||
{
|
||||
string userIdStr = User.FindFirstValue(ClaimTypes.NameIdentifier);
|
||||
await _groupService.InviteUsersAsync(int.Parse(userIdStr), dto.GroupId, dto.Ids);
|
||||
var res = new BaseResponse<object?>();
|
||||
return Ok(res);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user