Implement social activity feed with posts, likes, and comments.
Created FeedPost.cs with:
- Tenant isolation (ITenantEntity)
- Content, ImageUrl, IsPinned fields
- Optional GroupId for group-specific posts
- Likes and Comments collections
Created PostLike.cs with:
- Post/User junction
- CreatedAt timestamp
- Unique constraint (one like per user per post)
Created PostComment.cs with:
- Post/User junction
- Content field (max 2000 chars)
- CreatedAt/UpdatedAt timestamps
Added to NexusDbContext:
- feed_posts, post_likes, post_comments tables
- Global query filters for tenant isolation
- Cascade deletes for likes/comments when post deleted
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/feed | List feed posts (paginated, filterable by group) |
| GET | /api/feed/{id} | Get single post with like/comment counts |
| POST | /api/feed | Create a post |
| PUT | /api/feed/{id} | Update post (author only) |
| DELETE | /api/feed/{id} | Delete post (author or group admin) |
| POST | /api/feed/{id}/like | Like a post |
| DELETE | /api/feed/{id}/like | Unlike a post |
| GET | /api/feed/{id}/comments | List comments (paginated) |
| POST | /api/feed/{id}/comments | Add comment |
| DELETE | /api/feed/{id}/comments/{commentId} | Delete comment |
# Start the Docker stack (migrations run automatically)
docker compose up -d
# Or run migrations manually inside container
docker compose exec api dotnet ef database updateRun after API is running:
powershell -ExecutionPolicy Bypass -File "C:\Users\jaspe\AppData\Local\Temp\claude\c--xampp-htdocs-asp-net-backend\18a553b7-f5b3-4456-9c43-ff9a0cd73a0b\scratchpad\test-feed.ps1"src/Nexus.Api/Entities/FeedPost.cssrc/Nexus.Api/Entities/PostLike.cssrc/Nexus.Api/Entities/PostComment.cssrc/Nexus.Api/Controllers/FeedController.cs
src/Nexus.Api/Data/NexusDbContext.cs- Added 3 new DbSets and configurations
- Any user can create community-wide posts
- Group posts require group membership
- Only author can update their post
- Author or group admin/owner can delete post
- Posts sorted by pinned first, then by date
- One like per user per post
- Like count returned with post data
is_likedfield indicates if current user has liked
- Any authenticated user can comment
- Comment author, post author, or group admin can delete comments
- Comments sorted chronologically (oldest first)
=== Phase 12: Social Feed Tests ===
(Run the test script after migration to populate results)