feat(REQ-001): add portfolio comment history API, CLI, repository, migration, and tests

Agent-Logs-Url: https://github.com/genichin/portfolio-hub/sessions/64fc2cec-78f5-41d1-99a4-45f868781edd

Co-authored-by: genichin <4282227+genichin@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2026-04-10 13:54:18 +00:00
committed by GitHub
co-authored by genichin
parent 4684597353
commit e8f782bec6
14 changed files with 1173 additions and 10 deletions
+98
View File
@@ -259,6 +259,104 @@ Response 204:
- No content.
### 4.11 POST /portfolios/{portfolio_id}/comments
Create a new comment for a portfolio.
Required permission: `trade-write`
Request:
```bash
curl -X POST "http://localhost:8000/portfolios/krw-btc/comments" \
-H "Authorization: Bearer <TRADE_WRITE_TOKEN>" \
-H "Content-Type: application/json" \
-d '{"content": "Bought more BTC today.\nLooking good."}'
```
Response 201:
```json
{
"id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"portfolio_id": "krw-btc",
"content": "Bought more BTC today.\nLooking good.",
"created_at": "2026-04-10T00:00:00Z",
"updated_at": "2026-04-10T00:00:00Z"
}
```
### 4.12 GET /portfolios/{portfolio_id}/comments
List all comments for a portfolio, sorted by most recent first.
Required permission: `read`
Request:
```bash
curl -X GET "http://localhost:8000/portfolios/krw-btc/comments" \
-H "Authorization: Bearer <READ_TOKEN>"
```
Response 200:
```json
[
{
"id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"portfolio_id": "krw-btc",
"content": "Bought more BTC today.\nLooking good.",
"created_at": "2026-04-10T00:00:00Z",
"updated_at": "2026-04-10T00:00:00Z"
}
]
```
### 4.13 PATCH /portfolios/{portfolio_id}/comments/{comment_id}
Update an existing comment's content.
Required permission: `trade-write`
Request:
```bash
curl -X PATCH "http://localhost:8000/portfolios/krw-btc/comments/a1b2c3d4-e5f6-7890-abcd-ef1234567890" \
-H "Authorization: Bearer <TRADE_WRITE_TOKEN>" \
-H "Content-Type: application/json" \
-d '{"content": "Updated note: BTC rally continues."}'
```
Response 200:
```json
{
"id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"portfolio_id": "krw-btc",
"content": "Updated note: BTC rally continues.",
"created_at": "2026-04-10T00:00:00Z",
"updated_at": "2026-04-10T01:00:00Z"
}
```
### 4.14 DELETE /portfolios/{portfolio_id}/comments/{comment_id}
Delete a comment.
Required permission: `trade-write`
Request:
```bash
curl -X DELETE "http://localhost:8000/portfolios/krw-btc/comments/a1b2c3d4-e5f6-7890-abcd-ef1234567890" \
-H "Authorization: Bearer <TRADE_WRITE_TOKEN>"
```
Response 204:
- No content.
## 5. Strategy Sets
### 5.1 GET /strategy-sets