feat(guild_chat): post text + stamp
Implements PostTextOrStampAsync: validates membership (NotInGuild), validates stamp id against UsableStampList (PermissionDenied), rejects type other than 0 or 1, allocates next per-guild message_id, appends row. Wires /guild_chat/post controller action mapping failures to result_code=2. Response is GuildChatPostResponse (empty body per spec). 7 integration tests. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -78,8 +78,13 @@ public sealed class GuildChatController : SVSimController
|
||||
}
|
||||
|
||||
[HttpPost("post")]
|
||||
public Task<ActionResult<GuildChatPostResponse>> Post([FromBody] GuildChatPostRequest req, CancellationToken ct)
|
||||
=> Task.FromResult<ActionResult<GuildChatPostResponse>>(new GuildChatPostResponse());
|
||||
public async Task<ActionResult<GuildChatPostResponse>> Post([FromBody] GuildChatPostRequest req, CancellationToken ct)
|
||||
{
|
||||
if (!TryGetViewerId(out var viewerId)) return Unauthorized();
|
||||
var result = await _chat.PostTextOrStampAsync(viewerId, req.Type, req.Message, ct);
|
||||
if (!result.Ok) return Ok(new { result_code = 2 });
|
||||
return new GuildChatPostResponse();
|
||||
}
|
||||
|
||||
[HttpPost("add_deck")]
|
||||
public Task<ActionResult<EmptyResponse>> AddDeck([FromBody] GuildChatAddDeckRequest req, CancellationToken ct)
|
||||
|
||||
Reference in New Issue
Block a user