添加项目文件。

This commit is contained in:
2026-04-30 21:08:28 +08:00
parent c60f5fe117
commit cc017b6495
327 changed files with 12860 additions and 0 deletions
@@ -0,0 +1,38 @@
using IM.ASPNETCore;
using MessageService.Infrastructure;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using System.Security.Claims;
namespace MessageService.WebApi.Controllers.Message
{
[Route("api/[controller]/[action]")]
[Authorize]
[ApiController]
public class MessageController : ControllerBase
{
private readonly Application.Message.MessageService service;
public MessageController(Application.Message.MessageService service)
{
this.service = service;
}
[HttpPost]
[UnitOfWork(typeof(MessageDbContext))]
public async Task<IActionResult> Send(MessageSendRequest request)
{
var userId = User.FindFirstValue(ClaimTypes.NameIdentifier);
var command = request.ToCommand(Guid.Parse(userId));
return Ok(await service.SendMsgAsync(command));
}
[HttpPost]
[UnitOfWork(typeof(MessageDbContext))]
public async Task<IActionResult> WithDraw([FromRoute] Guid msgId)
{
var userId = User.FindFirstValue(ClaimTypes.NameIdentifier);
return Ok(await service.WithDrawMsgAsync(msgId, Guid.Parse(userId)));
}
}
}