feat: quick polls in comments that end in a decision

«📊 Añadir una encuesta» adds 2 to 6 options to a new comment. Members,
viewers too, vote by clicking an option (one vote each, which they can
change or take back) and see each option's votes as a bar. Whoever
started it, or an admin, closes it with «Cerrar y decidir»: the most
voted wins (none on a tie) and a «Decidido: …» reply marked as a
decision shows above the ticket. Events of the comment (voted, closed).

API: addComment(…, poll), votePoll, closePoll, Comment.poll;
POST /api/comments/{id}/poll/vote and …/poll/close. MCP: add_comment
poll, vote_poll, close_poll.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-20 20:48:12 +02:00
parent 93d028e870
commit 3a46a236e4
41 changed files with 2144 additions and 77 deletions

View File

@@ -8216,6 +8216,226 @@
]
}
},
"/api/comments/{commentId}/poll/vote": {
"post": {
"description": "option: its index; null takes the vote back.",
"operationId": "CommentsController_votePoll",
"parameters": [
{
"name": "commentId",
"required": true,
"in": "path",
"schema": {
"type": "string"
}
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/VotePollDto"
}
}
}
},
"responses": {
"200": {
"description": "",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/CommandResultDto"
}
}
}
},
"400": {
"description": "Invalid input",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ApiErrorDto"
}
}
}
},
"401": {
"description": "Missing or rejected Pireon token",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ApiErrorDto"
}
}
}
},
"403": {
"description": "Not a member of the project (or not allowed)",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ApiErrorDto"
}
}
}
},
"404": {
"description": "Not found",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ApiErrorDto"
}
}
}
},
"409": {
"description": "Someone changed it at the same time: retry",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ApiErrorDto"
}
}
}
},
"422": {
"description": "Business rule (e.g. a transition the workflow forbids)",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ApiErrorDto"
}
}
}
}
},
"security": [
{
"pireon-oauth": []
},
{
"pireon": []
}
],
"summary": "Vote in a comment's poll (members, viewers too)",
"tags": [
"Comments"
]
}
},
"/api/comments/{commentId}/poll/close": {
"post": {
"description": "With decide (default), the winner stays as a decision of the ticket.",
"operationId": "CommentsController_closePoll",
"parameters": [
{
"name": "commentId",
"required": true,
"in": "path",
"schema": {
"type": "string"
}
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ClosePollDto"
}
}
}
},
"responses": {
"200": {
"description": "",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/CommandResultDto"
}
}
}
},
"400": {
"description": "Invalid input",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ApiErrorDto"
}
}
}
},
"401": {
"description": "Missing or rejected Pireon token",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ApiErrorDto"
}
}
}
},
"403": {
"description": "Not a member of the project (or not allowed)",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ApiErrorDto"
}
}
}
},
"404": {
"description": "Not found",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ApiErrorDto"
}
}
}
},
"409": {
"description": "Someone changed it at the same time: retry",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ApiErrorDto"
}
}
}
},
"422": {
"description": "Business rule (e.g. a transition the workflow forbids)",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ApiErrorDto"
}
}
}
}
},
"security": [
{
"pireon-oauth": []
},
{
"pireon": []
}
],
"summary": "Close a poll (whoever started it, or an admin)",
"tags": [
"Comments"
]
}
},
"/api/comments/{commentId}/resolution": {
"put": {
"description": "Whoever can change the ticket. A conclusion is added as a reply marked as a decision. The web folds a settled conversation.",
@@ -17618,6 +17838,48 @@
"users"
]
},
"PollOptionDto": {
"type": "object",
"properties": {
"text": {
"type": "string"
},
"voters": {
"type": "array",
"items": {
"$ref": "#/components/schemas/UserRefDto"
}
}
},
"required": [
"text",
"voters"
]
},
"CommentPollDto": {
"type": "object",
"properties": {
"options": {
"type": "array",
"items": {
"$ref": "#/components/schemas/PollOptionDto"
}
},
"closed": {
"type": "boolean"
},
"winner": {
"type": "number",
"nullable": true,
"description": "Index of the winning option once closed (null on a tie)"
}
},
"required": [
"options",
"closed",
"winner"
]
},
"CommentDto": {
"type": "object",
"properties": {
@@ -17672,6 +17934,15 @@
"nullable": true,
"format": "date-time"
},
"poll": {
"nullable": true,
"type": "object",
"allOf": [
{
"$ref": "#/components/schemas/CommentPollDto"
}
]
},
"resolved": {
"type": "boolean",
"description": "A conversation (top-level comment and its replies) that was settled"
@@ -17715,6 +17986,7 @@
"decision",
"decidedBy",
"decidedAt",
"poll",
"resolved",
"resolvedBy",
"resolvedAt",
@@ -17768,6 +18040,17 @@
"type": "string",
"format": "uuid",
"description": "Comment it answers (one level: answering a reply joins its thread)"
},
"poll": {
"description": "A quick poll: 2 to 6 options",
"example": [
"Stripe",
"Redsys"
],
"type": "array",
"items": {
"type": "string"
}
}
},
"required": [
@@ -17860,6 +18143,29 @@
"on"
]
},
"VotePollDto": {
"type": "object",
"properties": {
"option": {
"type": "number",
"nullable": true,
"description": "Option index; null takes the vote back"
}
},
"required": [
"option"
]
},
"ClosePollDto": {
"type": "object",
"properties": {
"decide": {
"type": "boolean",
"default": true,
"description": "Keep the winner as a decision of the ticket"
}
}
},
"ResolveThreadDto": {
"type": "object",
"properties": {