Skip to content

Commit 8601bff

Browse files
committed
fix: Prisma 7.x schema fix, feed API safe casts, daily report Session 6
1 parent be59e15 commit 8601bff

3 files changed

Lines changed: 57 additions & 4 deletions

File tree

uet_web/Docs_software_design/daily_reports/2026-03-20.md

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -358,3 +358,56 @@ Result 3: Pioneer Anomaly Data (Ω-dist: 0.0000, scale match: ✅)
358358
8. ✅ OmegaSearch verified working
359359
9. ✅ 4 Rust modules added to workspace and compiling
360360
10. ✅ Dependency paths fixed for all modules
361+
362+
---
363+
364+
## Session 6: Platform Specs + Phase 0+1 Implementation (same day)
365+
366+
### Platform Specification Documents (7 new specs)
367+
368+
Researched open-source projects and wrote 7 comprehensive spec documents into `platform_specs/`:
369+
370+
| # | Document | Content |
371+
|---|----------|---------|
372+
| 28 | OPEN_SOURCE_STACK_SELECTION | Evaluation matrix: Rocket.Chat, LiveKit, Tiptap+Yjs, LibreChat, Stripe |
373+
| 29 | SOCIAL_FEED_AND_PROFILES | Feed, posts, follows, media upload, Prisma models, API routes |
374+
| 30 | REALTIME_CHAT_AND_MESSAGING | Rocket.Chat deploy, OAuth SSO, AI bot, embedded chat |
375+
| 31 | WORKSPACE_AND_COLLABORATION | Discord-like workspaces, channels, roles, Tiptap collab docs |
376+
| 32 | VIDEO_AND_VOICE | LiveKit WebRTC SFU, voice channels, screen share |
377+
| 33 | CREDIT_AND_SUBSCRIPTION | Credit model, Stripe billing, AI usage metering, UET→Credit exchange |
378+
| 34 | INTEGRATION_ARCHITECTURE | Full system diagram, Docker Compose, SSO, data ownership |
379+
380+
### Phase 0: Foundation Fixes (Implemented)
381+
382+
1. **Auth env vars** — Replaced all 8 hardcoded `localhost:3001` in auth pages with `NEXT_PUBLIC_API_URL` env var
383+
2. **Prisma schema extended** — 180 → 368 lines, added 10 new models:
384+
- `Follow` (social graph), `Vote` (upvote/downvote), `Media` (file uploads)
385+
- `Workspace`, `WorkspaceMember`, `Document` (collaboration)
386+
- `CreditBalance`, `CreditTransaction`, `Subscription` (billing)
387+
- User profile fields: `displayName`, `bio`, `avatarUrl`, `institution`, `website`
388+
- Post: added `isVerified`, `votes`, `media` relations
389+
- Project: added `workspaceId` for workspace linkage
390+
3. **Workchat redirect**`/workchat` now redirects to `/chat`
391+
4. **Docker env** — Added `NEXT_PUBLIC_API_URL` to docker-compose.yml
392+
5. **Prisma 7.x fix** — Removed `url` from datasource block (moved to prisma.config.ts)
393+
394+
### Phase 1: Academic Social Feed (Implemented)
395+
396+
**New Pages:**
397+
- `/feed` — Infinite scroll feed with Latest/Trending/Following modes, tag filtering
398+
- `/feed/new` — Post composer with title, Markdown content, tag system
399+
- `/profile/[userId]` — User profile with bio, stats, recent posts, follow button
400+
401+
**New API Routes:**
402+
- `GET /api/feed` — Paginated feed with cursor, mode, tag filters
403+
- `POST /api/posts/[id]/upvote` — Toggle upvote/downvote with atomic counter
404+
- `POST /api/follow/[userId]` — Follow user
405+
- `DELETE /api/follow/[userId]` — Unfollow user
406+
- `GET /api/profile/[userId]` — Profile data with follower counts + recent posts
407+
408+
**New Components:**
409+
- `FeedCard` — Post card with author info, content preview, tags, vote buttons, comment count
410+
411+
**Navigation:**
412+
- Added Feed link to landing page navbar
413+
- Fixed Topics link to use locale prefix

uet_web/prisma/schema.prisma

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ generator client {
99

1010
datasource db {
1111
provider = "postgresql"
12-
url = env("DATABASE_URL")
1312
}
1413

1514
// ==========================================

uet_web/src/app/api/feed/route.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,15 @@ export async function GET(request: Request) {
4040
select: {
4141
id: true,
4242
email: true,
43-
name: true,
44-
image: true,
43+
displayName: true,
44+
avatarUrl: true,
45+
institution: true,
4546
reputation: true,
4647
} as any,
4748
},
4849
tags: true,
4950
_count: {
50-
select: { comments: true } as any,
51+
select: { comments: true, votes: true } as any,
5152
},
5253
},
5354
})

0 commit comments

Comments
 (0)